1 |
298 |
jeremybenn |
/* { dg-do compile } */
|
2 |
|
|
/* { dg-options "-std=gnu99" } */
|
3 |
|
|
|
4 |
|
|
/* N1169 6.5.7 - Bitwise shift operands.
|
5 |
|
|
C99 6.5.3 Unary operators.
|
6 |
|
|
C99 6.5.5 Multiplicative operators.
|
7 |
|
|
C99 6.5.6 Additive operators.
|
8 |
|
|
C99 6.5.7 Bitwise shift operators.
|
9 |
|
|
C99 6.5.8 Relational operators.
|
10 |
|
|
C99 6.5.9 Equality operators.
|
11 |
|
|
C99 6.5.16 Assignment operators.
|
12 |
|
|
|
13 |
|
|
Check if all operations on constants are ok. */
|
14 |
|
|
|
15 |
|
|
#define ALLOPCONST(TYPE,NAME,POSTFIX) \
|
16 |
|
|
TYPE NAME ## plus = +0.1 ## POSTFIX; \
|
17 |
|
|
unsigned TYPE NAME ## u_plus = +0.1u ## POSTFIX; \
|
18 |
|
|
_Sat TYPE NAME ## sat_plus = +(_Sat TYPE)0.1 ## POSTFIX; \
|
19 |
|
|
_Sat unsigned TYPE NAME ## sat_u_plus = +(_Sat unsigned TYPE)0.1u ## POSTFIX; \
|
20 |
|
|
TYPE NAME ## neg = -0.1 ## POSTFIX; \
|
21 |
|
|
_Sat TYPE NAME ## sat_neg = -(_Sat TYPE)0.1 ## POSTFIX; \
|
22 |
|
|
_Sat unsigned TYPE NAME ## sat_u_neg = -(_Sat unsigned TYPE)0.1u ## POSTFIX; \
|
23 |
|
|
int NAME ## logneg1 = !0.1 ## POSTFIX; \
|
24 |
|
|
int NAME ## logneg1u = !0.1u ## POSTFIX; \
|
25 |
|
|
int NAME ## logneg2 = !0.0 ## POSTFIX; \
|
26 |
|
|
int NAME ## logneg2u = !0.0u ## POSTFIX; \
|
27 |
|
|
TYPE NAME ## add = 0.1 ## POSTFIX + 0.2 ## POSTFIX; \
|
28 |
|
|
unsigned TYPE NAME ## u_add = 0.1u ## POSTFIX + 0.2u ## POSTFIX; \
|
29 |
|
|
_Sat TYPE NAME ## sat_add = (_Sat TYPE)0.8 ## POSTFIX + 0.3 ## POSTFIX; \
|
30 |
|
|
_Sat unsigned TYPE NAME ## sat_u_add = (_Sat unsigned TYPE)0.8u ## POSTFIX + 0.3u ## POSTFIX; \
|
31 |
|
|
TYPE NAME ## sub = 0.1 ## POSTFIX - 0.2 ## POSTFIX; \
|
32 |
|
|
unsigned TYPE NAME ## u_sub = 0.2u ## POSTFIX - 0.1u ## POSTFIX; \
|
33 |
|
|
_Sat TYPE NAME ## sat_sub = (_Sat TYPE)0.1 ## POSTFIX - 0.2 ## POSTFIX; \
|
34 |
|
|
_Sat unsigned TYPE NAME ## sat_u_sub = (_Sat unsigned TYPE)0.1u ## POSTFIX - 0.2u ## POSTFIX; \
|
35 |
|
|
TYPE NAME ## mul = 0.1 ## POSTFIX * 0.2 ## POSTFIX; \
|
36 |
|
|
unsigned TYPE NAME ## u_mul = 0.1u ## POSTFIX * 0.2u ## POSTFIX; \
|
37 |
|
|
_Sat TYPE NAME ## sat_mul = (_Sat TYPE)0.1 ## POSTFIX * 0.2 ## POSTFIX; \
|
38 |
|
|
_Sat unsigned TYPE NAME ## sat_u_mul = (_Sat unsigned TYPE)0.1u ## POSTFIX * 0.2u ## POSTFIX; \
|
39 |
|
|
TYPE NAME ## div = 0.1 ## POSTFIX / 0.3 ## POSTFIX; \
|
40 |
|
|
unsigned TYPE NAME ## u_div = 0.1u ## POSTFIX / 0.3u ## POSTFIX; \
|
41 |
|
|
_Sat TYPE NAME ## sat_div = (_Sat TYPE)0.3 ## POSTFIX / 0.1 ## POSTFIX; \
|
42 |
|
|
_Sat unsigned TYPE NAME ## sat_u_div = (_Sat unsigned TYPE)0.3u ## POSTFIX / 0.1u ## POSTFIX; \
|
43 |
|
|
TYPE NAME ## shl = 0.1 ## POSTFIX << 3; \
|
44 |
|
|
unsigned TYPE NAME ## u_shl = 0.1u ## POSTFIX << 3; \
|
45 |
|
|
_Sat TYPE NAME ## sat_shl = (_Sat TYPE)0.8 ## POSTFIX << 3; \
|
46 |
|
|
_Sat unsigned TYPE NAME ## sat_u_shl = (_Sat unsigned TYPE)0.8u ## POSTFIX << 3; \
|
47 |
|
|
TYPE NAME ## shr = 0.1 ## POSTFIX >> 5; \
|
48 |
|
|
unsigned TYPE NAME ## u_shr = 0.1u ## POSTFIX >> 5; \
|
49 |
|
|
_Sat TYPE NAME ## sat_shr = (_Sat TYPE)0.1 ## POSTFIX >> 5; \
|
50 |
|
|
_Sat unsigned TYPE NAME ## sat_u_shr = (_Sat unsigned TYPE)0.1 ## POSTFIX >> 5; \
|
51 |
|
|
int NAME ## ne = 0.1 ## POSTFIX != 0.2 ## POSTFIX; \
|
52 |
|
|
int NAME ## u_ne = 0.1u ## POSTFIX != 0.2u ## POSTFIX; \
|
53 |
|
|
int NAME ## eq = 0.1 ## POSTFIX == 0.2 ## POSTFIX; \
|
54 |
|
|
int NAME ## u_eq = 0.1u ## POSTFIX == 0.2u ## POSTFIX; \
|
55 |
|
|
int NAME ## gt = 0.1 ## POSTFIX > 0.2 ## POSTFIX; \
|
56 |
|
|
int NAME ## u_gt = 0.1u ## POSTFIX > 0.2u ## POSTFIX; \
|
57 |
|
|
int NAME ## ge = 0.1 ## POSTFIX >= 0.2 ## POSTFIX; \
|
58 |
|
|
int NAME ## u_ge = 0.1u ## POSTFIX >= 0.2 ## POSTFIX; \
|
59 |
|
|
int NAME ## lt = 0.1 ## POSTFIX < 0.2 ## POSTFIX; \
|
60 |
|
|
int NAME ## u_lt = 0.1u ## POSTFIX < 0.2 ## POSTFIX; \
|
61 |
|
|
int NAME ## le = 0.1 ## POSTFIX <= 0.2 ## POSTFIX; \
|
62 |
|
|
int NAME ## u_le = 0.1u ## POSTFIX <= 0.2 ## POSTFIX; \
|
63 |
|
|
int NAME ## ne2 = 0.2 ## POSTFIX != 0.2 ## POSTFIX; \
|
64 |
|
|
int NAME ## u_ne2 = 0.2u ## POSTFIX != 0.2u ## POSTFIX; \
|
65 |
|
|
int NAME ## eq2 = 0.2 ## POSTFIX == 0.2 ## POSTFIX; \
|
66 |
|
|
int NAME ## u_eq2 = 0.2u ## POSTFIX == 0.2u ## POSTFIX; \
|
67 |
|
|
int NAME ## gt2 = 0.2 ## POSTFIX > 0.2 ## POSTFIX; \
|
68 |
|
|
int NAME ## u_gt2 = 0.2u ## POSTFIX > 0.2u ## POSTFIX; \
|
69 |
|
|
int NAME ## ge2 = 0.2 ## POSTFIX >= 0.2 ## POSTFIX; \
|
70 |
|
|
int NAME ## u_ge2 = 0.2u ## POSTFIX >= 0.2 ## POSTFIX; \
|
71 |
|
|
int NAME ## lt2 = 0.2 ## POSTFIX < 0.2 ## POSTFIX; \
|
72 |
|
|
int NAME ## u_lt2 = 0.2u ## POSTFIX < 0.2 ## POSTFIX; \
|
73 |
|
|
int NAME ## le2 = 0.2 ## POSTFIX <= 0.2 ## POSTFIX; \
|
74 |
|
|
int NAME ## u_le2 = 0.2u ## POSTFIX <= 0.2 ## POSTFIX; \
|
75 |
|
|
TYPE NAME ## hr_signed = 0.1hr; \
|
76 |
|
|
unsigned TYPE NAME ## hr_unsigned = 0.1hr; \
|
77 |
|
|
_Sat TYPE NAME ## hr_sat_signed = 0.1hr; \
|
78 |
|
|
_Sat unsigned TYPE NAME ## hr_sat_unsigned = 0.1hr; \
|
79 |
|
|
TYPE NAME ## r_signed = 0.1r; \
|
80 |
|
|
unsigned TYPE NAME ## r_unsigned = 0.1r; \
|
81 |
|
|
_Sat TYPE NAME ## r_sat_signed = 0.1r; \
|
82 |
|
|
_Sat unsigned TYPE NAME ## r_sat_unsigned = 0.1r; \
|
83 |
|
|
TYPE NAME ## lr_signed = 0.1lr; \
|
84 |
|
|
unsigned TYPE NAME ## lr_unsigned = 0.1lr; \
|
85 |
|
|
_Sat TYPE NAME ## lr_sat_signed = 0.1lr; \
|
86 |
|
|
_Sat unsigned TYPE NAME ## lr_sat_unsigned = 0.1lr; \
|
87 |
|
|
TYPE NAME ## llr_signed = 0.1llr; \
|
88 |
|
|
unsigned TYPE NAME ## llr_unsigned = 0.1llr; \
|
89 |
|
|
_Sat TYPE NAME ## llr_sat_signed = 0.1llr; \
|
90 |
|
|
_Sat unsigned TYPE NAME ## llr_sat_unsigned = 0.1llr; \
|
91 |
|
|
TYPE NAME ## uhr_signed = 0.1uhr; \
|
92 |
|
|
unsigned TYPE NAME ## uhr_unsigned = 0.1uhr; \
|
93 |
|
|
_Sat TYPE NAME ## uhr_sat_signed = 0.1uhr; \
|
94 |
|
|
_Sat unsigned TYPE NAME ## uhr_sat_unsigned = 0.1uhr; \
|
95 |
|
|
TYPE NAME ## ur_signed = 0.1ur; \
|
96 |
|
|
unsigned TYPE NAME ## ur_unsigned = 0.1ur; \
|
97 |
|
|
_Sat TYPE NAME ## ur_sat_signed = 0.1ur; \
|
98 |
|
|
_Sat unsigned TYPE NAME ## ur_sat_unsigned = 0.1ur; \
|
99 |
|
|
TYPE NAME ## ulr_signed = 0.1ulr; \
|
100 |
|
|
unsigned TYPE NAME ## ulr_unsigned = 0.1ulr; \
|
101 |
|
|
_Sat TYPE NAME ## ulr_sat_signed = 0.1ulr; \
|
102 |
|
|
_Sat unsigned TYPE NAME ## ulr_sat_unsigned = 0.1ulr; \
|
103 |
|
|
TYPE NAME ## ullr_signed = 0.1ullr; \
|
104 |
|
|
unsigned TYPE NAME ## ullr_unsigned = 0.1ullr; \
|
105 |
|
|
_Sat TYPE NAME ## ullr_sat_signed = 0.1ullr; \
|
106 |
|
|
_Sat unsigned TYPE NAME ## ullr_sat_unsigned = 0.1ullr; \
|
107 |
|
|
TYPE NAME ## hk_signed = 0.1hk; \
|
108 |
|
|
unsigned TYPE NAME ## hk_unsigned = 0.1hk; \
|
109 |
|
|
_Sat TYPE NAME ## hk_sat_signed = 5.1hk; \
|
110 |
|
|
_Sat unsigned TYPE NAME ## hk_sat_unsigned = 5.1hk; \
|
111 |
|
|
TYPE NAME ## k_signed = 0.1k; \
|
112 |
|
|
unsigned TYPE NAME ## k_unsigned = 0.1k; \
|
113 |
|
|
_Sat TYPE NAME ## k_sat_signed = 5.1k; \
|
114 |
|
|
_Sat unsigned TYPE NAME ## k_sat_unsigned = 5.1k; \
|
115 |
|
|
TYPE NAME ## lk_signed = 0.1lk; \
|
116 |
|
|
unsigned TYPE NAME ## lk_unsigned = 0.1lk; \
|
117 |
|
|
_Sat TYPE NAME ## lk_sat_signed = 5.1lk; \
|
118 |
|
|
_Sat unsigned TYPE NAME ## lk_sat_unsigned = 5.1lk; \
|
119 |
|
|
TYPE NAME ## llk_signed = 0.1llk; \
|
120 |
|
|
unsigned TYPE NAME ## llk_unsigned = 0.1llk; \
|
121 |
|
|
_Sat TYPE NAME ## llk_sat_signed = 5.1llk; \
|
122 |
|
|
_Sat unsigned TYPE NAME ## llk_sat_unsigned = 5.1llk; \
|
123 |
|
|
TYPE NAME ## uhk_signed = 0.1uhk; \
|
124 |
|
|
unsigned TYPE NAME ## uhk_unsigned = 0.1uhk; \
|
125 |
|
|
_Sat TYPE NAME ## uhk_sat_signed = 5.1uhk; \
|
126 |
|
|
_Sat unsigned TYPE NAME ## uhk_sat_unsigned = 5.1uhk; \
|
127 |
|
|
TYPE NAME ## uk_signed = 0.1uk; \
|
128 |
|
|
unsigned TYPE NAME ## uk_unsigned = 0.1uk; \
|
129 |
|
|
_Sat TYPE NAME ## uk_sat_signed = 5.1uk; \
|
130 |
|
|
_Sat unsigned TYPE NAME ## uk_sat_unsigned = 5.1uk; \
|
131 |
|
|
TYPE NAME ## ulk_signed = 0.1ulk; \
|
132 |
|
|
unsigned TYPE NAME ## ulk_unsigned = 0.1ulk; \
|
133 |
|
|
_Sat TYPE NAME ## ulk_sat_signed = 5.1ulk; \
|
134 |
|
|
_Sat unsigned TYPE NAME ## ulk_sat_unsigned = 5.1ulk; \
|
135 |
|
|
TYPE NAME ## ullk_signed = 0.1ullk; \
|
136 |
|
|
unsigned TYPE NAME ## ullk_unsigned = 0.1ullk; \
|
137 |
|
|
_Sat TYPE NAME ## ullk_sat_signed = 5.1ullk; \
|
138 |
|
|
_Sat unsigned TYPE NAME ## ullk_sat_unsigned = 5.1ullk; \
|
139 |
|
|
|
140 |
|
|
ALLOPCONST(short _Fract, sf, hr);
|
141 |
|
|
ALLOPCONST(_Fract, f, r);
|
142 |
|
|
ALLOPCONST(long _Fract, lf, lr);
|
143 |
|
|
ALLOPCONST(long long _Fract, llf, llr);
|
144 |
|
|
ALLOPCONST(short _Accum, sa, hk);
|
145 |
|
|
ALLOPCONST(_Accum, a, k);
|
146 |
|
|
ALLOPCONST(long _Accum, la, lk);
|
147 |
|
|
ALLOPCONST(long long _Accum, lla, llk);
|