aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/ctz-ch.c
blob: 5d725979971bf18a26992b98a11a622bfee152a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-optimized" } */

typedef unsigned long BITMAP_WORD;

bool
bmp_iter_set (BITMAP_WORD bits, unsigned *bit_no)
{
  /* If our current word is nonzero, it contains the bit we want.  */
  if (bits)
    {
      while (!(bits & 1))
	{
	  bits >>= 1;
	  *bit_no += 1;
	}
      return true;
    }

  return false;
}

/* { dg-final { scan-tree-dump-times "__builtin_ctz|\\.CTZ" 1 "optimized" } } */