Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr78103-2.c

raw
1 /* PR target/78103 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -mno-lzcnt" } */
4 /* Cope with --enable-frame-pointer. */
5 /* { dg-additional-options "-fomit-frame-pointer" } */
6 /* { dg-final { scan-assembler-not {\mmovl\M} } } */
7 /* { dg-final { scan-assembler-not {\mxor[lq]\M} } } */
8 /* { dg-final { scan-assembler-not {\msubl\M} } } */
9 /* { dg-final { scan-assembler {\m(leal|addl|incl)\M} } } */
10
11 unsigned int
12 foo (unsigned int x)
13 {
14 return __CHAR_BIT__ * sizeof (unsigned int) - __builtin_clz (x);
15 }
16
17 unsigned int
18 bar (unsigned int x)
19 {
20 return __CHAR_BIT__ * sizeof (unsigned int) - 1 - __builtin_clz (x);
21 }
22
23 #ifdef __x86_64__
24 unsigned int
25 baz (unsigned long long x)
26 {
27 return __CHAR_BIT__ * sizeof (unsigned long long) - __builtin_clzll (x);
28 }
29
30 unsigned int
31 qux (unsigned long long x)
32 {
33 return __CHAR_BIT__ * sizeof (unsigned long long) - 1 - __builtin_clzll (x);
34 }
35 #endif