libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / clz-complement-long-long.c
blob7f7793f0efac1f0d793e6e99b84988e5cc5221c9
1 /* { dg-do run } */
2 /* { dg-require-effective-target clzll } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
5 #define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
7 int
8 __attribute__ ((noinline, noclone))
9 foo (unsigned long long b) {
10 int c = 0;
12 while (b) {
13 b >>= 1;
14 c++;
17 return c;
20 int main()
22 if (foo(0) != 0)
23 __builtin_abort ();
24 if (foo(5) != 3)
25 __builtin_abort ();
26 if (foo(1LL << (PREC - 1)) != PREC)
27 __builtin_abort ();
28 return 0;
31 /* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */