]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/tree-ssa/ctz-long-long.c
Fix profile update in tree_transform_and_unroll_loop
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ctz-long-long.c
CommitLineData
4798080d
AC
1/* { dg-do run } */
2/* { dg-require-effective-target ctzll } */
3/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
4
5#define PREC (__CHAR_BIT__ * __SIZEOF_LONG_LONG__)
6
7int
8__attribute__ ((noinline, noclone))
9foo (unsigned long long b) {
10 int c = 0;
11
12 if (b == 0)
13 return PREC;
14
15 while (!(b & 1)) {
16 b >>= 1;
17 c++;
18 }
19
20 return c;
21}
22
23int main()
24{
25 if (foo(0) != PREC)
26 __builtin_abort ();
27 if (foo(1LL << (PREC - 1)) != PREC - 1)
28 __builtin_abort ();
29 if (foo(96) != 5)
30 __builtin_abort ();
31 if (foo(35) != 0)
32 __builtin_abort ();
33 return 0;
34}
35
36/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */