1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -instcombine < %s | FileCheck %s
4 ; Combine equality comparisons of adjacent extracted integers parts into
5 ; a comparison of a larger part. Start with some examples...
7 declare void @use.i32(i32)
8 declare void @use.i8(i8)
9 declare void @use.i1(i1)
11 define i1 @eq_10(i32 %x, i32 %y) {
12 ; CHECK-LABEL: @eq_10(
13 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[X:%.*]] to i16
14 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[Y:%.*]] to i16
15 ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i16 [[TMP1]], [[TMP2]]
16 ; CHECK-NEXT: ret i1 [[TMP3]]
18 %x.0 = trunc i32 %x to i8
19 %x.321 = lshr i32 %x, 8
20 %x.1 = trunc i32 %x.321 to i8
21 %y.0 = trunc i32 %y to i8
22 %y.321 = lshr i32 %y, 8
23 %y.1 = trunc i32 %y.321 to i8
24 %c.0 = icmp eq i8 %x.0, %y.0
25 %c.1 = icmp eq i8 %x.1, %y.1
26 %c.10 = and i1 %c.0, %c.1
30 define i1 @eq_210(i32 %x, i32 %y) {
31 ; CHECK-LABEL: @eq_210(
32 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[X:%.*]] to i24
33 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[Y:%.*]] to i24
34 ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq i24 [[TMP1]], [[TMP2]]
35 ; CHECK-NEXT: ret i1 [[TMP3]]
37 %x.0 = trunc i32 %x to i8
38 %x.321 = lshr i32 %x, 8
39 %x.1 = trunc i32 %x.321 to i8
40 %x.32 = lshr i32 %x, 16
41 %x.2 = trunc i32 %x.32 to i8
42 %y.0 = trunc i32 %y to i8
43 %y.321 = lshr i32 %y, 8
44 %y.1 = trunc i32 %y.321 to i8
45 %y.32 = lshr i32 %y, 16
46 %y.2 = trunc i32 %y.32 to i8
47 %c.0 = icmp eq i8 %x.0, %y.0
48 %c.1 = icmp eq i8 %x.1, %y.1
49 %c.2 = icmp eq i8 %x.2, %y.2
50 %c.10 = and i1 %c.0, %c.1
51 %c.210 = and i1 %c.2, %c.10
55 define i1 @eq_3210(i32 %x, i32 %y) {
56 ; CHECK-LABEL: @eq_3210(
57 ; CHECK-NEXT: [[TMP1:%.*]] = icmp eq i32 [[X:%.*]], [[Y:%.*]]
58 ; CHECK-NEXT: ret i1 [[TMP1]]
60 %x.0 = trunc i32 %x to i8
61 %x.321 = lshr i32 %x, 8
62 %x.1 = trunc i32 %x.321 to i8
63 %x.32 = lshr i32 %x, 16
64 %x.2 = trunc i32 %x.32 to i8
65 %x.3.ext = lshr i32 %x, 24
66 %x.3 = trunc i32 %x.3.ext to i8
67 %y.0 = trunc i32 %y to i8
68 %y.321 = lshr i32 %y, 8
69 %y.1 = trunc i32 %y.321 to i8
70 %y.32 = lshr i32 %y, 16
71 %y.2 = trunc i32 %y.32 to i8
72 %y.3.ext = lshr i32 %y, 24
73 %y.3 = trunc i32 %y.3.ext to i8
74 %c.0 = icmp eq i8 %x.0, %y.0
75 %c.1 = icmp eq i8 %x.1, %y.1
76 %c.2 = icmp eq i8 %x.2, %y.2
77 %c.3 = icmp eq i8 %x.3, %y.3
78 %c.10 = and i1 %c.0, %c.1
79 %c.210 = and i1 %c.2, %c.10
80 %c.3210 = and i1 %c.3, %c.210
84 define i1 @eq_21(i32 %x, i32 %y) {
85 ; CHECK-LABEL: @eq_21(
86 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[X:%.*]], 8
87 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[TMP1]] to i16
88 ; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[Y:%.*]], 8
89 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i32 [[TMP3]] to i16
90 ; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i16 [[TMP2]], [[TMP4]]
91 ; CHECK-NEXT: ret i1 [[TMP5]]
93 %x.321 = lshr i32 %x, 8
94 %x.1 = trunc i32 %x.321 to i8
95 %x.32 = lshr i32 %x, 16
96 %x.2 = trunc i32 %x.32 to i8
97 %y.321 = lshr i32 %y, 8
98 %y.1 = trunc i32 %y.321 to i8
99 %y.32 = lshr i32 %y, 16
100 %y.2 = trunc i32 %y.32 to i8
101 %c.1 = icmp eq i8 %x.1, %y.1
102 %c.2 = icmp eq i8 %x.2, %y.2
103 %c.210 = and i1 %c.2, %c.1
107 ; Test commuted variants of eq_21.
109 define i1 @eq_21_comm_and(i32 %x, i32 %y) {
110 ; CHECK-LABEL: @eq_21_comm_and(
111 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[X:%.*]], 8
112 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[TMP1]] to i16
113 ; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[Y:%.*]], 8
114 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i32 [[TMP3]] to i16
115 ; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i16 [[TMP2]], [[TMP4]]
116 ; CHECK-NEXT: ret i1 [[TMP5]]
118 %x.321 = lshr i32 %x, 8
119 %x.1 = trunc i32 %x.321 to i8
120 %x.32 = lshr i32 %x, 16
121 %x.2 = trunc i32 %x.32 to i8
122 %y.321 = lshr i32 %y, 8
123 %y.1 = trunc i32 %y.321 to i8
124 %y.32 = lshr i32 %y, 16
125 %y.2 = trunc i32 %y.32 to i8
126 %c.1 = icmp eq i8 %x.1, %y.1
127 %c.2 = icmp eq i8 %x.2, %y.2
128 %c.210 = and i1 %c.1, %c.2
132 define i1 @eq_21_comm_eq(i32 %x, i32 %y) {
133 ; CHECK-LABEL: @eq_21_comm_eq(
134 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[Y:%.*]], 8
135 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[TMP1]] to i16
136 ; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[X:%.*]], 8
137 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i32 [[TMP3]] to i16
138 ; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i16 [[TMP2]], [[TMP4]]
139 ; CHECK-NEXT: ret i1 [[TMP5]]
141 %x.321 = lshr i32 %x, 8
142 %x.1 = trunc i32 %x.321 to i8
143 %x.32 = lshr i32 %x, 16
144 %x.2 = trunc i32 %x.32 to i8
145 %y.321 = lshr i32 %y, 8
146 %y.1 = trunc i32 %y.321 to i8
147 %y.32 = lshr i32 %y, 16
148 %y.2 = trunc i32 %y.32 to i8
149 %c.1 = icmp eq i8 %x.1, %y.1
150 %c.2 = icmp eq i8 %y.2, %x.2
151 %c.210 = and i1 %c.2, %c.1
155 define i1 @eq_21_comm_eq2(i32 %x, i32 %y) {
156 ; CHECK-LABEL: @eq_21_comm_eq2(
157 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[X:%.*]], 8
158 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[TMP1]] to i16
159 ; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[Y:%.*]], 8
160 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i32 [[TMP3]] to i16
161 ; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i16 [[TMP2]], [[TMP4]]
162 ; CHECK-NEXT: ret i1 [[TMP5]]
164 %x.321 = lshr i32 %x, 8
165 %x.1 = trunc i32 %x.321 to i8
166 %x.32 = lshr i32 %x, 16
167 %x.2 = trunc i32 %x.32 to i8
168 %y.321 = lshr i32 %y, 8
169 %y.1 = trunc i32 %y.321 to i8
170 %y.32 = lshr i32 %y, 16
171 %y.2 = trunc i32 %y.32 to i8
172 %c.1 = icmp eq i8 %y.1, %x.1
173 %c.2 = icmp eq i8 %x.2, %y.2
174 %c.210 = and i1 %c.2, %c.1
178 ; Test vector variant.
180 define <2x i1> @eq_21_vector(<2x i32> %x, <2x i32> %y) {
181 ; CHECK-LABEL: @eq_21_vector(
182 ; CHECK-NEXT: [[TMP1:%.*]] = lshr <2 x i32> [[X:%.*]], <i32 8, i32 8>
183 ; CHECK-NEXT: [[TMP2:%.*]] = trunc <2 x i32> [[TMP1]] to <2 x i16>
184 ; CHECK-NEXT: [[TMP3:%.*]] = lshr <2 x i32> [[Y:%.*]], <i32 8, i32 8>
185 ; CHECK-NEXT: [[TMP4:%.*]] = trunc <2 x i32> [[TMP3]] to <2 x i16>
186 ; CHECK-NEXT: [[TMP5:%.*]] = icmp eq <2 x i16> [[TMP2]], [[TMP4]]
187 ; CHECK-NEXT: ret <2 x i1> [[TMP5]]
189 %x.321 = lshr <2x i32> %x, <i32 8, i32 8>
190 %x.1 = trunc <2x i32> %x.321 to <2x i8>
191 %x.32 = lshr <2x i32> %x, <i32 16, i32 16>
192 %x.2 = trunc <2x i32> %x.32 to <2x i8>
193 %y.321 = lshr <2x i32> %y, <i32 8, i32 8>
194 %y.1 = trunc <2x i32> %y.321 to <2x i8>
195 %y.32 = lshr <2x i32> %y, <i32 16, i32 16>
196 %y.2 = trunc <2x i32> %y.32 to <2x i8>
197 %c.1 = icmp eq <2x i8> %x.1, %y.1
198 %c.2 = icmp eq <2x i8> %x.2, %y.2
199 %c.210 = and <2x i1> %c.2, %c.1
203 ; Test irregular bit widths. This also tests the case where
204 ; all the involved bit widths and offsets are different.
206 define i1 @eq_irregular_bit_widths(i31 %x, i31 %y) {
207 ; CHECK-LABEL: @eq_irregular_bit_widths(
208 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i31 [[X:%.*]], 7
209 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i31 [[TMP1]] to i11
210 ; CHECK-NEXT: [[TMP3:%.*]] = lshr i31 [[Y:%.*]], 7
211 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i31 [[TMP3]] to i11
212 ; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i11 [[TMP2]], [[TMP4]]
213 ; CHECK-NEXT: ret i1 [[TMP5]]
215 %x.321 = lshr i31 %x, 7
216 %x.1 = trunc i31 %x.321 to i6
217 %x.32 = lshr i31 %x, 13
218 %x.2 = trunc i31 %x.32 to i5
219 %y.321 = lshr i31 %y, 7
220 %y.1 = trunc i31 %y.321 to i6
221 %y.32 = lshr i31 %y, 13
222 %y.2 = trunc i31 %y.32 to i5
223 %c.1 = icmp eq i6 %x.1, %y.1
224 %c.2 = icmp eq i5 %x.2, %y.2
225 %c.210 = and i1 %c.2, %c.1
229 ; Test variants with extra uses.
231 define i1 @eq_21_extra_use_lshr(i32 %x, i32 %y) {
232 ; CHECK-LABEL: @eq_21_extra_use_lshr(
233 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
234 ; CHECK-NEXT: call void @use.i32(i32 [[X_321]])
235 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
236 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
237 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
238 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
239 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
240 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
241 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
242 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
243 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
244 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_1]], [[C_2]]
245 ; CHECK-NEXT: ret i1 [[C_210]]
247 %x.321 = lshr i32 %x, 8
248 call void @use.i32(i32 %x.321)
249 %x.1 = trunc i32 %x.321 to i8
250 %x.32 = lshr i32 %x, 16
251 %x.2 = trunc i32 %x.32 to i8
252 %y.321 = lshr i32 %y, 8
253 %y.1 = trunc i32 %y.321 to i8
254 %y.32 = lshr i32 %y, 16
255 %y.2 = trunc i32 %y.32 to i8
256 %c.1 = icmp eq i8 %x.1, %y.1
257 %c.2 = icmp eq i8 %x.2, %y.2
258 %c.210 = and i1 %c.1, %c.2
262 define i1 @eq_21_extra_use_trunc(i32 %x, i32 %y) {
263 ; CHECK-LABEL: @eq_21_extra_use_trunc(
264 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
265 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
266 ; CHECK-NEXT: call void @use.i8(i8 [[X_1]])
267 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
268 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
269 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
270 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
271 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
272 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
273 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
274 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
275 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_1]], [[C_2]]
276 ; CHECK-NEXT: ret i1 [[C_210]]
278 %x.321 = lshr i32 %x, 8
279 %x.1 = trunc i32 %x.321 to i8
280 call void @use.i8(i8 %x.1)
281 %x.32 = lshr i32 %x, 16
282 %x.2 = trunc i32 %x.32 to i8
283 %y.321 = lshr i32 %y, 8
284 %y.1 = trunc i32 %y.321 to i8
285 %y.32 = lshr i32 %y, 16
286 %y.2 = trunc i32 %y.32 to i8
287 %c.1 = icmp eq i8 %x.1, %y.1
288 %c.2 = icmp eq i8 %x.2, %y.2
289 %c.210 = and i1 %c.1, %c.2
293 define i1 @eq_21_extra_use_eq1(i32 %x, i32 %y) {
294 ; CHECK-LABEL: @eq_21_extra_use_eq1(
295 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
296 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
297 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
298 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
299 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
300 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
301 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
302 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
303 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
304 ; CHECK-NEXT: call void @use.i1(i1 [[C_1]])
305 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
306 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_1]], [[C_2]]
307 ; CHECK-NEXT: ret i1 [[C_210]]
309 %x.321 = lshr i32 %x, 8
310 %x.1 = trunc i32 %x.321 to i8
311 %x.32 = lshr i32 %x, 16
312 %x.2 = trunc i32 %x.32 to i8
313 %y.321 = lshr i32 %y, 8
314 %y.1 = trunc i32 %y.321 to i8
315 %y.32 = lshr i32 %y, 16
316 %y.2 = trunc i32 %y.32 to i8
317 %c.1 = icmp eq i8 %x.1, %y.1
318 call void @use.i1(i1 %c.1)
319 %c.2 = icmp eq i8 %x.2, %y.2
320 %c.210 = and i1 %c.1, %c.2
324 define i1 @eq_21_extra_use_eq2(i32 %x, i32 %y) {
325 ; CHECK-LABEL: @eq_21_extra_use_eq2(
326 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
327 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
328 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
329 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
330 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
331 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
332 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
333 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
334 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
335 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
336 ; CHECK-NEXT: call void @use.i1(i1 [[C_2]])
337 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_1]], [[C_2]]
338 ; CHECK-NEXT: ret i1 [[C_210]]
340 %x.321 = lshr i32 %x, 8
341 %x.1 = trunc i32 %x.321 to i8
342 %x.32 = lshr i32 %x, 16
343 %x.2 = trunc i32 %x.32 to i8
344 %y.321 = lshr i32 %y, 8
345 %y.1 = trunc i32 %y.321 to i8
346 %y.32 = lshr i32 %y, 16
347 %y.2 = trunc i32 %y.32 to i8
348 %c.1 = icmp eq i8 %x.1, %y.1
349 %c.2 = icmp eq i8 %x.2, %y.2
350 call void @use.i1(i1 %c.2)
351 %c.210 = and i1 %c.1, %c.2
357 define i1 @eq_21_wrong_op1(i32 %x, i32 %y, i32 %z) {
358 ; CHECK-LABEL: @eq_21_wrong_op1(
359 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[Z:%.*]], 8
360 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
361 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X:%.*]], 16
362 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
363 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
364 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
365 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
366 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
367 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
368 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
369 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_2]], [[C_1]]
370 ; CHECK-NEXT: ret i1 [[C_210]]
372 %x.321 = lshr i32 %z, 8
373 %x.1 = trunc i32 %x.321 to i8
374 %x.32 = lshr i32 %x, 16
375 %x.2 = trunc i32 %x.32 to i8
376 %y.321 = lshr i32 %y, 8
377 %y.1 = trunc i32 %y.321 to i8
378 %y.32 = lshr i32 %y, 16
379 %y.2 = trunc i32 %y.32 to i8
380 %c.1 = icmp eq i8 %x.1, %y.1
381 %c.2 = icmp eq i8 %x.2, %y.2
382 %c.210 = and i1 %c.2, %c.1
386 define i1 @eq_21_wrong_op2(i32 %x, i32 %y, i32 %z) {
387 ; CHECK-LABEL: @eq_21_wrong_op2(
388 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
389 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
390 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[Z:%.*]], 16
391 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
392 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
393 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
394 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
395 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
396 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
397 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
398 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_2]], [[C_1]]
399 ; CHECK-NEXT: ret i1 [[C_210]]
401 %x.321 = lshr i32 %x, 8
402 %x.1 = trunc i32 %x.321 to i8
403 %x.32 = lshr i32 %z, 16
404 %x.2 = trunc i32 %x.32 to i8
405 %y.321 = lshr i32 %y, 8
406 %y.1 = trunc i32 %y.321 to i8
407 %y.32 = lshr i32 %y, 16
408 %y.2 = trunc i32 %y.32 to i8
409 %c.1 = icmp eq i8 %x.1, %y.1
410 %c.2 = icmp eq i8 %x.2, %y.2
411 %c.210 = and i1 %c.2, %c.1
415 define i1 @eq_21_wrong_op3(i32 %x, i32 %y, i32 %z) {
416 ; CHECK-LABEL: @eq_21_wrong_op3(
417 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
418 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
419 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
420 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
421 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Z:%.*]], 8
422 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
423 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y:%.*]], 16
424 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
425 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
426 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
427 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_2]], [[C_1]]
428 ; CHECK-NEXT: ret i1 [[C_210]]
430 %x.321 = lshr i32 %x, 8
431 %x.1 = trunc i32 %x.321 to i8
432 %x.32 = lshr i32 %x, 16
433 %x.2 = trunc i32 %x.32 to i8
434 %y.321 = lshr i32 %z, 8
435 %y.1 = trunc i32 %y.321 to i8
436 %y.32 = lshr i32 %y, 16
437 %y.2 = trunc i32 %y.32 to i8
438 %c.1 = icmp eq i8 %x.1, %y.1
439 %c.2 = icmp eq i8 %x.2, %y.2
440 %c.210 = and i1 %c.2, %c.1
444 define i1 @eq_21_wrong_op4(i32 %x, i32 %y, i32 %z) {
445 ; CHECK-LABEL: @eq_21_wrong_op4(
446 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
447 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
448 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
449 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
450 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
451 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
452 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Z:%.*]], 16
453 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
454 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
455 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
456 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_2]], [[C_1]]
457 ; CHECK-NEXT: ret i1 [[C_210]]
459 %x.321 = lshr i32 %x, 8
460 %x.1 = trunc i32 %x.321 to i8
461 %x.32 = lshr i32 %x, 16
462 %x.2 = trunc i32 %x.32 to i8
463 %y.321 = lshr i32 %y, 8
464 %y.1 = trunc i32 %y.321 to i8
465 %y.32 = lshr i32 %z, 16
466 %y.2 = trunc i32 %y.32 to i8
467 %c.1 = icmp eq i8 %x.1, %y.1
468 %c.2 = icmp eq i8 %x.2, %y.2
469 %c.210 = and i1 %c.2, %c.1
473 define i1 @eq_21_wrong_shift1(i32 %x, i32 %y) {
474 ; CHECK-LABEL: @eq_21_wrong_shift1(
475 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
476 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
477 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
478 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
479 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 7
480 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
481 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
482 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
483 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
484 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
485 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_2]], [[C_1]]
486 ; CHECK-NEXT: ret i1 [[C_210]]
488 %x.321 = lshr i32 %x, 8
489 %x.1 = trunc i32 %x.321 to i8
490 %x.32 = lshr i32 %x, 16
491 %x.2 = trunc i32 %x.32 to i8
492 %y.321 = lshr i32 %y, 7
493 %y.1 = trunc i32 %y.321 to i8
494 %y.32 = lshr i32 %y, 16
495 %y.2 = trunc i32 %y.32 to i8
496 %c.1 = icmp eq i8 %x.1, %y.1
497 %c.2 = icmp eq i8 %x.2, %y.2
498 %c.210 = and i1 %c.2, %c.1
502 define i1 @eq_21_wrong_shift2(i32 %x, i32 %y) {
503 ; CHECK-LABEL: @eq_21_wrong_shift2(
504 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
505 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
506 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
507 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
508 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
509 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
510 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 15
511 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
512 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
513 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
514 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_2]], [[C_1]]
515 ; CHECK-NEXT: ret i1 [[C_210]]
517 %x.321 = lshr i32 %x, 8
518 %x.1 = trunc i32 %x.321 to i8
519 %x.32 = lshr i32 %x, 16
520 %x.2 = trunc i32 %x.32 to i8
521 %y.321 = lshr i32 %y, 8
522 %y.1 = trunc i32 %y.321 to i8
523 %y.32 = lshr i32 %y, 15
524 %y.2 = trunc i32 %y.32 to i8
525 %c.1 = icmp eq i8 %x.1, %y.1
526 %c.2 = icmp eq i8 %x.2, %y.2
527 %c.210 = and i1 %c.2, %c.1
531 define i1 @eq_21_not_adjacent(i32 %x, i32 %y) {
532 ; CHECK-LABEL: @eq_21_not_adjacent(
533 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
534 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
535 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 17
536 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
537 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
538 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
539 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 17
540 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
541 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
542 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
543 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_2]], [[C_1]]
544 ; CHECK-NEXT: ret i1 [[C_210]]
546 %x.321 = lshr i32 %x, 8
547 %x.1 = trunc i32 %x.321 to i8
548 %x.32 = lshr i32 %x, 17
549 %x.2 = trunc i32 %x.32 to i8
550 %y.321 = lshr i32 %y, 8
551 %y.1 = trunc i32 %y.321 to i8
552 %y.32 = lshr i32 %y, 17
553 %y.2 = trunc i32 %y.32 to i8
554 %c.1 = icmp eq i8 %x.1, %y.1
555 %c.2 = icmp eq i8 %x.2, %y.2
556 %c.210 = and i1 %c.2, %c.1
560 define i1 @eq_shift_in_zeros(i32 %x, i32 %y) {
561 ; CHECK-LABEL: @eq_shift_in_zeros(
562 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
563 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
564 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
565 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i24
566 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
567 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
568 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
569 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i24
570 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
571 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i24 [[X_2]], [[Y_2]]
572 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_2]], [[C_1]]
573 ; CHECK-NEXT: ret i1 [[C_210]]
575 %x.321 = lshr i32 %x, 8
576 %x.1 = trunc i32 %x.321 to i8
577 %x.32 = lshr i32 %x, 16
578 %x.2 = trunc i32 %x.32 to i24
579 %y.321 = lshr i32 %y, 8
580 %y.1 = trunc i32 %y.321 to i8
581 %y.32 = lshr i32 %y, 16
582 %y.2 = trunc i32 %y.32 to i24
583 %c.1 = icmp eq i8 %x.1, %y.1
584 %c.2 = icmp eq i24 %x.2, %y.2
585 %c.210 = and i1 %c.2, %c.1
589 define i1 @eq_21_wrong_pred1(i32 %x, i32 %y) {
590 ; CHECK-LABEL: @eq_21_wrong_pred1(
591 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
592 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
593 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
594 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
595 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
596 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
597 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
598 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
599 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
600 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
601 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_2]], [[C_1]]
602 ; CHECK-NEXT: ret i1 [[C_210]]
604 %x.321 = lshr i32 %x, 8
605 %x.1 = trunc i32 %x.321 to i8
606 %x.32 = lshr i32 %x, 16
607 %x.2 = trunc i32 %x.32 to i8
608 %y.321 = lshr i32 %y, 8
609 %y.1 = trunc i32 %y.321 to i8
610 %y.32 = lshr i32 %y, 16
611 %y.2 = trunc i32 %y.32 to i8
612 %c.1 = icmp eq i8 %x.1, %y.1
613 %c.2 = icmp ne i8 %x.2, %y.2
614 %c.210 = and i1 %c.2, %c.1
618 define i1 @eq_21_wrong_pred2(i32 %x, i32 %y) {
619 ; CHECK-LABEL: @eq_21_wrong_pred2(
620 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
621 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
622 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
623 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
624 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
625 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
626 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
627 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
628 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
629 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
630 ; CHECK-NEXT: [[C_210:%.*]] = and i1 [[C_2]], [[C_1]]
631 ; CHECK-NEXT: ret i1 [[C_210]]
633 %x.321 = lshr i32 %x, 8
634 %x.1 = trunc i32 %x.321 to i8
635 %x.32 = lshr i32 %x, 16
636 %x.2 = trunc i32 %x.32 to i8
637 %y.321 = lshr i32 %y, 8
638 %y.1 = trunc i32 %y.321 to i8
639 %y.32 = lshr i32 %y, 16
640 %y.2 = trunc i32 %y.32 to i8
641 %c.1 = icmp ne i8 %x.1, %y.1
642 %c.2 = icmp ne i8 %x.2, %y.2
643 %c.210 = and i1 %c.2, %c.1
648 ; Now the same thing again, but for or ne instead of and eq.
651 define i1 @ne_10(i32 %x, i32 %y) {
652 ; CHECK-LABEL: @ne_10(
653 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[X:%.*]] to i16
654 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[Y:%.*]] to i16
655 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i16 [[TMP1]], [[TMP2]]
656 ; CHECK-NEXT: ret i1 [[TMP3]]
658 %x.0 = trunc i32 %x to i8
659 %x.321 = lshr i32 %x, 8
660 %x.1 = trunc i32 %x.321 to i8
661 %y.0 = trunc i32 %y to i8
662 %y.321 = lshr i32 %y, 8
663 %y.1 = trunc i32 %y.321 to i8
664 %c.0 = icmp ne i8 %x.0, %y.0
665 %c.1 = icmp ne i8 %x.1, %y.1
666 %c.10 = or i1 %c.0, %c.1
670 define i1 @ne_210(i32 %x, i32 %y) {
671 ; CHECK-LABEL: @ne_210(
672 ; CHECK-NEXT: [[TMP1:%.*]] = trunc i32 [[X:%.*]] to i24
673 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[Y:%.*]] to i24
674 ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i24 [[TMP1]], [[TMP2]]
675 ; CHECK-NEXT: ret i1 [[TMP3]]
677 %x.0 = trunc i32 %x to i8
678 %x.321 = lshr i32 %x, 8
679 %x.1 = trunc i32 %x.321 to i8
680 %x.32 = lshr i32 %x, 16
681 %x.2 = trunc i32 %x.32 to i8
682 %y.0 = trunc i32 %y to i8
683 %y.321 = lshr i32 %y, 8
684 %y.1 = trunc i32 %y.321 to i8
685 %y.32 = lshr i32 %y, 16
686 %y.2 = trunc i32 %y.32 to i8
687 %c.0 = icmp ne i8 %x.0, %y.0
688 %c.1 = icmp ne i8 %x.1, %y.1
689 %c.2 = icmp ne i8 %x.2, %y.2
690 %c.10 = or i1 %c.0, %c.1
691 %c.210 = or i1 %c.2, %c.10
695 define i1 @ne_3210(i32 %x, i32 %y) {
696 ; CHECK-LABEL: @ne_3210(
697 ; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i32 [[X:%.*]], [[Y:%.*]]
698 ; CHECK-NEXT: ret i1 [[TMP1]]
700 %x.0 = trunc i32 %x to i8
701 %x.321 = lshr i32 %x, 8
702 %x.1 = trunc i32 %x.321 to i8
703 %x.32 = lshr i32 %x, 16
704 %x.2 = trunc i32 %x.32 to i8
705 %x.3.ext = lshr i32 %x, 24
706 %x.3 = trunc i32 %x.3.ext to i8
707 %y.0 = trunc i32 %y to i8
708 %y.321 = lshr i32 %y, 8
709 %y.1 = trunc i32 %y.321 to i8
710 %y.32 = lshr i32 %y, 16
711 %y.2 = trunc i32 %y.32 to i8
712 %y.3.ext = lshr i32 %y, 24
713 %y.3 = trunc i32 %y.3.ext to i8
714 %c.0 = icmp ne i8 %x.0, %y.0
715 %c.1 = icmp ne i8 %x.1, %y.1
716 %c.2 = icmp ne i8 %x.2, %y.2
717 %c.3 = icmp ne i8 %x.3, %y.3
718 %c.10 = or i1 %c.0, %c.1
719 %c.210 = or i1 %c.2, %c.10
720 %c.3210 = or i1 %c.3, %c.210
724 define i1 @ne_21(i32 %x, i32 %y) {
725 ; CHECK-LABEL: @ne_21(
726 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[X:%.*]], 8
727 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[TMP1]] to i16
728 ; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[Y:%.*]], 8
729 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i32 [[TMP3]] to i16
730 ; CHECK-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP2]], [[TMP4]]
731 ; CHECK-NEXT: ret i1 [[TMP5]]
733 %x.321 = lshr i32 %x, 8
734 %x.1 = trunc i32 %x.321 to i8
735 %x.32 = lshr i32 %x, 16
736 %x.2 = trunc i32 %x.32 to i8
737 %y.321 = lshr i32 %y, 8
738 %y.1 = trunc i32 %y.321 to i8
739 %y.32 = lshr i32 %y, 16
740 %y.2 = trunc i32 %y.32 to i8
741 %c.1 = icmp ne i8 %x.1, %y.1
742 %c.2 = icmp ne i8 %x.2, %y.2
743 %c.210 = or i1 %c.2, %c.1
747 ; Test commuted variants of ne_21.
749 define i1 @ne_21_comm_or(i32 %x, i32 %y) {
750 ; CHECK-LABEL: @ne_21_comm_or(
751 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[X:%.*]], 8
752 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[TMP1]] to i16
753 ; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[Y:%.*]], 8
754 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i32 [[TMP3]] to i16
755 ; CHECK-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP2]], [[TMP4]]
756 ; CHECK-NEXT: ret i1 [[TMP5]]
758 %x.321 = lshr i32 %x, 8
759 %x.1 = trunc i32 %x.321 to i8
760 %x.32 = lshr i32 %x, 16
761 %x.2 = trunc i32 %x.32 to i8
762 %y.321 = lshr i32 %y, 8
763 %y.1 = trunc i32 %y.321 to i8
764 %y.32 = lshr i32 %y, 16
765 %y.2 = trunc i32 %y.32 to i8
766 %c.1 = icmp ne i8 %x.1, %y.1
767 %c.2 = icmp ne i8 %x.2, %y.2
768 %c.210 = or i1 %c.1, %c.2
772 define i1 @ne_21_comm_ne(i32 %x, i32 %y) {
773 ; CHECK-LABEL: @ne_21_comm_ne(
774 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[Y:%.*]], 8
775 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[TMP1]] to i16
776 ; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[X:%.*]], 8
777 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i32 [[TMP3]] to i16
778 ; CHECK-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP2]], [[TMP4]]
779 ; CHECK-NEXT: ret i1 [[TMP5]]
781 %x.321 = lshr i32 %x, 8
782 %x.1 = trunc i32 %x.321 to i8
783 %x.32 = lshr i32 %x, 16
784 %x.2 = trunc i32 %x.32 to i8
785 %y.321 = lshr i32 %y, 8
786 %y.1 = trunc i32 %y.321 to i8
787 %y.32 = lshr i32 %y, 16
788 %y.2 = trunc i32 %y.32 to i8
789 %c.1 = icmp ne i8 %x.1, %y.1
790 %c.2 = icmp ne i8 %y.2, %x.2
791 %c.210 = or i1 %c.2, %c.1
795 define i1 @ne_21_comm_ne2(i32 %x, i32 %y) {
796 ; CHECK-LABEL: @ne_21_comm_ne2(
797 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i32 [[X:%.*]], 8
798 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i32 [[TMP1]] to i16
799 ; CHECK-NEXT: [[TMP3:%.*]] = lshr i32 [[Y:%.*]], 8
800 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i32 [[TMP3]] to i16
801 ; CHECK-NEXT: [[TMP5:%.*]] = icmp ne i16 [[TMP2]], [[TMP4]]
802 ; CHECK-NEXT: ret i1 [[TMP5]]
804 %x.321 = lshr i32 %x, 8
805 %x.1 = trunc i32 %x.321 to i8
806 %x.32 = lshr i32 %x, 16
807 %x.2 = trunc i32 %x.32 to i8
808 %y.321 = lshr i32 %y, 8
809 %y.1 = trunc i32 %y.321 to i8
810 %y.32 = lshr i32 %y, 16
811 %y.2 = trunc i32 %y.32 to i8
812 %c.1 = icmp ne i8 %y.1, %x.1
813 %c.2 = icmp ne i8 %x.2, %y.2
814 %c.210 = or i1 %c.2, %c.1
818 ; Test vector variant.
820 define <2x i1> @ne_21_vector(<2x i32> %x, <2x i32> %y) {
821 ; CHECK-LABEL: @ne_21_vector(
822 ; CHECK-NEXT: [[TMP1:%.*]] = lshr <2 x i32> [[X:%.*]], <i32 8, i32 8>
823 ; CHECK-NEXT: [[TMP2:%.*]] = trunc <2 x i32> [[TMP1]] to <2 x i16>
824 ; CHECK-NEXT: [[TMP3:%.*]] = lshr <2 x i32> [[Y:%.*]], <i32 8, i32 8>
825 ; CHECK-NEXT: [[TMP4:%.*]] = trunc <2 x i32> [[TMP3]] to <2 x i16>
826 ; CHECK-NEXT: [[TMP5:%.*]] = icmp ne <2 x i16> [[TMP2]], [[TMP4]]
827 ; CHECK-NEXT: ret <2 x i1> [[TMP5]]
829 %x.321 = lshr <2x i32> %x, <i32 8, i32 8>
830 %x.1 = trunc <2x i32> %x.321 to <2x i8>
831 %x.32 = lshr <2x i32> %x, <i32 16, i32 16>
832 %x.2 = trunc <2x i32> %x.32 to <2x i8>
833 %y.321 = lshr <2x i32> %y, <i32 8, i32 8>
834 %y.1 = trunc <2x i32> %y.321 to <2x i8>
835 %y.32 = lshr <2x i32> %y, <i32 16, i32 16>
836 %y.2 = trunc <2x i32> %y.32 to <2x i8>
837 %c.1 = icmp ne <2x i8> %x.1, %y.1
838 %c.2 = icmp ne <2x i8> %x.2, %y.2
839 %c.210 = or <2x i1> %c.2, %c.1
843 ; Test irregular bit widths. This also tests the case where
844 ; all the involved bit widths or offsets are different.
846 define i1 @ne_irregular_bit_widths(i31 %x, i31 %y) {
847 ; CHECK-LABEL: @ne_irregular_bit_widths(
848 ; CHECK-NEXT: [[TMP1:%.*]] = lshr i31 [[X:%.*]], 7
849 ; CHECK-NEXT: [[TMP2:%.*]] = trunc i31 [[TMP1]] to i11
850 ; CHECK-NEXT: [[TMP3:%.*]] = lshr i31 [[Y:%.*]], 7
851 ; CHECK-NEXT: [[TMP4:%.*]] = trunc i31 [[TMP3]] to i11
852 ; CHECK-NEXT: [[TMP5:%.*]] = icmp ne i11 [[TMP2]], [[TMP4]]
853 ; CHECK-NEXT: ret i1 [[TMP5]]
855 %x.321 = lshr i31 %x, 7
856 %x.1 = trunc i31 %x.321 to i6
857 %x.32 = lshr i31 %x, 13
858 %x.2 = trunc i31 %x.32 to i5
859 %y.321 = lshr i31 %y, 7
860 %y.1 = trunc i31 %y.321 to i6
861 %y.32 = lshr i31 %y, 13
862 %y.2 = trunc i31 %y.32 to i5
863 %c.1 = icmp ne i6 %x.1, %y.1
864 %c.2 = icmp ne i5 %x.2, %y.2
865 %c.210 = or i1 %c.2, %c.1
869 ; Test variants with extra uses.
871 define i1 @ne_21_extra_use_lshr(i32 %x, i32 %y) {
872 ; CHECK-LABEL: @ne_21_extra_use_lshr(
873 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
874 ; CHECK-NEXT: call void @use.i32(i32 [[X_321]])
875 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
876 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
877 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
878 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
879 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
880 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
881 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
882 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
883 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
884 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_1]], [[C_2]]
885 ; CHECK-NEXT: ret i1 [[C_210]]
887 %x.321 = lshr i32 %x, 8
888 call void @use.i32(i32 %x.321)
889 %x.1 = trunc i32 %x.321 to i8
890 %x.32 = lshr i32 %x, 16
891 %x.2 = trunc i32 %x.32 to i8
892 %y.321 = lshr i32 %y, 8
893 %y.1 = trunc i32 %y.321 to i8
894 %y.32 = lshr i32 %y, 16
895 %y.2 = trunc i32 %y.32 to i8
896 %c.1 = icmp ne i8 %x.1, %y.1
897 %c.2 = icmp ne i8 %x.2, %y.2
898 %c.210 = or i1 %c.1, %c.2
902 define i1 @ne_21_extra_use_trunc(i32 %x, i32 %y) {
903 ; CHECK-LABEL: @ne_21_extra_use_trunc(
904 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
905 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
906 ; CHECK-NEXT: call void @use.i8(i8 [[X_1]])
907 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
908 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
909 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
910 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
911 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
912 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
913 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
914 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
915 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_1]], [[C_2]]
916 ; CHECK-NEXT: ret i1 [[C_210]]
918 %x.321 = lshr i32 %x, 8
919 %x.1 = trunc i32 %x.321 to i8
920 call void @use.i8(i8 %x.1)
921 %x.32 = lshr i32 %x, 16
922 %x.2 = trunc i32 %x.32 to i8
923 %y.321 = lshr i32 %y, 8
924 %y.1 = trunc i32 %y.321 to i8
925 %y.32 = lshr i32 %y, 16
926 %y.2 = trunc i32 %y.32 to i8
927 %c.1 = icmp ne i8 %x.1, %y.1
928 %c.2 = icmp ne i8 %x.2, %y.2
929 %c.210 = or i1 %c.1, %c.2
933 define i1 @ne_21_extra_use_ne1(i32 %x, i32 %y) {
934 ; CHECK-LABEL: @ne_21_extra_use_ne1(
935 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
936 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
937 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
938 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
939 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
940 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
941 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
942 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
943 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
944 ; CHECK-NEXT: call void @use.i1(i1 [[C_1]])
945 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
946 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_1]], [[C_2]]
947 ; CHECK-NEXT: ret i1 [[C_210]]
949 %x.321 = lshr i32 %x, 8
950 %x.1 = trunc i32 %x.321 to i8
951 %x.32 = lshr i32 %x, 16
952 %x.2 = trunc i32 %x.32 to i8
953 %y.321 = lshr i32 %y, 8
954 %y.1 = trunc i32 %y.321 to i8
955 %y.32 = lshr i32 %y, 16
956 %y.2 = trunc i32 %y.32 to i8
957 %c.1 = icmp ne i8 %x.1, %y.1
958 call void @use.i1(i1 %c.1)
959 %c.2 = icmp ne i8 %x.2, %y.2
960 %c.210 = or i1 %c.1, %c.2
964 define i1 @ne_21_extra_use_ne2(i32 %x, i32 %y) {
965 ; CHECK-LABEL: @ne_21_extra_use_ne2(
966 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
967 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
968 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
969 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
970 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
971 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
972 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
973 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
974 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
975 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
976 ; CHECK-NEXT: call void @use.i1(i1 [[C_2]])
977 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_1]], [[C_2]]
978 ; CHECK-NEXT: ret i1 [[C_210]]
980 %x.321 = lshr i32 %x, 8
981 %x.1 = trunc i32 %x.321 to i8
982 %x.32 = lshr i32 %x, 16
983 %x.2 = trunc i32 %x.32 to i8
984 %y.321 = lshr i32 %y, 8
985 %y.1 = trunc i32 %y.321 to i8
986 %y.32 = lshr i32 %y, 16
987 %y.2 = trunc i32 %y.32 to i8
988 %c.1 = icmp ne i8 %x.1, %y.1
989 %c.2 = icmp ne i8 %x.2, %y.2
990 call void @use.i1(i1 %c.2)
991 %c.210 = or i1 %c.1, %c.2
997 define i1 @ne_21_wrong_op1(i32 %x, i32 %y, i32 %z) {
998 ; CHECK-LABEL: @ne_21_wrong_op1(
999 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[Z:%.*]], 8
1000 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
1001 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X:%.*]], 16
1002 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
1003 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
1004 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
1005 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
1006 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
1007 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
1008 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
1009 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_2]], [[C_1]]
1010 ; CHECK-NEXT: ret i1 [[C_210]]
1012 %x.321 = lshr i32 %z, 8
1013 %x.1 = trunc i32 %x.321 to i8
1014 %x.32 = lshr i32 %x, 16
1015 %x.2 = trunc i32 %x.32 to i8
1016 %y.321 = lshr i32 %y, 8
1017 %y.1 = trunc i32 %y.321 to i8
1018 %y.32 = lshr i32 %y, 16
1019 %y.2 = trunc i32 %y.32 to i8
1020 %c.1 = icmp ne i8 %x.1, %y.1
1021 %c.2 = icmp ne i8 %x.2, %y.2
1022 %c.210 = or i1 %c.2, %c.1
1026 define i1 @ne_21_wrong_op2(i32 %x, i32 %y, i32 %z) {
1027 ; CHECK-LABEL: @ne_21_wrong_op2(
1028 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
1029 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
1030 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[Z:%.*]], 16
1031 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
1032 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
1033 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
1034 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
1035 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
1036 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
1037 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
1038 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_2]], [[C_1]]
1039 ; CHECK-NEXT: ret i1 [[C_210]]
1041 %x.321 = lshr i32 %x, 8
1042 %x.1 = trunc i32 %x.321 to i8
1043 %x.32 = lshr i32 %z, 16
1044 %x.2 = trunc i32 %x.32 to i8
1045 %y.321 = lshr i32 %y, 8
1046 %y.1 = trunc i32 %y.321 to i8
1047 %y.32 = lshr i32 %y, 16
1048 %y.2 = trunc i32 %y.32 to i8
1049 %c.1 = icmp ne i8 %x.1, %y.1
1050 %c.2 = icmp ne i8 %x.2, %y.2
1051 %c.210 = or i1 %c.2, %c.1
1055 define i1 @ne_21_wrong_op3(i32 %x, i32 %y, i32 %z) {
1056 ; CHECK-LABEL: @ne_21_wrong_op3(
1057 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
1058 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
1059 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
1060 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
1061 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Z:%.*]], 8
1062 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
1063 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y:%.*]], 16
1064 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
1065 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
1066 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
1067 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_2]], [[C_1]]
1068 ; CHECK-NEXT: ret i1 [[C_210]]
1070 %x.321 = lshr i32 %x, 8
1071 %x.1 = trunc i32 %x.321 to i8
1072 %x.32 = lshr i32 %x, 16
1073 %x.2 = trunc i32 %x.32 to i8
1074 %y.321 = lshr i32 %z, 8
1075 %y.1 = trunc i32 %y.321 to i8
1076 %y.32 = lshr i32 %y, 16
1077 %y.2 = trunc i32 %y.32 to i8
1078 %c.1 = icmp ne i8 %x.1, %y.1
1079 %c.2 = icmp ne i8 %x.2, %y.2
1080 %c.210 = or i1 %c.2, %c.1
1084 define i1 @ne_21_wrong_op4(i32 %x, i32 %y, i32 %z) {
1085 ; CHECK-LABEL: @ne_21_wrong_op4(
1086 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
1087 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
1088 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
1089 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
1090 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
1091 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
1092 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Z:%.*]], 16
1093 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
1094 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
1095 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
1096 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_2]], [[C_1]]
1097 ; CHECK-NEXT: ret i1 [[C_210]]
1099 %x.321 = lshr i32 %x, 8
1100 %x.1 = trunc i32 %x.321 to i8
1101 %x.32 = lshr i32 %x, 16
1102 %x.2 = trunc i32 %x.32 to i8
1103 %y.321 = lshr i32 %y, 8
1104 %y.1 = trunc i32 %y.321 to i8
1105 %y.32 = lshr i32 %z, 16
1106 %y.2 = trunc i32 %y.32 to i8
1107 %c.1 = icmp ne i8 %x.1, %y.1
1108 %c.2 = icmp ne i8 %x.2, %y.2
1109 %c.210 = or i1 %c.2, %c.1
1113 define i1 @ne_21_wrong_shift1(i32 %x, i32 %y) {
1114 ; CHECK-LABEL: @ne_21_wrong_shift1(
1115 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
1116 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
1117 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
1118 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
1119 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 7
1120 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
1121 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
1122 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
1123 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
1124 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
1125 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_2]], [[C_1]]
1126 ; CHECK-NEXT: ret i1 [[C_210]]
1128 %x.321 = lshr i32 %x, 8
1129 %x.1 = trunc i32 %x.321 to i8
1130 %x.32 = lshr i32 %x, 16
1131 %x.2 = trunc i32 %x.32 to i8
1132 %y.321 = lshr i32 %y, 7
1133 %y.1 = trunc i32 %y.321 to i8
1134 %y.32 = lshr i32 %y, 16
1135 %y.2 = trunc i32 %y.32 to i8
1136 %c.1 = icmp ne i8 %x.1, %y.1
1137 %c.2 = icmp ne i8 %x.2, %y.2
1138 %c.210 = or i1 %c.2, %c.1
1142 define i1 @ne_21_wrong_shift2(i32 %x, i32 %y) {
1143 ; CHECK-LABEL: @ne_21_wrong_shift2(
1144 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
1145 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
1146 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
1147 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
1148 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
1149 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
1150 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 15
1151 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
1152 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
1153 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
1154 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_2]], [[C_1]]
1155 ; CHECK-NEXT: ret i1 [[C_210]]
1157 %x.321 = lshr i32 %x, 8
1158 %x.1 = trunc i32 %x.321 to i8
1159 %x.32 = lshr i32 %x, 16
1160 %x.2 = trunc i32 %x.32 to i8
1161 %y.321 = lshr i32 %y, 8
1162 %y.1 = trunc i32 %y.321 to i8
1163 %y.32 = lshr i32 %y, 15
1164 %y.2 = trunc i32 %y.32 to i8
1165 %c.1 = icmp ne i8 %x.1, %y.1
1166 %c.2 = icmp ne i8 %x.2, %y.2
1167 %c.210 = or i1 %c.2, %c.1
1171 define i1 @ne_21_not_adjacent(i32 %x, i32 %y) {
1172 ; CHECK-LABEL: @ne_21_not_adjacent(
1173 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
1174 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
1175 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 17
1176 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
1177 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
1178 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
1179 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 17
1180 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
1181 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
1182 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i8 [[X_2]], [[Y_2]]
1183 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_2]], [[C_1]]
1184 ; CHECK-NEXT: ret i1 [[C_210]]
1186 %x.321 = lshr i32 %x, 8
1187 %x.1 = trunc i32 %x.321 to i8
1188 %x.32 = lshr i32 %x, 17
1189 %x.2 = trunc i32 %x.32 to i8
1190 %y.321 = lshr i32 %y, 8
1191 %y.1 = trunc i32 %y.321 to i8
1192 %y.32 = lshr i32 %y, 17
1193 %y.2 = trunc i32 %y.32 to i8
1194 %c.1 = icmp ne i8 %x.1, %y.1
1195 %c.2 = icmp ne i8 %x.2, %y.2
1196 %c.210 = or i1 %c.2, %c.1
1200 define i1 @ne_shift_in_zeros(i32 %x, i32 %y) {
1201 ; CHECK-LABEL: @ne_shift_in_zeros(
1202 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
1203 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
1204 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
1205 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i24
1206 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
1207 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
1208 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
1209 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i24
1210 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
1211 ; CHECK-NEXT: [[C_2:%.*]] = icmp ne i24 [[X_2]], [[Y_2]]
1212 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_2]], [[C_1]]
1213 ; CHECK-NEXT: ret i1 [[C_210]]
1215 %x.321 = lshr i32 %x, 8
1216 %x.1 = trunc i32 %x.321 to i8
1217 %x.32 = lshr i32 %x, 16
1218 %x.2 = trunc i32 %x.32 to i24
1219 %y.321 = lshr i32 %y, 8
1220 %y.1 = trunc i32 %y.321 to i8
1221 %y.32 = lshr i32 %y, 16
1222 %y.2 = trunc i32 %y.32 to i24
1223 %c.1 = icmp ne i8 %x.1, %y.1
1224 %c.2 = icmp ne i24 %x.2, %y.2
1225 %c.210 = or i1 %c.2, %c.1
1229 define i1 @ne_21_wrong_pred1(i32 %x, i32 %y) {
1230 ; CHECK-LABEL: @ne_21_wrong_pred1(
1231 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
1232 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
1233 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
1234 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
1235 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
1236 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
1237 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
1238 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
1239 ; CHECK-NEXT: [[C_1:%.*]] = icmp ne i8 [[X_1]], [[Y_1]]
1240 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
1241 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_2]], [[C_1]]
1242 ; CHECK-NEXT: ret i1 [[C_210]]
1244 %x.321 = lshr i32 %x, 8
1245 %x.1 = trunc i32 %x.321 to i8
1246 %x.32 = lshr i32 %x, 16
1247 %x.2 = trunc i32 %x.32 to i8
1248 %y.321 = lshr i32 %y, 8
1249 %y.1 = trunc i32 %y.321 to i8
1250 %y.32 = lshr i32 %y, 16
1251 %y.2 = trunc i32 %y.32 to i8
1252 %c.1 = icmp ne i8 %x.1, %y.1
1253 %c.2 = icmp eq i8 %x.2, %y.2
1254 %c.210 = or i1 %c.2, %c.1
1258 define i1 @ne_21_wrong_pred2(i32 %x, i32 %y) {
1259 ; CHECK-LABEL: @ne_21_wrong_pred2(
1260 ; CHECK-NEXT: [[X_321:%.*]] = lshr i32 [[X:%.*]], 8
1261 ; CHECK-NEXT: [[X_1:%.*]] = trunc i32 [[X_321]] to i8
1262 ; CHECK-NEXT: [[X_32:%.*]] = lshr i32 [[X]], 16
1263 ; CHECK-NEXT: [[X_2:%.*]] = trunc i32 [[X_32]] to i8
1264 ; CHECK-NEXT: [[Y_321:%.*]] = lshr i32 [[Y:%.*]], 8
1265 ; CHECK-NEXT: [[Y_1:%.*]] = trunc i32 [[Y_321]] to i8
1266 ; CHECK-NEXT: [[Y_32:%.*]] = lshr i32 [[Y]], 16
1267 ; CHECK-NEXT: [[Y_2:%.*]] = trunc i32 [[Y_32]] to i8
1268 ; CHECK-NEXT: [[C_1:%.*]] = icmp eq i8 [[X_1]], [[Y_1]]
1269 ; CHECK-NEXT: [[C_2:%.*]] = icmp eq i8 [[X_2]], [[Y_2]]
1270 ; CHECK-NEXT: [[C_210:%.*]] = or i1 [[C_2]], [[C_1]]
1271 ; CHECK-NEXT: ret i1 [[C_210]]
1273 %x.321 = lshr i32 %x, 8
1274 %x.1 = trunc i32 %x.321 to i8
1275 %x.32 = lshr i32 %x, 16
1276 %x.2 = trunc i32 %x.32 to i8
1277 %y.321 = lshr i32 %y, 8
1278 %y.1 = trunc i32 %y.321 to i8
1279 %y.32 = lshr i32 %y, 16
1280 %y.2 = trunc i32 %y.32 to i8
1281 %c.1 = icmp eq i8 %x.1, %y.1
1282 %c.2 = icmp eq i8 %x.2, %y.2
1283 %c.210 = or i1 %c.2, %c.1