1 /* Setting LOGICAL_OP_NON_SHORT_CIRCUIT to 0 leads to two conditional jumps
2    when evaluating an && condition.  */
3 /* { dg-do compile } */
4 /* { dg-options "-O2 -fdump-tree-fre1-details --param logical-op-non-short-circuit=1" } */
5 
6 struct bitmap_head_def;
7 typedef struct bitmap_head_def *bitmap;
8 typedef const struct bitmap_head_def *const_bitmap;
9 
10 
11 typedef unsigned long BITMAP_WORD;
12 typedef struct bitmap_element_def
13 {
14   struct bitmap_element_def *next;
15   unsigned int indx;
16   BITMAP_WORD bits[((128 + (8 * 8 * 1u) - 1) / (8 * 8 * 1u))];
17 } bitmap_element;
18 
19 
20 
21 
22 
23 
24 typedef struct bitmap_head_def
25 {
26   bitmap_element *first;
27 
28 } bitmap_head;
29 
30 
31 
32 static __inline__ unsigned char
bitmap_elt_ior(bitmap dst,bitmap_element * dst_elt,bitmap_element * dst_prev,const bitmap_element * a_elt,const bitmap_element * b_elt,unsigned char changed)33 bitmap_elt_ior (bitmap dst, bitmap_element * dst_elt,
34 		bitmap_element * dst_prev, const bitmap_element * a_elt,
35 		const bitmap_element * b_elt, unsigned char changed)
36 {
37 
38   if (a_elt)
39     {
40 
41       if (!changed && dst_elt)
42 	{
43 	  changed = 1;
44 	}
45     }
46   else
47     {
48       changed = 1;
49     }
50   return changed;
51 }
52 
53 unsigned char
bitmap_ior_into(bitmap a,const_bitmap b)54 bitmap_ior_into (bitmap a, const_bitmap b)
55 {
56   bitmap_element *a_elt = a->first;
57   const bitmap_element *b_elt = b->first;
58   bitmap_element *a_prev = ((void *) 0);
59   unsigned char changed = 0;
60 
61   while (b_elt)
62     {
63 
64       if (!a_elt || a_elt->indx == b_elt->indx)
65 	changed = bitmap_elt_ior (a, a_elt, a_prev, a_elt, b_elt, changed);
66       else if (a_elt->indx > b_elt->indx)
67 	changed = 1;
68       b_elt = b_elt->next;
69 
70 
71     }
72 
73   return changed;
74 }
75 
76 /* Verify that FRE simplified an if stmt.  */
77 /* { dg-final { scan-tree-dump "Replaced a_elt_\[0-9\]+ != 0B with 1" "fre1" } } */
78 /* { dg-final { scan-tree-dump "Replaced _\[0-9\]+ & _\[0-9\]+ with _\[0-9\]+" "fre1" } } */
79