Debian Codegraph @

gcc/testsuite/gcc.dg/torture/bitint-43.c

raw
1 /* PR c/111309 */
2 /* { dg-do run { target bitint } } */
3 /* { dg-options "-std=c23 -pedantic-errors" } */
4 /* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
5 /* { dg-skip-if "" { ! run_expensive_tests } { "-flto" } { "" } } */
6
7 #if __BITINT_MAXWIDTH__ >= 156
8 __attribute__((noipa)) int
9 clz156 (unsigned _BitInt(156) x)
10 {
11 return __builtin_clzg (x);
12 }
13
14 __attribute__((noipa)) int
15 clzd156 (unsigned _BitInt(156) x)
16 {
17 return __builtin_clzg (x, __builtin_popcountg ((typeof (x)) ~(typeof (x)) 0));
18 }
19
20 __attribute__((noipa)) int
21 clzD156 (unsigned _BitInt(156) x, int y)
22 {
23 return __builtin_clzg (x, y);
24 }
25
26 __attribute__((noipa)) int
27 ctz156 (unsigned _BitInt(156) x)
28 {
29 return __builtin_ctzg (x);
30 }
31
32 __attribute__((noipa)) int
33 ctzd156 (unsigned _BitInt(156) x)
34 {
35 return __builtin_ctzg (x, __builtin_popcountg ((typeof (x)) ~(typeof (x)) 0));
36 }
37
38 __attribute__((noipa)) int
39 ctzD156 (unsigned _BitInt(156) x, int y)
40 {
41 return __builtin_ctzg (x, y);
42 }
43
44 __attribute__((noipa)) int
45 clrsb156 (_BitInt(156) x)
46 {
47 return __builtin_clrsbg (x);
48 }
49
50 __attribute__((noipa)) int
51 ffs156 (_BitInt(156) x)
52 {
53 return __builtin_ffsg (x);
54 }
55
56 __attribute__((noipa)) int
57 parity156 (unsigned _BitInt(156) x)
58 {
59 return __builtin_parityg (x);
60 }
61
62 __attribute__((noipa)) int
63 popcount156 (unsigned _BitInt(156) x)
64 {
65 return __builtin_popcountg (x);
66 }
67 #endif
68
69 #if __BITINT_MAXWIDTH__ >= 192
70 __attribute__((noipa)) int
71 clz192 (unsigned _BitInt(192) x)
72 {
73 return __builtin_clzg (x);
74 }
75
76 __attribute__((noipa)) int
77 clzd192 (unsigned _BitInt(192) x)
78 {
79 return __builtin_clzg (x, __builtin_popcountg ((typeof (x)) ~(typeof (x)) 0));
80 }
81
82 __attribute__((noipa)) int
83 clzD192 (unsigned _BitInt(192) x, int y)
84 {
85 return __builtin_clzg (x, y);
86 }
87
88 __attribute__((noipa)) int
89 ctz192 (unsigned _BitInt(192) x)
90 {
91 return __builtin_ctzg (x);
92 }
93
94 __attribute__((noipa)) int
95 ctzd192 (unsigned _BitInt(192) x)
96 {
97 return __builtin_ctzg (x, __builtin_popcountg ((typeof (x)) ~(typeof (x)) 0));
98 }
99
100 __attribute__((noipa)) int
101 ctzD192 (unsigned _BitInt(192) x, int y)
102 {
103 return __builtin_ctzg (x, y);
104 }
105
106 __attribute__((noipa)) int
107 clrsb192 (_BitInt(192) x)
108 {
109 return __builtin_clrsbg (x);
110 }
111
112 __attribute__((noipa)) int
113 ffs192 (_BitInt(192) x)
114 {
115 return __builtin_ffsg (x);
116 }
117
118 __attribute__((noipa)) int
119 parity192 (unsigned _BitInt(192) x)
120 {
121 return __builtin_parityg (x);
122 }
123
124 __attribute__((noipa)) int
125 popcount192 (unsigned _BitInt(192) x)
126 {
127 return __builtin_popcountg (x);
128 }
129 #endif
130
131 int
132 main ()
133 {
134 #if __BITINT_MAXWIDTH__ >= 156
135 if (clzd156 (0) != 156
136 || clzD156 (0, -1) != -1
137 || ctzd156 (0) != 156
138 || ctzD156 (0, 42) != 42
139 || clrsb156 (0) != 156 - 1
140 || ffs156 (0) != 0
141 || parity156 (0) != 0
142 || popcount156 (0) != 0
143 || __builtin_clzg ((unsigned _BitInt(156)) 0, 156 + 32) != 156 + 32
144 || __builtin_ctzg ((unsigned _BitInt(156)) 0, 156) != 156
145 || __builtin_clrsbg ((_BitInt(156)) 0) != 156 - 1
146 || __builtin_ffsg ((_BitInt(156)) 0) != 0
147 || __builtin_parityg ((unsigned _BitInt(156)) 0) != 0
148 || __builtin_popcountg ((unsigned _BitInt(156)) 0) != 0)
149 __builtin_abort ();
150 if (clz156 (-1) != 0
151 || clzd156 (-1) != 0
152 || clzD156 (-1, 0) != 0
153 || ctz156 (-1) != 0
154 || ctzd156 (-1) != 0
155 || ctzD156 (-1, 17) != 0
156 || clrsb156 (-1) != 156 - 1
157 || ffs156 (-1) != 1
158 || parity156 (-1) != 0
159 || popcount156 (-1) != 156
160 || __builtin_clzg ((unsigned _BitInt(156)) -1) != 0
161 || __builtin_clzg ((unsigned _BitInt(156)) -1, 156 + 32) != 0
162 || __builtin_ctzg ((unsigned _BitInt(156)) -1) != 0
163 || __builtin_ctzg ((unsigned _BitInt(156)) -1, 156) != 0
164 || __builtin_clrsbg ((_BitInt(156)) -1) != 156 - 1
165 || __builtin_ffsg ((_BitInt(156)) -1) != 1
166 || __builtin_parityg ((unsigned _BitInt(156)) -1) != 0
167 || __builtin_popcountg ((unsigned _BitInt(156)) -1) != 156)
168 __builtin_abort ();
169 if (clz156 (((unsigned _BitInt(156)) -1) >> 24) != 24
170 || clz156 (((unsigned _BitInt(156)) -1) >> 79) != 79
171 || clz156 (1) != 156 - 1
172 || clzd156 (((unsigned _BitInt(156)) -1) >> 139) != 139
173 || clzd156 (2) != 156 - 2
174 || ctz156 (((unsigned _BitInt(156)) -1) << 42) != 42
175 || ctz156 (((unsigned _BitInt(156)) -1) << 57) != 57
176 || ctz156 (0x4000000000000000000000uwb) != 86
177 || ctzd156 (((unsigned _BitInt(156)) -1) << 149) != 149
178 || ctzd156 (2) != 1
179 || clrsb156 ((unsigned _BitInt(156 - 4)) -1) != 3
180 || clrsb156 ((unsigned _BitInt(156 - 28)) -1) != 27
181 || clrsb156 ((unsigned _BitInt(156 - 29)) -1) != 28
182 || clrsb156 (~(unsigned _BitInt(156)) (unsigned _BitInt(156 - 68)) -1) != 67
183 || clrsb156 (~(unsigned _BitInt(156)) (unsigned _BitInt(156 - 92)) -1) != 91
184 || clrsb156 (~(unsigned _BitInt(156)) (unsigned _BitInt(156 - 93)) -1) != 92
185 || ffs156 (((unsigned _BitInt(156)) -1) << 42) != 43
186 || ffs156 (((unsigned _BitInt(156)) -1) << 57) != 58
187 || ffs156 (0x4000000000000000000000uwb) != 87
188 || ffs156 (((unsigned _BitInt(156)) -1) << 149) != 150
189 || ffs156 (2) != 2
190 || __builtin_clzg (((unsigned _BitInt(156)) -1) >> 24) != 24
191 || __builtin_clzg (((unsigned _BitInt(156)) -1) >> 79) != 79
192 || __builtin_clzg ((unsigned _BitInt(156)) 1) != 156 - 1
193 || __builtin_clzg (((unsigned _BitInt(156)) -1) >> 139, 156) != 139
194 || __builtin_clzg ((unsigned _BitInt(156)) 2, 156) != 156 - 2
195 || __builtin_ctzg (((unsigned _BitInt(156)) -1) << 42) != 42
196 || __builtin_ctzg (((unsigned _BitInt(156)) -1) << 57) != 57
197 || __builtin_ctzg ((unsigned _BitInt(156)) 0x4000000000000000000000uwb) != 86
198 || __builtin_ctzg (((unsigned _BitInt(156)) -1) << 149, 156) != 149
199 || __builtin_ctzg ((unsigned _BitInt(156)) 2, 156) != 1
200 || __builtin_clrsbg ((_BitInt(156)) (unsigned _BitInt(156 - 4)) -1) != 3
201 || __builtin_clrsbg ((_BitInt(156)) (unsigned _BitInt(156 - 28)) -1) != 27
202 || __builtin_clrsbg ((_BitInt(156)) (unsigned _BitInt(156 - 29)) -1) != 28
203 || __builtin_clrsbg ((_BitInt(156)) ~(unsigned _BitInt(156)) (unsigned _BitInt(156 - 68)) -1) != 67
204 || __builtin_clrsbg ((_BitInt(156)) ~(unsigned _BitInt(156)) (unsigned _BitInt(156 - 92)) -1) != 91
205 || __builtin_clrsbg ((_BitInt(156)) ~(unsigned _BitInt(156)) (unsigned _BitInt(156 - 93)) -1) != 92
206 || __builtin_ffsg ((_BitInt(156)) (((unsigned _BitInt(156)) -1) << 42)) != 43
207 || __builtin_ffsg ((_BitInt(156)) (((unsigned _BitInt(156)) -1) << 57)) != 58
208 || __builtin_ffsg ((_BitInt(156)) 0x4000000000000000000000uwb) != 87
209 || __builtin_ffsg ((_BitInt(156)) (((unsigned _BitInt(156)) -1) << 149)) != 150
210 || __builtin_ffsg ((_BitInt(156)) 2) != 2)
211 __builtin_abort ();
212 if (parity156 (23008250258685373142923325827291949461178444434uwb) != __builtin_parityg (23008250258685373142923325827291949461178444434uwb)
213 || parity156 (41771568792516301628132437740665810252917251244uwb) != __builtin_parityg (41771568792516301628132437740665810252917251244uwb)
214 || parity156 (5107402473866766219120283991834936835726115452uwb) != __builtin_parityg (5107402473866766219120283991834936835726115452uwb)
215 || popcount156 (50353291748276374580944955711958129678996395562uwb) != __builtin_popcountg (50353291748276374580944955711958129678996395562uwb)
216 || popcount156 (29091263616891212550063067166307725491211684496uwb) != __builtin_popcountg (29091263616891212550063067166307725491211684496uwb)
217 || popcount156 (64973284306583205619384799873110935608793072026uwb) != __builtin_popcountg (64973284306583205619384799873110935608793072026uwb))
218 __builtin_abort ();
219 #endif
220 #if __BITINT_MAXWIDTH__ >= 192
221 if (clzd192 (0) != 192
222 || clzD192 (0, 42) != 42
223 || ctzd192 (0) != 192
224 || ctzD192 (0, -1) != -1
225 || clrsb192 (0) != 192 - 1
226 || ffs192 (0) != 0
227 || parity192 (0) != 0
228 || popcount192 (0) != 0
229 || __builtin_clzg ((unsigned _BitInt(192)) 0, 192 + 32) != 192 + 32
230 || __builtin_ctzg ((unsigned _BitInt(192)) 0, 192) != 192
231 || __builtin_clrsbg ((_BitInt(192)) 0) != 192 - 1
232 || __builtin_ffsg ((_BitInt(192)) 0) != 0
233 || __builtin_parityg ((unsigned _BitInt(192)) 0) != 0
234 || __builtin_popcountg ((unsigned _BitInt(192)) 0) != 0)
235 __builtin_abort ();
236 if (clz192 (-1) != 0
237 || clzd192 (-1) != 0
238 || clzD192 (-1, 15) != 0
239 || ctz192 (-1) != 0
240 || ctzd192 (-1) != 0
241 || ctzD192 (-1, -57) != 0
242 || clrsb192 (-1) != 192 - 1
243 || ffs192 (-1) != 1
244 || parity192 (-1) != 0
245 || popcount192 (-1) != 192
246 || __builtin_clzg ((unsigned _BitInt(192)) -1) != 0
247 || __builtin_clzg ((unsigned _BitInt(192)) -1, 192 + 32) != 0
248 || __builtin_ctzg ((unsigned _BitInt(192)) -1) != 0
249 || __builtin_ctzg ((unsigned _BitInt(192)) -1, 192) != 0
250 || __builtin_clrsbg ((_BitInt(192)) -1) != 192 - 1
251 || __builtin_ffsg ((_BitInt(192)) -1) != 1
252 || __builtin_parityg ((unsigned _BitInt(192)) -1) != 0
253 || __builtin_popcountg ((unsigned _BitInt(192)) -1) != 192)
254 __builtin_abort ();
255 if (clz192 (((unsigned _BitInt(192)) -1) >> 24) != 24
256 || clz192 (((unsigned _BitInt(192)) -1) >> 79) != 79
257 || clz192 (1) != 192 - 1
258 || clzd192 (((unsigned _BitInt(192)) -1) >> 139) != 139
259 || clzd192 (2) != 192 - 2
260 || ctz192 (((unsigned _BitInt(192)) -1) << 42) != 42
261 || ctz192 (((unsigned _BitInt(192)) -1) << 57) != 57
262 || ctz192 (0x4000000000000000000000uwb) != 86
263 || ctzd192 (((unsigned _BitInt(192)) -1) << 149) != 149
264 || ctzd192 (2) != 1
265 || clrsb192 ((unsigned _BitInt(192 - 4)) -1) != 3
266 || clrsb192 ((unsigned _BitInt(192 - 28)) -1) != 27
267 || clrsb192 ((unsigned _BitInt(192 - 29)) -1) != 28
268 || clrsb192 (~(unsigned _BitInt(192)) (unsigned _BitInt(192 - 68)) -1) != 67
269 || clrsb192 (~(unsigned _BitInt(192)) (unsigned _BitInt(192 - 92)) -1) != 91
270 || clrsb192 (~(unsigned _BitInt(192)) (unsigned _BitInt(192 - 93)) -1) != 92
271 || ffs192 (((unsigned _BitInt(192)) -1) << 42) != 43
272 || ffs192 (((unsigned _BitInt(192)) -1) << 57) != 58
273 || ffs192 (0x4000000000000000000000uwb) != 87
274 || ffs192 (((unsigned _BitInt(192)) -1) << 149) != 150
275 || ffs192 (2) != 2
276 || __builtin_clzg (((unsigned _BitInt(192)) -1) >> 24) != 24
277 || __builtin_clzg (((unsigned _BitInt(192)) -1) >> 79) != 79
278 || __builtin_clzg ((unsigned _BitInt(192)) 1) != 192 - 1
279 || __builtin_clzg (((unsigned _BitInt(192)) -1) >> 139, 192) != 139
280 || __builtin_clzg ((unsigned _BitInt(192)) 2, 192) != 192 - 2
281 || __builtin_ctzg (((unsigned _BitInt(192)) -1) << 42) != 42
282 || __builtin_ctzg (((unsigned _BitInt(192)) -1) << 57) != 57
283 || __builtin_ctzg ((unsigned _BitInt(192)) 0x4000000000000000000000uwb) != 86
284 || __builtin_ctzg (((unsigned _BitInt(192)) -1) << 149, 192) != 149
285 || __builtin_ctzg ((unsigned _BitInt(192)) 2, 192) != 1
286 || __builtin_clrsbg ((_BitInt(192)) (unsigned _BitInt(192 - 4)) -1) != 3
287 || __builtin_clrsbg ((_BitInt(192)) (unsigned _BitInt(192 - 28)) -1) != 27
288 || __builtin_clrsbg ((_BitInt(192)) (unsigned _BitInt(192 - 29)) -1) != 28
289 || __builtin_clrsbg ((_BitInt(192)) ~(unsigned _BitInt(192)) (unsigned _BitInt(192 - 68)) -1) != 67
290 || __builtin_clrsbg ((_BitInt(192)) ~(unsigned _BitInt(192)) (unsigned _BitInt(192 - 92)) -1) != 91
291 || __builtin_clrsbg ((_BitInt(192)) ~(unsigned _BitInt(192)) (unsigned _BitInt(192 - 93)) -1) != 92
292 || __builtin_ffsg ((_BitInt(192)) (((unsigned _BitInt(192)) -1) << 42)) != 43
293 || __builtin_ffsg ((_BitInt(192)) (((unsigned _BitInt(192)) -1) << 57)) != 58
294 || __builtin_ffsg ((_BitInt(192)) 0x4000000000000000000000uwb) != 87
295 || __builtin_ffsg ((_BitInt(192)) (((unsigned _BitInt(192)) -1) << 149)) != 150
296 || __builtin_ffsg ((_BitInt(192)) 2) != 2)
297 __builtin_abort ();
298 if (parity192 (4692147078159863499615754634965484598760535154638668598762uwb) != __builtin_parityg (4692147078159863499615754634965484598760535154638668598762uwb)
299 || parity192 (1669461228546917627909935444501097256112222796898845183538uwb) != __builtin_parityg (1669461228546917627909935444501097256112222796898845183538uwb)
300 || parity192 (5107402473866766219120283991834936835726115452uwb) != __builtin_parityg (5107402473866766219120283991834936835726115452uwb)
301 || popcount192 (4033871057575185619108386380181511734118888391160164588976uwb) != __builtin_popcountg (4033871057575185619108386380181511734118888391160164588976uwb)
302 || popcount192 (58124766715713711628758119849579188845074973856704521119uwb) != __builtin_popcountg (58124766715713711628758119849579188845074973856704521119uwb)
303 || popcount192 (289948065236269174335700831610076764076947650072787325852uwb) != __builtin_popcountg (289948065236269174335700831610076764076947650072787325852uwb))
304 __builtin_abort ();
305 #endif
306 }