PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / vrp88.c
blobf70b3119432a5a25e768ffef9e5a688038d1bac4
1 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-vrp1-details" } */
6 typedef const struct bitmap_head_def *const_bitmap;
7 typedef unsigned long BITMAP_WORD;
8 typedef struct bitmap_element_def {
9 struct bitmap_element_def *next;
10 BITMAP_WORD bits[((128 + (8 * 8 * 1u) - 1) / (8 * 8 * 1u))];
11 } bitmap_element;
12 typedef struct bitmap_head_def {
13 bitmap_element *first;
14 } bitmap_head;
15 unsigned char
16 bitmap_single_bit_set_p (const_bitmap a)
18 unsigned long count = 0;
19 const bitmap_element *elt;
20 unsigned ix;
21 if ((!(a)->first))
22 return 0;
23 elt = a->first;
24 if (elt->next != ((void *)0))
25 return 0;
26 for (ix = 0; ix != ((128 + (8 * 8 * 1u) - 1) / (8 * 8 * 1u)); ix++)
28 count += __builtin_popcountl (elt->bits[ix]);
29 if (count > 1)
30 return 0;
32 return count == 1;
35 /* Verify that VRP simplified an "if" statement. */
36 /* { dg-final { scan-tree-dump "Folded into: if.*" "vrp1"} } */