]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/tree-ssa/clz-char.c
Fix profile update in tree_transform_and_unroll_loop
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / clz-char.c
CommitLineData
4798080d
AC
1/* { dg-do run } */
2/* { dg-require-effective-target clzl } */
3/* { dg-options "-O2 -fno-tree-ch -fdump-tree-optimized" } */
4
5#define PREC (__CHAR_BIT__)
6
7int
8__attribute__ ((noinline, noclone))
9foo (unsigned char b) {
10 int c = 0;
11
12 if (b == 0)
13 return PREC;
14
15 while (!(b & (1 << (PREC - 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(1 << (PREC - 1)) != 0)
28 __builtin_abort ();
29 if (foo(35) != PREC - 6)
30 __builtin_abort ();
31 return 0;
32}
33
34/* { dg-final { scan-tree-dump-times "__builtin_clz|\\.CLZ" 1 "optimized" } } */