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