OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [fixed-point/] [operator-logical.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-std=gnu99" } */
3
 
4
/* C99 Logical AND operator.
5
   C99 Logical OR operator.
6
   Test with fixed-point operands.
7
   Based on the test from ../dfp/.  */
8
 
9
extern void abort (void);
10
 
11
#define OPERATE(OPRD1,OPRT,OPRD2,RLT)   \
12
do                                      \
13
{                                       \
14
  if (( (OPRD1) OPRT (OPRD2) )!= RLT)   \
15
    abort ();                           \
16
} while (0)
17
 
18
#define FIXED_POINT_LOGICAL(OPRD)       \
19
do                                      \
20
{                                       \
21
  OPRD = 0.1;                           \
22
  OPERATE(1,||,OPRD,1);                 \
23
  OPERATE(0,||,OPRD,1);                  \
24
  OPERATE(OPRD,||,1,1);                 \
25
  OPERATE(OPRD,||,0,1);                  \
26
  OPRD = 0;                              \
27
  OPERATE(1,||,OPRD,1);                 \
28
  OPERATE(0,||,OPRD,0);                   \
29
  OPERATE(OPRD,||,1,1);                 \
30
  OPERATE(OPRD,||,0,0);                   \
31
  OPRD = 0.1;                           \
32
  OPERATE(1,&&,OPRD,1);                 \
33
  OPERATE(0,&&,OPRD,0);                   \
34
  OPERATE(OPRD,&&,1,1);                 \
35
  OPERATE(OPRD,&&,0,0);                   \
36
  OPRD = 0;                              \
37
  OPERATE(1,&&,OPRD,0);                  \
38
  OPERATE(0,&&,OPRD,0);                   \
39
  OPERATE(OPRD,&&,1,0);                  \
40
  OPERATE(OPRD,&&,0,0);                   \
41
} while (0)
42
 
43
int
44
main ()
45
{
46
  short _Fract sf;
47
  _Fract f;
48
  long _Fract lf;
49
  long long _Fract llf;
50
  unsigned short _Fract usf;
51
  unsigned _Fract uf;
52
  unsigned long _Fract ulf;
53
  unsigned long long _Fract ullf;
54
  _Sat short _Fract Ssf;
55
  _Sat _Fract Sf;
56
  _Sat long _Fract Slf;
57
  _Sat long long _Fract Sllf;
58
  _Sat unsigned short _Fract Susf;
59
  _Sat unsigned _Fract Suf;
60
  _Sat unsigned long _Fract Sulf;
61
  _Sat unsigned long long _Fract Sullf;
62
  short _Accum sa;
63
  _Accum a;
64
  long _Accum la;
65
  long long _Accum lla;
66
  unsigned short _Accum usa;
67
  unsigned _Accum ua;
68
  unsigned long _Accum ula;
69
  unsigned long long _Accum ulla;
70
  _Sat short _Accum Ssa;
71
  _Sat _Accum Sa;
72
  _Sat long _Accum Sla;
73
  _Sat long long _Accum Slla;
74
  _Sat unsigned short _Accum Susa;
75
  _Sat unsigned _Accum Sua;
76
  _Sat unsigned long _Accum Sula;
77
  _Sat unsigned long long _Accum Sulla;
78
 
79
  /* C99 Section 6.5.{13,14} Logical operator.  Constraints Each of the
80
     operands shall have scalar type.  Fixed-point types would obey this.  */
81
  FIXED_POINT_LOGICAL (sf);
82
  FIXED_POINT_LOGICAL (f);
83
  FIXED_POINT_LOGICAL (lf);
84
  FIXED_POINT_LOGICAL (llf);
85
  FIXED_POINT_LOGICAL (usf);
86
  FIXED_POINT_LOGICAL (uf);
87
  FIXED_POINT_LOGICAL (ulf);
88
  FIXED_POINT_LOGICAL (ullf);
89
  FIXED_POINT_LOGICAL (Ssf);
90
  FIXED_POINT_LOGICAL (Sf);
91
  FIXED_POINT_LOGICAL (Slf);
92
  FIXED_POINT_LOGICAL (Sllf);
93
  FIXED_POINT_LOGICAL (Susf);
94
  FIXED_POINT_LOGICAL (Suf);
95
  FIXED_POINT_LOGICAL (Sulf);
96
  FIXED_POINT_LOGICAL (Sullf);
97
  FIXED_POINT_LOGICAL (sa);
98
  FIXED_POINT_LOGICAL (a);
99
  FIXED_POINT_LOGICAL (la);
100
  FIXED_POINT_LOGICAL (lla);
101
  FIXED_POINT_LOGICAL (usa);
102
  FIXED_POINT_LOGICAL (ua);
103
  FIXED_POINT_LOGICAL (ula);
104
  FIXED_POINT_LOGICAL (ulla);
105
  FIXED_POINT_LOGICAL (Ssa);
106
  FIXED_POINT_LOGICAL (Sa);
107
  FIXED_POINT_LOGICAL (Sla);
108
  FIXED_POINT_LOGICAL (Slla);
109
  FIXED_POINT_LOGICAL (Susa);
110
  FIXED_POINT_LOGICAL (Sua);
111
  FIXED_POINT_LOGICAL (Sula);
112
  FIXED_POINT_LOGICAL (Sulla);
113
 
114
  return 0;
115
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.