3 /* { dg-options "-O2" } */
5 __attribute__((noipa
)) int
8 return __builtin_clzg (x
);
11 __attribute__((noipa
)) int
12 clzc2 (unsigned char x
, int y
)
14 return __builtin_clzg (x
, y
);
17 __attribute__((noipa
)) int
18 clzs (unsigned short x
)
20 return __builtin_clzg (x
);
23 __attribute__((noipa
)) int
24 clzs2 (unsigned short x
)
26 return __builtin_clzg (x
, -2);
29 __attribute__((noipa
)) int
32 return __builtin_clzg (x
);
35 __attribute__((noipa
)) int
36 clzi2 (unsigned int x
, int y
)
38 return __builtin_clzg (x
, y
);
41 __attribute__((noipa
)) int
42 clzl (unsigned long x
)
44 return __builtin_clzg (x
);
47 __attribute__((noipa
)) int
48 clzl2 (unsigned long x
)
50 return __builtin_clzg (x
, -1);
53 __attribute__((noipa
)) int
54 clzL (unsigned long long x
)
56 return __builtin_clzg (x
);
59 __attribute__((noipa
)) int
60 clzL2 (unsigned long long x
, int y
)
62 return __builtin_clzg (x
, y
);
65 #ifdef __SIZEOF_INT128__
66 __attribute__((noipa
)) int
67 clzI (unsigned __int128 x
)
69 return __builtin_clzg (x
);
72 __attribute__((noipa
)) int
73 clzI2 (unsigned __int128 x
, int y
)
75 return __builtin_clzg (x
, y
);
79 __attribute__((noipa
)) int
80 ctzc (unsigned char x
)
82 return __builtin_ctzg (x
);
85 __attribute__((noipa
)) int
86 ctzc2 (unsigned char x
, int y
)
88 return __builtin_ctzg (x
, y
);
91 __attribute__((noipa
)) int
92 ctzs (unsigned short x
)
94 return __builtin_ctzg (x
);
97 __attribute__((noipa
)) int
98 ctzs2 (unsigned short x
, int y
)
100 return __builtin_ctzg (x
, y
);
103 __attribute__((noipa
)) int
104 ctzi (unsigned int x
)
106 return __builtin_ctzg (x
);
109 __attribute__((noipa
)) int
110 ctzi2 (unsigned int x
, int y
)
112 return __builtin_ctzg (x
, y
);
115 __attribute__((noipa
)) int
116 ctzl (unsigned long x
)
118 return __builtin_ctzg (x
);
121 __attribute__((noipa
)) int
122 ctzl2 (unsigned long x
, int y
)
124 return __builtin_ctzg (x
, y
);
127 __attribute__((noipa
)) int
128 ctzL (unsigned long long x
)
130 return __builtin_ctzg (x
);
133 __attribute__((noipa
)) int
134 ctzL2 (unsigned long long x
, int y
)
136 return __builtin_ctzg (x
, y
);
139 #ifdef __SIZEOF_INT128__
140 __attribute__((noipa
)) int
141 ctzI (unsigned __int128 x
)
143 return __builtin_ctzg (x
);
146 __attribute__((noipa
)) int
147 ctzI2 (unsigned __int128 x
)
149 return __builtin_ctzg (x
, __SIZEOF_INT128__
* __CHAR_BIT__
);
153 __attribute__((noipa
)) int
154 clrsbc (signed char x
)
156 return __builtin_clrsbg (x
);
159 __attribute__((noipa
)) int
160 clrsbs (signed short x
)
162 return __builtin_clrsbg (x
);
165 __attribute__((noipa
)) int
166 clrsbi (signed int x
)
168 return __builtin_clrsbg (x
);
171 __attribute__((noipa
)) int
172 clrsbl (signed long x
)
174 return __builtin_clrsbg (x
);
177 __attribute__((noipa
)) int
178 clrsbL (signed long long x
)
180 return __builtin_clrsbg (x
);
183 #ifdef __SIZEOF_INT128__
184 __attribute__((noipa
)) int
185 clrsbI (signed __int128 x
)
187 return __builtin_clrsbg (x
);
191 __attribute__((noipa
)) int
194 return __builtin_ffsg (x
);
197 __attribute__((noipa
)) int
198 ffss (signed short x
)
200 return __builtin_ffsg (x
);
203 __attribute__((noipa
)) int
206 return __builtin_ffsg (x
);
209 __attribute__((noipa
)) int
212 return __builtin_ffsg (x
);
215 __attribute__((noipa
)) int
216 ffsL (signed long long x
)
218 return __builtin_ffsg (x
);
221 #ifdef __SIZEOF_INT128__
222 __attribute__((noipa
)) int
223 ffsI (signed __int128 x
)
225 return __builtin_ffsg (x
);
229 __attribute__((noipa
)) int
230 parityc (unsigned char x
)
232 return __builtin_parityg (x
);
235 __attribute__((noipa
)) int
236 paritys (unsigned short x
)
238 return __builtin_parityg (x
);
241 __attribute__((noipa
)) int
242 parityi (unsigned int x
)
244 return __builtin_parityg (x
);
247 __attribute__((noipa
)) int
248 parityl (unsigned long x
)
250 return __builtin_parityg (x
);
253 __attribute__((noipa
)) int
254 parityL (unsigned long long x
)
256 return __builtin_parityg (x
);
259 #ifdef __SIZEOF_INT128__
260 __attribute__((noipa
)) int
261 parityI (unsigned __int128 x
)
263 return __builtin_parityg (x
);
267 __attribute__((noipa
)) int
268 popcountc (unsigned char x
)
270 return __builtin_popcountg (x
);
273 __attribute__((noipa
)) int
274 popcounts (unsigned short x
)
276 return __builtin_popcountg (x
);
279 __attribute__((noipa
)) int
280 popcounti (unsigned int x
)
282 return __builtin_popcountg (x
);
285 __attribute__((noipa
)) int
286 popcountl (unsigned long x
)
288 return __builtin_popcountg (x
);
291 __attribute__((noipa
)) int
292 popcountL (unsigned long long x
)
294 return __builtin_popcountg (x
);
297 #ifdef __SIZEOF_INT128__
298 __attribute__((noipa
)) int
299 popcountI (unsigned __int128 x
)
301 return __builtin_popcountg (x
);
308 if (__builtin_clzg ((unsigned char) 1) != __CHAR_BIT__
- 1
309 || __builtin_clzg ((unsigned short) 2, -2) != __SIZEOF_SHORT__
* __CHAR_BIT__
- 2
310 || __builtin_clzg (0U, 42) != 42
311 || __builtin_clzg (0U, -1) != -1
312 || __builtin_clzg (1U) != __SIZEOF_INT__
* __CHAR_BIT__
- 1
313 || __builtin_clzg (2UL, -1) != __SIZEOF_LONG__
* __CHAR_BIT__
- 2
314 || __builtin_clzg (5ULL) != __SIZEOF_LONG_LONG__
* __CHAR_BIT__
- 3
315 #ifdef __SIZEOF_INT128__
316 || __builtin_clzg ((unsigned __int128
) 9) != __SIZEOF_INT128__
* __CHAR_BIT__
- 4
318 || __builtin_clzg (~0U, -5) != 0
319 || __builtin_clzg (~0ULL >> 2) != 2
320 || __builtin_ctzg ((unsigned char) 1) != 0
321 || __builtin_ctzg ((unsigned short) 28) != 2
322 || __builtin_ctzg (0U, 32) != 32
323 || __builtin_ctzg (0U, -42) != -42
324 || __builtin_ctzg (1U) != 0
325 || __builtin_ctzg (16UL, -1) != 4
326 || __builtin_ctzg (5ULL << 52, 0) != 52
327 #ifdef __SIZEOF_INT128__
328 || __builtin_ctzg (((unsigned __int128
) 9) << 72) != 72
330 || __builtin_clrsbg ((signed char) 0) != __CHAR_BIT__
- 1
331 || __builtin_clrsbg ((signed short) -1) != __SIZEOF_SHORT__
* __CHAR_BIT__
- 1
332 || __builtin_clrsbg (0) != __SIZEOF_INT__
* __CHAR_BIT__
- 1
333 || __builtin_clrsbg (-1L) != __SIZEOF_LONG__
* __CHAR_BIT__
- 1
334 || __builtin_clrsbg (0LL) != __SIZEOF_LONG_LONG__
* __CHAR_BIT__
- 1
335 #ifdef __SIZEOF_INT128__
336 || __builtin_clrsbg ((__int128
) -1) != __SIZEOF_INT128__
* __CHAR_BIT__
- 1
338 || __builtin_clrsbg (0x1afb) != __SIZEOF_INT__
* __CHAR_BIT__
- 14
339 || __builtin_clrsbg (-2) != __SIZEOF_INT__
* __CHAR_BIT__
- 2
340 || __builtin_clrsbg (1L) != __SIZEOF_LONG__
* __CHAR_BIT__
- 2
341 || __builtin_clrsbg (-4LL) != __SIZEOF_LONG_LONG__
* __CHAR_BIT__
- 3
342 || __builtin_ffsg ((signed char) 0) != 0
343 || __builtin_ffsg ((signed short) 0) != 0
344 || __builtin_ffsg (0) != 0
345 || __builtin_ffsg (0L) != 0
346 || __builtin_ffsg (0LL) != 0
347 #ifdef __SIZEOF_INT128__
348 || __builtin_ffsg ((__int128
) 0) != 0
350 || __builtin_ffsg ((signed char) 4) != 3
351 || __builtin_ffsg ((signed short) 8) != 4
352 || __builtin_ffsg (1) != 1
353 || __builtin_ffsg (2L) != 2
354 || __builtin_ffsg (28LL) != 3
355 || __builtin_parityg ((unsigned char) 1) != 1
356 || __builtin_parityg ((unsigned short) 2) != 1
357 || __builtin_parityg (0U) != 0
358 || __builtin_parityg (3U) != 0
359 || __builtin_parityg (0UL) != 0
360 || __builtin_parityg (7UL) != 1
361 || __builtin_parityg (0ULL) != 0
362 #ifdef __SIZEOF_INT128__
363 || __builtin_parityg ((unsigned __int128
) 0) != 0
365 || __builtin_parityg ((unsigned char) ~0U) != 0
366 || __builtin_parityg ((unsigned short) ~0U) != 0
367 || __builtin_parityg (~0U) != 0
368 || __builtin_parityg (~0UL) != 0
369 || __builtin_parityg (~0ULL) != 0
370 #ifdef __SIZEOF_INT128__
371 || __builtin_parityg (~(unsigned __int128
) 0) != 0
373 || __builtin_popcountg (0U) != 0
374 || __builtin_popcountg (0UL) != 0
375 || __builtin_popcountg (0ULL) != 0
376 #ifdef __SIZEOF_INT128__
377 || __builtin_popcountg ((unsigned __int128
) 0) != 0
379 || __builtin_popcountg ((unsigned char) ~0U) != __CHAR_BIT__
380 || __builtin_popcountg ((unsigned short) ~0U) != __SIZEOF_SHORT__
* __CHAR_BIT__
381 || __builtin_popcountg (~0U) != __SIZEOF_INT__
* __CHAR_BIT__
382 || __builtin_popcountg (~0UL) != __SIZEOF_LONG__
* __CHAR_BIT__
383 || __builtin_popcountg (~0ULL) != __SIZEOF_LONG_LONG__
* __CHAR_BIT__
384 #ifdef __SIZEOF_INT128__
385 || __builtin_popcountg (~(unsigned __int128
) 0) != __SIZEOF_INT128__
* __CHAR_BIT__
389 if (clzc (1) != __CHAR_BIT__
- 1
390 || clzs2 (2) != __SIZEOF_SHORT__
* __CHAR_BIT__
- 2
391 || clzi2 (0U, 42) != 42
392 || clzi2 (0U, -1) != -1
393 || clzi (1U) != __SIZEOF_INT__
* __CHAR_BIT__
- 1
394 || clzl2 (2UL) != __SIZEOF_LONG__
* __CHAR_BIT__
- 2
395 || clzL (5ULL) != __SIZEOF_LONG_LONG__
* __CHAR_BIT__
- 3
396 #ifdef __SIZEOF_INT128__
397 || clzI ((unsigned __int128
) 9) != __SIZEOF_INT128__
* __CHAR_BIT__
- 4
399 || clzi2 (~0U, -5) != 0
400 || clzL (~0ULL >> 2) != 2
403 || ctzi2 (0U, 32) != 32
404 || ctzi2 (0U, -42) != -42
406 || ctzl2 (16UL, -1) != 4
407 || ctzL2 (5ULL << 52, 0) != 52
408 #ifdef __SIZEOF_INT128__
409 || ctzI (((unsigned __int128
) 9) << 72) != 72
411 || clrsbc (0) != __CHAR_BIT__
- 1
412 || clrsbs (-1) != __SIZEOF_SHORT__
* __CHAR_BIT__
- 1
413 || clrsbi (0) != __SIZEOF_INT__
* __CHAR_BIT__
- 1
414 || clrsbl (-1L) != __SIZEOF_LONG__
* __CHAR_BIT__
- 1
415 || clrsbL (0LL) != __SIZEOF_LONG_LONG__
* __CHAR_BIT__
- 1
416 #ifdef __SIZEOF_INT128__
417 || clrsbI (-1) != __SIZEOF_INT128__
* __CHAR_BIT__
- 1
419 || clrsbi (0x1afb) != __SIZEOF_INT__
* __CHAR_BIT__
- 14
420 || clrsbi (-2) != __SIZEOF_INT__
* __CHAR_BIT__
- 2
421 || clrsbl (1L) != __SIZEOF_LONG__
* __CHAR_BIT__
- 2
422 || clrsbL (-4LL) != __SIZEOF_LONG_LONG__
* __CHAR_BIT__
- 3
428 #ifdef __SIZEOF_INT128__
440 || parityl (0UL) != 0
441 || parityl (7UL) != 1
442 || parityL (0ULL) != 0
443 #ifdef __SIZEOF_INT128__
446 || parityc ((unsigned char) ~0U) != 0
447 || paritys ((unsigned short) ~0U) != 0
448 || parityi (~0U) != 0
449 || parityl (~0UL) != 0
450 || parityL (~0ULL) != 0
451 #ifdef __SIZEOF_INT128__
452 || parityI (~(unsigned __int128
) 0) != 0
454 || popcounti (0U) != 0
455 || popcountl (0UL) != 0
456 || popcountL (0ULL) != 0
457 #ifdef __SIZEOF_INT128__
458 || popcountI (0) != 0
460 || popcountc ((unsigned char) ~0U) != __CHAR_BIT__
461 || popcounts ((unsigned short) ~0U) != __SIZEOF_SHORT__
* __CHAR_BIT__
462 || popcounti (~0U) != __SIZEOF_INT__
* __CHAR_BIT__
463 || popcountl (~0UL) != __SIZEOF_LONG__
* __CHAR_BIT__
464 || popcountL (~0ULL) != __SIZEOF_LONG_LONG__
* __CHAR_BIT__
465 #ifdef __SIZEOF_INT128__
466 || popcountI (~(unsigned __int128
) 0) != __SIZEOF_INT128__
* __CHAR_BIT__