1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-attributes
2 ; RUN: opt -constraint-elimination -S %s | FileCheck %s
4 define i1 @test_eq_ne_0(i8 %a, i8 %b) {
5 ; CHECK-LABEL: @test_eq_ne_0(
7 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[A:%.*]], 0
8 ; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]]
10 ; CHECK-NEXT: [[F_1:%.*]] = icmp ne i8 [[A]], 0
11 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[A]], 1
12 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[A]], [[B:%.*]]
13 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 false, [[C_1]]
14 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_2]]
15 ; CHECK-NEXT: ret i1 [[RES_2]]
17 ; CHECK-NEXT: [[T_1:%.*]] = icmp ne i8 [[A]], 0
18 ; CHECK-NEXT: [[C_3:%.*]] = icmp ne i8 [[A]], 1
19 ; CHECK-NEXT: [[C_4:%.*]] = icmp ne i8 [[A]], [[B]]
20 ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 true, [[C_3]]
21 ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], [[C_4]]
22 ; CHECK-NEXT: ret i1 [[RES_4]]
25 %cmp = icmp eq i8 %a, 0
26 br i1 %cmp, label %then, label %else
29 %f.1 = icmp ne i8 %a, 0
30 %c.1 = icmp ne i8 %a, 1
31 %c.2 = icmp ne i8 %a, %b
32 %res.1 = xor i1 %f.1, %c.1
33 %res.2 = xor i1 %res.1, %c.2
37 %t.1 = icmp ne i8 %a, 0
38 %c.3 = icmp ne i8 %a, 1
39 %c.4 = icmp ne i8 %a, %b
40 %res.3 = xor i1 %t.1, %c.3
41 %res.4 = xor i1 %res.3, %c.4
45 define i1 @test_ne_eq_0(i8 %a, i8 %b) {
46 ; CHECK-LABEL: @test_ne_eq_0(
48 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[A:%.*]], 0
49 ; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]]
51 ; CHECK-NEXT: [[T_1:%.*]] = icmp ne i8 [[A]], 0
52 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[A]], 1
53 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_1]]
54 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[A]], [[B:%.*]]
55 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_2]]
56 ; CHECK-NEXT: [[C_3:%.*]] = icmp eq i8 [[A]], [[B]]
57 ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], [[C_3]]
58 ; CHECK-NEXT: [[C_4:%.*]] = icmp eq i8 [[A]], 0
59 ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], [[C_4]]
60 ; CHECK-NEXT: [[T_2:%.*]] = icmp ugt i8 [[A]], 0
61 ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], true
62 ; CHECK-NEXT: [[T_3:%.*]] = icmp uge i8 [[A]], 1
63 ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], true
64 ; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[A]], 1
65 ; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], [[C_5]]
66 ; CHECK-NEXT: [[C_6:%.*]] = icmp sgt i8 [[A]], 0
67 ; CHECK-NEXT: [[RES_8:%.*]] = xor i1 [[RES_7]], [[C_6]]
68 ; CHECK-NEXT: ret i1 [[RES_8]]
70 ; CHECK-NEXT: [[F_1:%.*]] = icmp ne i8 [[A]], 0
71 ; CHECK-NEXT: [[C_7:%.*]] = icmp ne i8 [[A]], 1
72 ; CHECK-NEXT: [[RES_9:%.*]] = xor i1 false, [[C_7]]
73 ; CHECK-NEXT: [[C_8:%.*]] = icmp ne i8 [[A]], [[B]]
74 ; CHECK-NEXT: [[RES_10:%.*]] = xor i1 [[RES_9]], [[C_8]]
75 ; CHECK-NEXT: [[C_9:%.*]] = icmp eq i8 [[A]], [[B]]
76 ; CHECK-NEXT: [[RES_11:%.*]] = xor i1 [[RES_10]], [[C_9]]
77 ; CHECK-NEXT: [[C_10:%.*]] = icmp eq i8 [[A]], 0
78 ; CHECK-NEXT: [[RES_12:%.*]] = xor i1 [[RES_11]], [[C_10]]
79 ; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i8 [[A]], 0
80 ; CHECK-NEXT: [[RES_13:%.*]] = xor i1 [[RES_12]], false
81 ; CHECK-NEXT: [[F_3:%.*]] = icmp uge i8 [[A]], 1
82 ; CHECK-NEXT: [[RES_14:%.*]] = xor i1 [[RES_13]], false
83 ; CHECK-NEXT: [[C_11:%.*]] = icmp ugt i8 [[A]], 1
84 ; CHECK-NEXT: [[RES_15:%.*]] = xor i1 [[RES_14]], false
85 ; CHECK-NEXT: [[C_12:%.*]] = icmp sgt i8 [[A]], 0
86 ; CHECK-NEXT: [[RES_16:%.*]] = xor i1 [[RES_15]], [[C_12]]
87 ; CHECK-NEXT: ret i1 [[RES_16]]
90 %cmp = icmp ne i8 %a, 0
91 br i1 %cmp, label %then, label %else
94 %t.1 = icmp ne i8 %a, 0
95 %c.1 = icmp ne i8 %a, 1
96 %res.1 = xor i1 %t.1, %c.1
98 %c.2 = icmp ne i8 %a, %b
99 %res.2 = xor i1 %res.1, %c.2
101 %c.3 = icmp eq i8 %a, %b
102 %res.3 = xor i1 %res.2, %c.3
104 %c.4 = icmp eq i8 %a, 0
105 %res.4 = xor i1 %res.3, %c.4
107 %t.2 = icmp ugt i8 %a, 0
108 %res.5 = xor i1 %res.4, %t.2
110 %t.3 = icmp uge i8 %a, 1
111 %res.6 = xor i1 %res.5, %t.3
113 %c.5 = icmp ugt i8 %a, 1
114 %res.7 = xor i1 %res.6, %c.5
116 %c.6 = icmp sgt i8 %a, 0
117 %res.8 = xor i1 %res.7, %c.6
122 %f.1 = icmp ne i8 %a, 0
123 %c.7 = icmp ne i8 %a, 1
124 %res.9 = xor i1 %f.1, %c.7
126 %c.8 = icmp ne i8 %a, %b
127 %res.10 = xor i1 %res.9, %c.8
129 %c.9 = icmp eq i8 %a, %b
130 %res.11 = xor i1 %res.10, %c.9
132 %c.10 = icmp eq i8 %a, 0
133 %res.12 = xor i1 %res.11, %c.10
135 %f.2 = icmp ugt i8 %a, 0
136 %res.13 = xor i1 %res.12, %f.2
138 %f.3 = icmp uge i8 %a, 1
139 %res.14 = xor i1 %res.13, %f.3
141 %c.11 = icmp ugt i8 %a, 1
142 %res.15 = xor i1 %res.14, %c.11
144 %c.12 = icmp sgt i8 %a, 0
145 %res.16 = xor i1 %res.15, %c.12
150 define i1 @test_eq_ne_1(i8 %a, i8 %b) {
151 ; CHECK-LABEL: @test_eq_ne_1(
153 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[A:%.*]], 1
154 ; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]]
156 ; CHECK-NEXT: [[F_1:%.*]] = icmp ne i8 [[A]], 0
157 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[A]], 1
158 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[A]], [[B:%.*]]
159 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 true, [[C_1]]
160 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_2]]
161 ; CHECK-NEXT: ret i1 [[RES_2]]
163 ; CHECK-NEXT: [[T_1:%.*]] = icmp ne i8 [[A]], 0
164 ; CHECK-NEXT: [[C_3:%.*]] = icmp ne i8 [[A]], 1
165 ; CHECK-NEXT: [[C_4:%.*]] = icmp ne i8 [[A]], [[B]]
166 ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[T_1]], [[C_3]]
167 ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], [[C_4]]
168 ; CHECK-NEXT: ret i1 [[RES_4]]
171 %cmp = icmp eq i8 %a, 1
172 br i1 %cmp, label %then, label %else
175 %f.1 = icmp ne i8 %a, 0
176 %c.1 = icmp ne i8 %a, 1
177 %c.2 = icmp ne i8 %a, %b
178 %res.1 = xor i1 %f.1, %c.1
179 %res.2 = xor i1 %res.1, %c.2
183 %t.1 = icmp ne i8 %a, 0
184 %c.3 = icmp ne i8 %a, 1
185 %c.4 = icmp ne i8 %a, %b
186 %res.3 = xor i1 %t.1, %c.3
187 %res.4 = xor i1 %res.3, %c.4
191 define i1 @test_ne_eq_1(i8 %a, i8 %b) {
192 ; CHECK-LABEL: @test_ne_eq_1(
194 ; CHECK-NEXT: [[CMP:%.*]] = icmp ne i8 [[A:%.*]], 1
195 ; CHECK-NEXT: br i1 [[CMP]], label [[THEN:%.*]], label [[ELSE:%.*]]
197 ; CHECK-NEXT: [[T_1:%.*]] = icmp ne i8 [[A]], 1
198 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[A]], 0
199 ; CHECK-NEXT: [[RES_1:%.*]] = xor i1 [[T_1]], [[C_1]]
200 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[A]], [[B:%.*]]
201 ; CHECK-NEXT: [[RES_2:%.*]] = xor i1 [[RES_1]], [[C_2]]
202 ; CHECK-NEXT: [[C_3:%.*]] = icmp eq i8 [[A]], [[B]]
203 ; CHECK-NEXT: [[RES_3:%.*]] = xor i1 [[RES_2]], [[C_3]]
204 ; CHECK-NEXT: [[C_4:%.*]] = icmp eq i8 [[A]], 0
205 ; CHECK-NEXT: [[RES_4:%.*]] = xor i1 [[RES_3]], [[C_4]]
206 ; CHECK-NEXT: [[C_5:%.*]] = icmp ugt i8 [[A]], 0
207 ; CHECK-NEXT: [[RES_5:%.*]] = xor i1 [[RES_4]], [[C_5]]
208 ; CHECK-NEXT: [[C_6:%.*]] = icmp uge i8 [[A]], 1
209 ; CHECK-NEXT: [[RES_6:%.*]] = xor i1 [[RES_5]], [[C_6]]
210 ; CHECK-NEXT: [[C_7:%.*]] = icmp ugt i8 [[A]], 1
211 ; CHECK-NEXT: [[RES_7:%.*]] = xor i1 [[RES_6]], [[C_5]]
212 ; CHECK-NEXT: [[C_8:%.*]] = icmp sgt i8 [[A]], 0
213 ; CHECK-NEXT: [[RES_8:%.*]] = xor i1 [[RES_7]], [[C_6]]
214 ; CHECK-NEXT: ret i1 [[RES_8]]
216 ; CHECK-NEXT: [[T_2:%.*]] = icmp ne i8 [[A]], 0
217 ; CHECK-NEXT: [[C_9:%.*]] = icmp ne i8 [[A]], 1
218 ; CHECK-NEXT: [[RES_9:%.*]] = xor i1 true, [[C_9]]
219 ; CHECK-NEXT: [[C_10:%.*]] = icmp ne i8 [[A]], [[B]]
220 ; CHECK-NEXT: [[RES_10:%.*]] = xor i1 [[RES_9]], [[C_10]]
221 ; CHECK-NEXT: [[C_11:%.*]] = icmp eq i8 [[A]], [[B]]
222 ; CHECK-NEXT: [[RES_11:%.*]] = xor i1 [[RES_10]], [[C_11]]
223 ; CHECK-NEXT: [[F_1:%.*]] = icmp eq i8 [[A]], 0
224 ; CHECK-NEXT: [[RES_12:%.*]] = xor i1 [[RES_11]], [[F_1]]
225 ; CHECK-NEXT: [[T_3:%.*]] = icmp ugt i8 [[A]], 0
226 ; CHECK-NEXT: [[RES_13:%.*]] = xor i1 [[RES_12]], true
227 ; CHECK-NEXT: [[T_4:%.*]] = icmp uge i8 [[A]], 1
228 ; CHECK-NEXT: [[RES_14:%.*]] = xor i1 [[RES_13]], true
229 ; CHECK-NEXT: [[F_2:%.*]] = icmp ugt i8 [[A]], 1
230 ; CHECK-NEXT: [[RES_15:%.*]] = xor i1 [[RES_14]], false
231 ; CHECK-NEXT: [[C_12:%.*]] = icmp sgt i8 [[A]], 0
232 ; CHECK-NEXT: [[RES_16:%.*]] = xor i1 [[RES_15]], [[C_12]]
233 ; CHECK-NEXT: ret i1 [[RES_16]]
236 %cmp = icmp ne i8 %a, 1
237 br i1 %cmp, label %then, label %else
240 %t.1 = icmp ne i8 %a, 1
241 %c.1 = icmp ne i8 %a, 0
242 %res.1 = xor i1 %t.1, %c.1
244 %c.2 = icmp ne i8 %a, %b
245 %res.2 = xor i1 %res.1, %c.2
247 %c.3 = icmp eq i8 %a, %b
248 %res.3 = xor i1 %res.2, %c.3
250 %c.4 = icmp eq i8 %a, 0
251 %res.4 = xor i1 %res.3, %c.4
253 %c.5 = icmp ugt i8 %a, 0
254 %res.5 = xor i1 %res.4, %c.5
256 %c.6 = icmp uge i8 %a, 1
257 %res.6 = xor i1 %res.5, %c.6
259 %c.7 = icmp ugt i8 %a, 1
260 %res.7 = xor i1 %res.6, %c.5
262 %c.8 = icmp sgt i8 %a, 0
263 %res.8 = xor i1 %res.7, %c.6
268 %t.2 = icmp ne i8 %a, 0
269 %c.9 = icmp ne i8 %a, 1
270 %res.9 = xor i1 %t.2, %c.9
272 %c.10 = icmp ne i8 %a, %b
273 %res.10 = xor i1 %res.9, %c.10
275 %c.11 = icmp eq i8 %a, %b
276 %res.11 = xor i1 %res.10, %c.11
278 %f.1 = icmp eq i8 %a, 0
279 %res.12 = xor i1 %res.11, %f.1
281 %t.3 = icmp ugt i8 %a, 0
282 %res.13 = xor i1 %res.12, %t.3
284 %t.4 = icmp uge i8 %a, 1
285 %res.14 = xor i1 %res.13, %t.4
287 %f.2 = icmp ugt i8 %a, 1
288 %res.15 = xor i1 %res.14, %f.2
290 %c.12 = icmp sgt i8 %a, 0
291 %res.16 = xor i1 %res.15, %c.12