| 1 |
/* { dg-do compile } */ |
| 2 |
|
| 3 |
/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ |
| 4 |
|
| 5 |
|
| 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) |
| 17 |
{ |
| 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++) |
| 27 |
{ |
| 28 |
count += __builtin_popcountl (elt->bits[ix]); |
| 29 |
if (count > 1) |
| 30 |
return 0; |
| 31 |
} |
| 32 |
return count == 1; |
| 33 |
} |
| 34 |
|
| 35 |
/* Verify that VRP simplified an "if" statement. */ |
| 36 |
/* { dg-final { scan-tree-dump "Folded into: if.*" "vrp1"} } */ |
| 37 |
|
| 38 |
|