1 /* PR middle-end/35691 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fdump-tree-reassoc1-details" } */
4
5 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[xyz]1_\[0-9]*\\(D\\) \\+\\\[0, 0\\\] and \[xyz]1_\[0-9]*\\(D\\) \\+\\\[0, 0\\\] and \[xyz]1_\[0-9]*\\(D\\) \\+\\\[0, 0\\\]\[\n\r]" 1 "reassoc1" } } */
6 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[ghi]1_\[0-9]*\\(D\\) \\+\\\[0, 0\\\] and \[ghi]1_\[0-9]*\\(D\\) \\+\\\[0, 0\\\] and \[ghi]1_\[0-9]*\\(D\\) \\+\\\[0, 0\\\]\[\n\r]" 1 "reassoc1" } } */
7
8 int
f1(int x1,unsigned int y1,int z1,_Bool d,_Bool e,_Bool f,long long g1,unsigned long long h1,long long i1)9 f1 (int x1, unsigned int y1, int z1, _Bool d, _Bool e, _Bool f, long long g1, unsigned long long h1, long long i1)
10 {
11 int a = x1 == 0;
12 int b = y1 == 0;
13 int c = z1 == 0;
14 int j = g1 == 0;
15 int k = h1 == 0;
16 int l = i1 == 0;
17 return a && d && j && b && e && l && f && c && k;
18 }
19
20 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[xyz]2_\[0-9]*\\(D\\) \\+\\\[0, 0\\\] and \[xyz]2_\[0-9]*\\(D\\) \\+\\\[0, 0\\\] and \[xyz]2_\[0-9]*\\(D\\) \\+\\\[0, 0\\\]\[\n\r]" 1 "reassoc1" } } */
21 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[ghi]2_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\] and \[ghi]2_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\] and \[ghi]2_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\]\[\n\r]" 1 "reassoc1" } } */
22
23 int
f2(int x2,int y2,unsigned int z2,_Bool d,_Bool e,_Bool f,long long g2,unsigned long long h2,long long i2)24 f2 (int x2, int y2, unsigned int z2, _Bool d, _Bool e, _Bool f, long long g2, unsigned long long h2, long long i2)
25 {
26 int a = x2 == 0;
27 int b = y2 == 0;
28 int c = z2 == 0;
29 int j = g2 == -1LL;
30 int k = h2 == -1ULL;
31 int l = i2 == -1LL;
32 return !a || d || !l || !b || !k || e || f || !c || !j;
33 }
34
35 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[xyz]3_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\] and \[xyz]3_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\] and \[xyz]3_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\]\[\n\r]" 1 "reassoc1" } } */
36 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[ghi]3_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\] and \[ghi]3_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\] and \[ghi]3_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\]\[\n\r]" 1 "reassoc1" } } */
37
38 int
f3(unsigned int x3,int y3,int z3,_Bool d,_Bool e,_Bool f,signed char g3,unsigned char h3,signed char i3)39 f3 (unsigned int x3, int y3, int z3, _Bool d, _Bool e, _Bool f, signed char g3, unsigned char h3, signed char i3)
40 {
41 int a = x3 == -1U;
42 int b = y3 == -1;
43 int c = z3 == -1;
44 int j = g3 == -1;
45 int k = h3 == (unsigned char) -1U;
46 int l = i3 == -1;
47 return a && d && j && b && k && e && f && c && l;
48 }
49
50 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[xyz]4_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\] and \[xyz]4_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\] and \[xyz]4_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\]\[\n\r]" 1 "reassoc1" } } */
51
52 int
f4(int x4,unsigned int y4,unsigned int z4,_Bool d,_Bool e,_Bool f)53 f4 (int x4, unsigned int y4, unsigned int z4, _Bool d, _Bool e, _Bool f)
54 {
55 int a = x4 == -1U;
56 int b = y4 == -1U;
57 int c = z4 == -1;
58 return !a || d || !b || e || f || !c;
59 }
60
61 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[xyz]5_\[0-9]*\\(D\\) \\+\\\[0, 0\\\] and \[xyz]5_\[0-9]*\\(D\\) \\+\\\[0, 0\\\] and \[xyz]5_\[0-9]*\\(D\\) \\+\\\[0, 0\\\]\[\n\r]" 1 "reassoc1" } } */
62
63 int
f5(int x5,int y5,int z5,_Bool d,_Bool e,_Bool f)64 f5 (int x5, int y5, int z5, _Bool d, _Bool e, _Bool f)
65 {
66 int a = x5 == 0;
67 int b = y5 != 0;
68 int c = z5 != 0;
69 return a && d && !b && e && f && !c;
70 }
71
72 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[xyz]6_\[0-9]*\\(D\\) \\+\\\[0, 0\\\] and \[xyz]6_\[0-9]*\\(D\\) \\+\\\[0, 0\\\] and \[xyz]6_\[0-9]*\\(D\\) \\+\\\[0, 0\\\]\[\n\r]" 1 "reassoc1" } } */
73
74 int
f6(unsigned int x6,unsigned int y6,unsigned int z6,_Bool d,_Bool e,_Bool f)75 f6 (unsigned int x6, unsigned int y6, unsigned int z6, _Bool d, _Bool e, _Bool f)
76 {
77 int a = x6 == 0;
78 int b = y6 != 0;
79 int c = z6 != 0;
80 return !a || d || b || e || f || c;
81 }
82
83 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[xy]7_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\] and \[xy]7_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\]\[\n\r]" 1 "reassoc1" } } */
84
85 int
f7(int x7,int y7,int z7,_Bool d,_Bool e,_Bool f)86 f7 (int x7, int y7, int z7, _Bool d, _Bool e, _Bool f)
87 {
88 int a = x7 == -1;
89 int b = y7 != -1;
90 int c = z7 == -1;
91 return a && d && !b && e && f && !c;
92 }
93
94 /* { dg-final { scan-tree-dump-times "Optimizing range tests \[xy]8_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\] and \[xy]8_\[0-9]*\\(D\\) \\+\\\[\[1-9-]\[0-9]*, \[1-9-]\[0-9]*\\\]\[\n\r]" 1 "reassoc1" } } */
95
96 int
f8(unsigned int x8,unsigned int y8,unsigned int z8,_Bool d,_Bool e,_Bool f)97 f8 (unsigned int x8, unsigned int y8, unsigned int z8, _Bool d, _Bool e, _Bool f)
98 {
99 int a = x8 == -1;
100 int b = y8 != -1;
101 int c = z8 == -1;
102 return !a || d || b || e || f || c;
103 }
104
105 /* { dg-final { scan-tree-dump-not "Optimizing range tests \[xyz]9_\[0-9]*\\(D\\)" "reassoc1" } } */
106
107 int
f9(int x9,int y9,int z9,_Bool d,_Bool e,_Bool f)108 f9 (int x9, int y9, int z9, _Bool d, _Bool e, _Bool f)
109 {
110 int a = x9 == -1;
111 int b = y9 == -1;
112 int c = z9 == -1;
113 return a || d || b || e || f || c;
114 }
115
116 /* { dg-final { scan-tree-dump-not "Optimizing range tests \[xyz]0_\[0-9]*\\(D\\)" "reassoc1" } } */
117
118 int
f0(int x0,int y0,int z0,_Bool d,_Bool e,_Bool f)119 f0 (int x0, int y0, int z0, _Bool d, _Bool e, _Bool f)
120 {
121 int a = x0 != 0;
122 int b = y0 != 0;
123 int c = z0 != 0;
124 return a && d && b && e && f && c;
125 }
126