1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -instsimplify -S | FileCheck %s
3
4; There are 10 * 10 combinations of icmp predicates that can be AND'd together.
5; The majority of these can be simplified to always false or just one of the icmps.
6
7define i1 @eq_eq(i8 %a, i8 %b) {
8; CHECK-LABEL: @eq_eq(
9; CHECK-NEXT:    [[CMP1:%.*]] = icmp eq i8 %a, %b
10; CHECK-NEXT:    ret i1 [[CMP1]]
11;
12  %cmp1 = icmp eq i8 %a, %b
13  %cmp2 = icmp eq i8 %a, %b
14  %and = and i1 %cmp1, %cmp2
15  ret i1 %and
16}
17
18define i1 @eq_ne(i8 %a, i8 %b) {
19; CHECK-LABEL: @eq_ne(
20; CHECK-NEXT:    ret i1 false
21;
22  %cmp1 = icmp eq i8 %a, %b
23  %cmp2 = icmp ne i8 %a, %b
24  %and = and i1 %cmp1, %cmp2
25  ret i1 %and
26}
27
28define i1 @eq_sge(i8 %a, i8 %b) {
29; CHECK-LABEL: @eq_sge(
30; CHECK-NEXT:    [[CMP1:%.*]] = icmp eq i8 %a, %b
31; CHECK-NEXT:    ret i1 [[CMP1]]
32;
33  %cmp1 = icmp eq i8 %a, %b
34  %cmp2 = icmp sge i8 %a, %b
35  %and = and i1 %cmp1, %cmp2
36  ret i1 %and
37}
38
39define i1 @eq_sgt(i8 %a, i8 %b) {
40; CHECK-LABEL: @eq_sgt(
41; CHECK-NEXT:    ret i1 false
42;
43  %cmp1 = icmp eq i8 %a, %b
44  %cmp2 = icmp sgt i8 %a, %b
45  %and = and i1 %cmp1, %cmp2
46  ret i1 %and
47}
48
49define i1 @eq_sle(i8 %a, i8 %b) {
50; CHECK-LABEL: @eq_sle(
51; CHECK-NEXT:    [[CMP1:%.*]] = icmp eq i8 %a, %b
52; CHECK-NEXT:    ret i1 [[CMP1]]
53;
54  %cmp1 = icmp eq i8 %a, %b
55  %cmp2 = icmp sle i8 %a, %b
56  %and = and i1 %cmp1, %cmp2
57  ret i1 %and
58}
59
60define i1 @eq_slt(i8 %a, i8 %b) {
61; CHECK-LABEL: @eq_slt(
62; CHECK-NEXT:    ret i1 false
63;
64  %cmp1 = icmp eq i8 %a, %b
65  %cmp2 = icmp slt i8 %a, %b
66  %and = and i1 %cmp1, %cmp2
67  ret i1 %and
68}
69
70define i1 @eq_uge(i8 %a, i8 %b) {
71; CHECK-LABEL: @eq_uge(
72; CHECK-NEXT:    [[CMP1:%.*]] = icmp eq i8 %a, %b
73; CHECK-NEXT:    ret i1 [[CMP1]]
74;
75  %cmp1 = icmp eq i8 %a, %b
76  %cmp2 = icmp uge i8 %a, %b
77  %and = and i1 %cmp1, %cmp2
78  ret i1 %and
79}
80
81define i1 @eq_ugt(i8 %a, i8 %b) {
82; CHECK-LABEL: @eq_ugt(
83; CHECK-NEXT:    ret i1 false
84;
85  %cmp1 = icmp eq i8 %a, %b
86  %cmp2 = icmp ugt i8 %a, %b
87  %and = and i1 %cmp1, %cmp2
88  ret i1 %and
89}
90
91define i1 @eq_ule(i8 %a, i8 %b) {
92; CHECK-LABEL: @eq_ule(
93; CHECK-NEXT:    [[CMP1:%.*]] = icmp eq i8 %a, %b
94; CHECK-NEXT:    ret i1 [[CMP1]]
95;
96  %cmp1 = icmp eq i8 %a, %b
97  %cmp2 = icmp ule i8 %a, %b
98  %and = and i1 %cmp1, %cmp2
99  ret i1 %and
100}
101
102define i1 @eq_ult(i8 %a, i8 %b) {
103; CHECK-LABEL: @eq_ult(
104; CHECK-NEXT:    ret i1 false
105;
106  %cmp1 = icmp eq i8 %a, %b
107  %cmp2 = icmp ult i8 %a, %b
108  %and = and i1 %cmp1, %cmp2
109  ret i1 %and
110}
111
112;
113
114define i1 @ne_eq(i8 %a, i8 %b) {
115; CHECK-LABEL: @ne_eq(
116; CHECK-NEXT:    ret i1 false
117;
118  %cmp1 = icmp ne i8 %a, %b
119  %cmp2 = icmp eq i8 %a, %b
120  %and = and i1 %cmp1, %cmp2
121  ret i1 %and
122}
123
124define i1 @ne_ne(i8 %a, i8 %b) {
125; CHECK-LABEL: @ne_ne(
126; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne i8 %a, %b
127; CHECK-NEXT:    ret i1 [[CMP1]]
128;
129  %cmp1 = icmp ne i8 %a, %b
130  %cmp2 = icmp ne i8 %a, %b
131  %and = and i1 %cmp1, %cmp2
132  ret i1 %and
133}
134
135define i1 @ne_sge(i8 %a, i8 %b) {
136; CHECK-LABEL: @ne_sge(
137; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne i8 %a, %b
138; CHECK-NEXT:    [[CMP2:%.*]] = icmp sge i8 %a, %b
139; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
140; CHECK-NEXT:    ret i1 [[AND]]
141;
142  %cmp1 = icmp ne i8 %a, %b
143  %cmp2 = icmp sge i8 %a, %b
144  %and = and i1 %cmp1, %cmp2
145  ret i1 %and
146}
147
148define i1 @ne_sgt(i8 %a, i8 %b) {
149; CHECK-LABEL: @ne_sgt(
150; CHECK-NEXT:    [[CMP2:%.*]] = icmp sgt i8 %a, %b
151; CHECK-NEXT:    ret i1 [[CMP2]]
152;
153  %cmp1 = icmp ne i8 %a, %b
154  %cmp2 = icmp sgt i8 %a, %b
155  %and = and i1 %cmp1, %cmp2
156  ret i1 %and
157}
158
159define i1 @ne_sle(i8 %a, i8 %b) {
160; CHECK-LABEL: @ne_sle(
161; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne i8 %a, %b
162; CHECK-NEXT:    [[CMP2:%.*]] = icmp sle i8 %a, %b
163; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
164; CHECK-NEXT:    ret i1 [[AND]]
165;
166  %cmp1 = icmp ne i8 %a, %b
167  %cmp2 = icmp sle i8 %a, %b
168  %and = and i1 %cmp1, %cmp2
169  ret i1 %and
170}
171
172define i1 @ne_slt(i8 %a, i8 %b) {
173; CHECK-LABEL: @ne_slt(
174; CHECK-NEXT:    [[CMP2:%.*]] = icmp slt i8 %a, %b
175; CHECK-NEXT:    ret i1 [[CMP2]]
176;
177  %cmp1 = icmp ne i8 %a, %b
178  %cmp2 = icmp slt i8 %a, %b
179  %and = and i1 %cmp1, %cmp2
180  ret i1 %and
181}
182
183define i1 @ne_uge(i8 %a, i8 %b) {
184; CHECK-LABEL: @ne_uge(
185; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne i8 %a, %b
186; CHECK-NEXT:    [[CMP2:%.*]] = icmp uge i8 %a, %b
187; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
188; CHECK-NEXT:    ret i1 [[AND]]
189;
190  %cmp1 = icmp ne i8 %a, %b
191  %cmp2 = icmp uge i8 %a, %b
192  %and = and i1 %cmp1, %cmp2
193  ret i1 %and
194}
195
196define i1 @ne_ugt(i8 %a, i8 %b) {
197; CHECK-LABEL: @ne_ugt(
198; CHECK-NEXT:    [[CMP2:%.*]] = icmp ugt i8 %a, %b
199; CHECK-NEXT:    ret i1 [[CMP2]]
200;
201  %cmp1 = icmp ne i8 %a, %b
202  %cmp2 = icmp ugt i8 %a, %b
203  %and = and i1 %cmp1, %cmp2
204  ret i1 %and
205}
206
207define i1 @ne_ule(i8 %a, i8 %b) {
208; CHECK-LABEL: @ne_ule(
209; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne i8 %a, %b
210; CHECK-NEXT:    [[CMP2:%.*]] = icmp ule i8 %a, %b
211; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
212; CHECK-NEXT:    ret i1 [[AND]]
213;
214  %cmp1 = icmp ne i8 %a, %b
215  %cmp2 = icmp ule i8 %a, %b
216  %and = and i1 %cmp1, %cmp2
217  ret i1 %and
218}
219
220define i1 @ne_ult(i8 %a, i8 %b) {
221; CHECK-LABEL: @ne_ult(
222; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i8 %a, %b
223; CHECK-NEXT:    ret i1 [[CMP2]]
224;
225  %cmp1 = icmp ne i8 %a, %b
226  %cmp2 = icmp ult i8 %a, %b
227  %and = and i1 %cmp1, %cmp2
228  ret i1 %and
229}
230
231;
232
233define i1 @sge_eq(i8 %a, i8 %b) {
234; CHECK-LABEL: @sge_eq(
235; CHECK-NEXT:    [[CMP2:%.*]] = icmp eq i8 %a, %b
236; CHECK-NEXT:    ret i1 [[CMP2]]
237;
238  %cmp1 = icmp sge i8 %a, %b
239  %cmp2 = icmp eq i8 %a, %b
240  %and = and i1 %cmp1, %cmp2
241  ret i1 %and
242}
243
244define i1 @sge_ne(i8 %a, i8 %b) {
245; CHECK-LABEL: @sge_ne(
246; CHECK-NEXT:    [[CMP1:%.*]] = icmp sge i8 %a, %b
247; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne i8 %a, %b
248; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
249; CHECK-NEXT:    ret i1 [[AND]]
250;
251  %cmp1 = icmp sge i8 %a, %b
252  %cmp2 = icmp ne i8 %a, %b
253  %and = and i1 %cmp1, %cmp2
254  ret i1 %and
255}
256
257define i1 @sge_sge(i8 %a, i8 %b) {
258; CHECK-LABEL: @sge_sge(
259; CHECK-NEXT:    [[CMP1:%.*]] = icmp sge i8 %a, %b
260; CHECK-NEXT:    ret i1 [[CMP1]]
261;
262  %cmp1 = icmp sge i8 %a, %b
263  %cmp2 = icmp sge i8 %a, %b
264  %and = and i1 %cmp1, %cmp2
265  ret i1 %and
266}
267
268define i1 @sge_sgt(i8 %a, i8 %b) {
269; CHECK-LABEL: @sge_sgt(
270; CHECK-NEXT:    [[CMP2:%.*]] = icmp sgt i8 %a, %b
271; CHECK-NEXT:    ret i1 [[CMP2]]
272;
273  %cmp1 = icmp sge i8 %a, %b
274  %cmp2 = icmp sgt i8 %a, %b
275  %and = and i1 %cmp1, %cmp2
276  ret i1 %and
277}
278
279define i1 @sge_sle(i8 %a, i8 %b) {
280; CHECK-LABEL: @sge_sle(
281; CHECK-NEXT:    [[CMP1:%.*]] = icmp sge i8 %a, %b
282; CHECK-NEXT:    [[CMP2:%.*]] = icmp sle i8 %a, %b
283; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
284; CHECK-NEXT:    ret i1 [[AND]]
285;
286  %cmp1 = icmp sge i8 %a, %b
287  %cmp2 = icmp sle i8 %a, %b
288  %and = and i1 %cmp1, %cmp2
289  ret i1 %and
290}
291
292define i1 @sge_slt(i8 %a, i8 %b) {
293; CHECK-LABEL: @sge_slt(
294; CHECK-NEXT:    ret i1 false
295;
296  %cmp1 = icmp sge i8 %a, %b
297  %cmp2 = icmp slt i8 %a, %b
298  %and = and i1 %cmp1, %cmp2
299  ret i1 %and
300}
301
302define i1 @sge_uge(i8 %a, i8 %b) {
303; CHECK-LABEL: @sge_uge(
304; CHECK-NEXT:    [[CMP1:%.*]] = icmp sge i8 %a, %b
305; CHECK-NEXT:    [[CMP2:%.*]] = icmp uge i8 %a, %b
306; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
307; CHECK-NEXT:    ret i1 [[AND]]
308;
309  %cmp1 = icmp sge i8 %a, %b
310  %cmp2 = icmp uge i8 %a, %b
311  %and = and i1 %cmp1, %cmp2
312  ret i1 %and
313}
314
315define i1 @sge_ugt(i8 %a, i8 %b) {
316; CHECK-LABEL: @sge_ugt(
317; CHECK-NEXT:    [[CMP1:%.*]] = icmp sge i8 %a, %b
318; CHECK-NEXT:    [[CMP2:%.*]] = icmp ugt i8 %a, %b
319; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
320; CHECK-NEXT:    ret i1 [[AND]]
321;
322  %cmp1 = icmp sge i8 %a, %b
323  %cmp2 = icmp ugt i8 %a, %b
324  %and = and i1 %cmp1, %cmp2
325  ret i1 %and
326}
327
328define i1 @sge_ule(i8 %a, i8 %b) {
329; CHECK-LABEL: @sge_ule(
330; CHECK-NEXT:    [[CMP1:%.*]] = icmp sge i8 %a, %b
331; CHECK-NEXT:    [[CMP2:%.*]] = icmp ule i8 %a, %b
332; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
333; CHECK-NEXT:    ret i1 [[AND]]
334;
335  %cmp1 = icmp sge i8 %a, %b
336  %cmp2 = icmp ule i8 %a, %b
337  %and = and i1 %cmp1, %cmp2
338  ret i1 %and
339}
340
341define i1 @sge_ult(i8 %a, i8 %b) {
342; CHECK-LABEL: @sge_ult(
343; CHECK-NEXT:    [[CMP1:%.*]] = icmp sge i8 %a, %b
344; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i8 %a, %b
345; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
346; CHECK-NEXT:    ret i1 [[AND]]
347;
348  %cmp1 = icmp sge i8 %a, %b
349  %cmp2 = icmp ult i8 %a, %b
350  %and = and i1 %cmp1, %cmp2
351  ret i1 %and
352}
353
354;
355
356define i1 @sgt_eq(i8 %a, i8 %b) {
357; CHECK-LABEL: @sgt_eq(
358; CHECK-NEXT:    ret i1 false
359;
360  %cmp1 = icmp sgt i8 %a, %b
361  %cmp2 = icmp eq i8 %a, %b
362  %and = and i1 %cmp1, %cmp2
363  ret i1 %and
364}
365
366define i1 @sgt_ne(i8 %a, i8 %b) {
367; CHECK-LABEL: @sgt_ne(
368; CHECK-NEXT:    [[CMP1:%.*]] = icmp sgt i8 %a, %b
369; CHECK-NEXT:    ret i1 [[CMP1]]
370;
371  %cmp1 = icmp sgt i8 %a, %b
372  %cmp2 = icmp ne i8 %a, %b
373  %and = and i1 %cmp1, %cmp2
374  ret i1 %and
375}
376
377define i1 @sgt_sge(i8 %a, i8 %b) {
378; CHECK-LABEL: @sgt_sge(
379; CHECK-NEXT:    [[CMP1:%.*]] = icmp sgt i8 %a, %b
380; CHECK-NEXT:    ret i1 [[CMP1]]
381;
382  %cmp1 = icmp sgt i8 %a, %b
383  %cmp2 = icmp sge i8 %a, %b
384  %and = and i1 %cmp1, %cmp2
385  ret i1 %and
386}
387
388define i1 @sgt_sgt(i8 %a, i8 %b) {
389; CHECK-LABEL: @sgt_sgt(
390; CHECK-NEXT:    [[CMP1:%.*]] = icmp sgt i8 %a, %b
391; CHECK-NEXT:    ret i1 [[CMP1]]
392;
393  %cmp1 = icmp sgt i8 %a, %b
394  %cmp2 = icmp sgt i8 %a, %b
395  %and = and i1 %cmp1, %cmp2
396  ret i1 %and
397}
398
399define i1 @sgt_sle(i8 %a, i8 %b) {
400; CHECK-LABEL: @sgt_sle(
401; CHECK-NEXT:    ret i1 false
402;
403  %cmp1 = icmp sgt i8 %a, %b
404  %cmp2 = icmp sle i8 %a, %b
405  %and = and i1 %cmp1, %cmp2
406  ret i1 %and
407}
408
409define i1 @sgt_slt(i8 %a, i8 %b) {
410; CHECK-LABEL: @sgt_slt(
411; CHECK-NEXT:    ret i1 false
412;
413  %cmp1 = icmp sgt i8 %a, %b
414  %cmp2 = icmp slt i8 %a, %b
415  %and = and i1 %cmp1, %cmp2
416  ret i1 %and
417}
418
419define i1 @sgt_uge(i8 %a, i8 %b) {
420; CHECK-LABEL: @sgt_uge(
421; CHECK-NEXT:    [[CMP1:%.*]] = icmp sgt i8 %a, %b
422; CHECK-NEXT:    [[CMP2:%.*]] = icmp uge i8 %a, %b
423; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
424; CHECK-NEXT:    ret i1 [[AND]]
425;
426  %cmp1 = icmp sgt i8 %a, %b
427  %cmp2 = icmp uge i8 %a, %b
428  %and = and i1 %cmp1, %cmp2
429  ret i1 %and
430}
431
432define i1 @sgt_ugt(i8 %a, i8 %b) {
433; CHECK-LABEL: @sgt_ugt(
434; CHECK-NEXT:    [[CMP1:%.*]] = icmp sgt i8 %a, %b
435; CHECK-NEXT:    [[CMP2:%.*]] = icmp ugt i8 %a, %b
436; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
437; CHECK-NEXT:    ret i1 [[AND]]
438;
439  %cmp1 = icmp sgt i8 %a, %b
440  %cmp2 = icmp ugt i8 %a, %b
441  %and = and i1 %cmp1, %cmp2
442  ret i1 %and
443}
444
445define i1 @sgt_ule(i8 %a, i8 %b) {
446; CHECK-LABEL: @sgt_ule(
447; CHECK-NEXT:    [[CMP1:%.*]] = icmp sgt i8 %a, %b
448; CHECK-NEXT:    [[CMP2:%.*]] = icmp ule i8 %a, %b
449; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
450; CHECK-NEXT:    ret i1 [[AND]]
451;
452  %cmp1 = icmp sgt i8 %a, %b
453  %cmp2 = icmp ule i8 %a, %b
454  %and = and i1 %cmp1, %cmp2
455  ret i1 %and
456}
457
458define i1 @sgt_ult(i8 %a, i8 %b) {
459; CHECK-LABEL: @sgt_ult(
460; CHECK-NEXT:    [[CMP1:%.*]] = icmp sgt i8 %a, %b
461; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i8 %a, %b
462; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
463; CHECK-NEXT:    ret i1 [[AND]]
464;
465  %cmp1 = icmp sgt i8 %a, %b
466  %cmp2 = icmp ult i8 %a, %b
467  %and = and i1 %cmp1, %cmp2
468  ret i1 %and
469}
470
471;
472
473define i1 @sle_eq(i8 %a, i8 %b) {
474; CHECK-LABEL: @sle_eq(
475; CHECK-NEXT:    [[CMP2:%.*]] = icmp eq i8 %a, %b
476; CHECK-NEXT:    ret i1 [[CMP2]]
477;
478  %cmp1 = icmp sle i8 %a, %b
479  %cmp2 = icmp eq i8 %a, %b
480  %and = and i1 %cmp1, %cmp2
481  ret i1 %and
482}
483
484define i1 @sle_ne(i8 %a, i8 %b) {
485; CHECK-LABEL: @sle_ne(
486; CHECK-NEXT:    [[CMP1:%.*]] = icmp sle i8 %a, %b
487; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne i8 %a, %b
488; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
489; CHECK-NEXT:    ret i1 [[AND]]
490;
491  %cmp1 = icmp sle i8 %a, %b
492  %cmp2 = icmp ne i8 %a, %b
493  %and = and i1 %cmp1, %cmp2
494  ret i1 %and
495}
496
497define i1 @sle_sge(i8 %a, i8 %b) {
498; CHECK-LABEL: @sle_sge(
499; CHECK-NEXT:    [[CMP1:%.*]] = icmp sle i8 %a, %b
500; CHECK-NEXT:    [[CMP2:%.*]] = icmp sge i8 %a, %b
501; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
502; CHECK-NEXT:    ret i1 [[AND]]
503;
504  %cmp1 = icmp sle i8 %a, %b
505  %cmp2 = icmp sge i8 %a, %b
506  %and = and i1 %cmp1, %cmp2
507  ret i1 %and
508}
509
510define i1 @sle_sgt(i8 %a, i8 %b) {
511; CHECK-LABEL: @sle_sgt(
512; CHECK-NEXT:    ret i1 false
513;
514  %cmp1 = icmp sle i8 %a, %b
515  %cmp2 = icmp sgt i8 %a, %b
516  %and = and i1 %cmp1, %cmp2
517  ret i1 %and
518}
519
520define i1 @sle_sle(i8 %a, i8 %b) {
521; CHECK-LABEL: @sle_sle(
522; CHECK-NEXT:    [[CMP1:%.*]] = icmp sle i8 %a, %b
523; CHECK-NEXT:    ret i1 [[CMP1]]
524;
525  %cmp1 = icmp sle i8 %a, %b
526  %cmp2 = icmp sle i8 %a, %b
527  %and = and i1 %cmp1, %cmp2
528  ret i1 %and
529}
530
531define i1 @sle_slt(i8 %a, i8 %b) {
532; CHECK-LABEL: @sle_slt(
533; CHECK-NEXT:    [[CMP2:%.*]] = icmp slt i8 %a, %b
534; CHECK-NEXT:    ret i1 [[CMP2]]
535;
536  %cmp1 = icmp sle i8 %a, %b
537  %cmp2 = icmp slt i8 %a, %b
538  %and = and i1 %cmp1, %cmp2
539  ret i1 %and
540}
541
542define i1 @sle_uge(i8 %a, i8 %b) {
543; CHECK-LABEL: @sle_uge(
544; CHECK-NEXT:    [[CMP1:%.*]] = icmp sle i8 %a, %b
545; CHECK-NEXT:    [[CMP2:%.*]] = icmp uge i8 %a, %b
546; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
547; CHECK-NEXT:    ret i1 [[AND]]
548;
549  %cmp1 = icmp sle i8 %a, %b
550  %cmp2 = icmp uge i8 %a, %b
551  %and = and i1 %cmp1, %cmp2
552  ret i1 %and
553}
554
555define i1 @sle_ugt(i8 %a, i8 %b) {
556; CHECK-LABEL: @sle_ugt(
557; CHECK-NEXT:    [[CMP1:%.*]] = icmp sle i8 %a, %b
558; CHECK-NEXT:    [[CMP2:%.*]] = icmp ugt i8 %a, %b
559; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
560; CHECK-NEXT:    ret i1 [[AND]]
561;
562  %cmp1 = icmp sle i8 %a, %b
563  %cmp2 = icmp ugt i8 %a, %b
564  %and = and i1 %cmp1, %cmp2
565  ret i1 %and
566}
567
568define i1 @sle_ule(i8 %a, i8 %b) {
569; CHECK-LABEL: @sle_ule(
570; CHECK-NEXT:    [[CMP1:%.*]] = icmp sle i8 %a, %b
571; CHECK-NEXT:    [[CMP2:%.*]] = icmp ule i8 %a, %b
572; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
573; CHECK-NEXT:    ret i1 [[AND]]
574;
575  %cmp1 = icmp sle i8 %a, %b
576  %cmp2 = icmp ule i8 %a, %b
577  %and = and i1 %cmp1, %cmp2
578  ret i1 %and
579}
580
581define i1 @sle_ult(i8 %a, i8 %b) {
582; CHECK-LABEL: @sle_ult(
583; CHECK-NEXT:    [[CMP1:%.*]] = icmp sle i8 %a, %b
584; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i8 %a, %b
585; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
586; CHECK-NEXT:    ret i1 [[AND]]
587;
588  %cmp1 = icmp sle i8 %a, %b
589  %cmp2 = icmp ult i8 %a, %b
590  %and = and i1 %cmp1, %cmp2
591  ret i1 %and
592}
593
594;
595
596define i1 @slt_eq(i8 %a, i8 %b) {
597; CHECK-LABEL: @slt_eq(
598; CHECK-NEXT:    ret i1 false
599;
600  %cmp1 = icmp slt i8 %a, %b
601  %cmp2 = icmp eq i8 %a, %b
602  %and = and i1 %cmp1, %cmp2
603  ret i1 %and
604}
605
606define i1 @slt_ne(i8 %a, i8 %b) {
607; CHECK-LABEL: @slt_ne(
608; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt i8 %a, %b
609; CHECK-NEXT:    ret i1 [[CMP1]]
610;
611  %cmp1 = icmp slt i8 %a, %b
612  %cmp2 = icmp ne i8 %a, %b
613  %and = and i1 %cmp1, %cmp2
614  ret i1 %and
615}
616
617define i1 @slt_sge(i8 %a, i8 %b) {
618; CHECK-LABEL: @slt_sge(
619; CHECK-NEXT:    ret i1 false
620;
621  %cmp1 = icmp slt i8 %a, %b
622  %cmp2 = icmp sge i8 %a, %b
623  %and = and i1 %cmp1, %cmp2
624  ret i1 %and
625}
626
627define i1 @slt_sgt(i8 %a, i8 %b) {
628; CHECK-LABEL: @slt_sgt(
629; CHECK-NEXT:    ret i1 false
630;
631  %cmp1 = icmp slt i8 %a, %b
632  %cmp2 = icmp sgt i8 %a, %b
633  %and = and i1 %cmp1, %cmp2
634  ret i1 %and
635}
636
637define i1 @slt_sle(i8 %a, i8 %b) {
638; CHECK-LABEL: @slt_sle(
639; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt i8 %a, %b
640; CHECK-NEXT:    ret i1 [[CMP1]]
641;
642  %cmp1 = icmp slt i8 %a, %b
643  %cmp2 = icmp sle i8 %a, %b
644  %and = and i1 %cmp1, %cmp2
645  ret i1 %and
646}
647
648define i1 @slt_slt(i8 %a, i8 %b) {
649; CHECK-LABEL: @slt_slt(
650; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt i8 %a, %b
651; CHECK-NEXT:    ret i1 [[CMP1]]
652;
653  %cmp1 = icmp slt i8 %a, %b
654  %cmp2 = icmp slt i8 %a, %b
655  %and = and i1 %cmp1, %cmp2
656  ret i1 %and
657}
658
659define i1 @slt_uge(i8 %a, i8 %b) {
660; CHECK-LABEL: @slt_uge(
661; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt i8 %a, %b
662; CHECK-NEXT:    [[CMP2:%.*]] = icmp uge i8 %a, %b
663; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
664; CHECK-NEXT:    ret i1 [[AND]]
665;
666  %cmp1 = icmp slt i8 %a, %b
667  %cmp2 = icmp uge i8 %a, %b
668  %and = and i1 %cmp1, %cmp2
669  ret i1 %and
670}
671
672define i1 @slt_ugt(i8 %a, i8 %b) {
673; CHECK-LABEL: @slt_ugt(
674; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt i8 %a, %b
675; CHECK-NEXT:    [[CMP2:%.*]] = icmp ugt i8 %a, %b
676; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
677; CHECK-NEXT:    ret i1 [[AND]]
678;
679  %cmp1 = icmp slt i8 %a, %b
680  %cmp2 = icmp ugt i8 %a, %b
681  %and = and i1 %cmp1, %cmp2
682  ret i1 %and
683}
684
685define i1 @slt_ule(i8 %a, i8 %b) {
686; CHECK-LABEL: @slt_ule(
687; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt i8 %a, %b
688; CHECK-NEXT:    [[CMP2:%.*]] = icmp ule i8 %a, %b
689; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
690; CHECK-NEXT:    ret i1 [[AND]]
691;
692  %cmp1 = icmp slt i8 %a, %b
693  %cmp2 = icmp ule i8 %a, %b
694  %and = and i1 %cmp1, %cmp2
695  ret i1 %and
696}
697
698define i1 @slt_ult(i8 %a, i8 %b) {
699; CHECK-LABEL: @slt_ult(
700; CHECK-NEXT:    [[CMP1:%.*]] = icmp slt i8 %a, %b
701; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i8 %a, %b
702; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
703; CHECK-NEXT:    ret i1 [[AND]]
704;
705  %cmp1 = icmp slt i8 %a, %b
706  %cmp2 = icmp ult i8 %a, %b
707  %and = and i1 %cmp1, %cmp2
708  ret i1 %and
709}
710
711;
712
713define i1 @uge_eq(i8 %a, i8 %b) {
714; CHECK-LABEL: @uge_eq(
715; CHECK-NEXT:    [[CMP2:%.*]] = icmp eq i8 %a, %b
716; CHECK-NEXT:    ret i1 [[CMP2]]
717;
718  %cmp1 = icmp uge i8 %a, %b
719  %cmp2 = icmp eq i8 %a, %b
720  %and = and i1 %cmp1, %cmp2
721  ret i1 %and
722}
723
724define i1 @uge_ne(i8 %a, i8 %b) {
725; CHECK-LABEL: @uge_ne(
726; CHECK-NEXT:    [[CMP1:%.*]] = icmp uge i8 %a, %b
727; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne i8 %a, %b
728; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
729; CHECK-NEXT:    ret i1 [[AND]]
730;
731  %cmp1 = icmp uge i8 %a, %b
732  %cmp2 = icmp ne i8 %a, %b
733  %and = and i1 %cmp1, %cmp2
734  ret i1 %and
735}
736
737define i1 @uge_sge(i8 %a, i8 %b) {
738; CHECK-LABEL: @uge_sge(
739; CHECK-NEXT:    [[CMP1:%.*]] = icmp uge i8 %a, %b
740; CHECK-NEXT:    [[CMP2:%.*]] = icmp sge i8 %a, %b
741; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
742; CHECK-NEXT:    ret i1 [[AND]]
743;
744  %cmp1 = icmp uge i8 %a, %b
745  %cmp2 = icmp sge i8 %a, %b
746  %and = and i1 %cmp1, %cmp2
747  ret i1 %and
748}
749
750define i1 @uge_sgt(i8 %a, i8 %b) {
751; CHECK-LABEL: @uge_sgt(
752; CHECK-NEXT:    [[CMP1:%.*]] = icmp uge i8 %a, %b
753; CHECK-NEXT:    [[CMP2:%.*]] = icmp sgt i8 %a, %b
754; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
755; CHECK-NEXT:    ret i1 [[AND]]
756;
757  %cmp1 = icmp uge i8 %a, %b
758  %cmp2 = icmp sgt i8 %a, %b
759  %and = and i1 %cmp1, %cmp2
760  ret i1 %and
761}
762
763define i1 @uge_sle(i8 %a, i8 %b) {
764; CHECK-LABEL: @uge_sle(
765; CHECK-NEXT:    [[CMP1:%.*]] = icmp uge i8 %a, %b
766; CHECK-NEXT:    [[CMP2:%.*]] = icmp sle i8 %a, %b
767; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
768; CHECK-NEXT:    ret i1 [[AND]]
769;
770  %cmp1 = icmp uge i8 %a, %b
771  %cmp2 = icmp sle i8 %a, %b
772  %and = and i1 %cmp1, %cmp2
773  ret i1 %and
774}
775
776define i1 @uge_slt(i8 %a, i8 %b) {
777; CHECK-LABEL: @uge_slt(
778; CHECK-NEXT:    [[CMP1:%.*]] = icmp uge i8 %a, %b
779; CHECK-NEXT:    [[CMP2:%.*]] = icmp slt i8 %a, %b
780; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
781; CHECK-NEXT:    ret i1 [[AND]]
782;
783  %cmp1 = icmp uge i8 %a, %b
784  %cmp2 = icmp slt i8 %a, %b
785  %and = and i1 %cmp1, %cmp2
786  ret i1 %and
787}
788
789define i1 @uge_uge(i8 %a, i8 %b) {
790; CHECK-LABEL: @uge_uge(
791; CHECK-NEXT:    [[CMP1:%.*]] = icmp uge i8 %a, %b
792; CHECK-NEXT:    ret i1 [[CMP1]]
793;
794  %cmp1 = icmp uge i8 %a, %b
795  %cmp2 = icmp uge i8 %a, %b
796  %and = and i1 %cmp1, %cmp2
797  ret i1 %and
798}
799
800define i1 @uge_ugt(i8 %a, i8 %b) {
801; CHECK-LABEL: @uge_ugt(
802; CHECK-NEXT:    [[CMP2:%.*]] = icmp ugt i8 %a, %b
803; CHECK-NEXT:    ret i1 [[CMP2]]
804;
805  %cmp1 = icmp uge i8 %a, %b
806  %cmp2 = icmp ugt i8 %a, %b
807  %and = and i1 %cmp1, %cmp2
808  ret i1 %and
809}
810
811define i1 @uge_ule(i8 %a, i8 %b) {
812; CHECK-LABEL: @uge_ule(
813; CHECK-NEXT:    [[CMP1:%.*]] = icmp uge i8 %a, %b
814; CHECK-NEXT:    [[CMP2:%.*]] = icmp ule i8 %a, %b
815; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
816; CHECK-NEXT:    ret i1 [[AND]]
817;
818  %cmp1 = icmp uge i8 %a, %b
819  %cmp2 = icmp ule i8 %a, %b
820  %and = and i1 %cmp1, %cmp2
821  ret i1 %and
822}
823
824define i1 @uge_ult(i8 %a, i8 %b) {
825; CHECK-LABEL: @uge_ult(
826; CHECK-NEXT:    ret i1 false
827;
828  %cmp1 = icmp uge i8 %a, %b
829  %cmp2 = icmp ult i8 %a, %b
830  %and = and i1 %cmp1, %cmp2
831  ret i1 %and
832}
833
834;
835
836define i1 @ugt_eq(i8 %a, i8 %b) {
837; CHECK-LABEL: @ugt_eq(
838; CHECK-NEXT:    ret i1 false
839;
840  %cmp1 = icmp ugt i8 %a, %b
841  %cmp2 = icmp eq i8 %a, %b
842  %and = and i1 %cmp1, %cmp2
843  ret i1 %and
844}
845
846define i1 @ugt_ne(i8 %a, i8 %b) {
847; CHECK-LABEL: @ugt_ne(
848; CHECK-NEXT:    [[CMP1:%.*]] = icmp ugt i8 %a, %b
849; CHECK-NEXT:    ret i1 [[CMP1]]
850;
851  %cmp1 = icmp ugt i8 %a, %b
852  %cmp2 = icmp ne i8 %a, %b
853  %and = and i1 %cmp1, %cmp2
854  ret i1 %and
855}
856
857define i1 @ugt_sge(i8 %a, i8 %b) {
858; CHECK-LABEL: @ugt_sge(
859; CHECK-NEXT:    [[CMP1:%.*]] = icmp ugt i8 %a, %b
860; CHECK-NEXT:    [[CMP2:%.*]] = icmp sge i8 %a, %b
861; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
862; CHECK-NEXT:    ret i1 [[AND]]
863;
864  %cmp1 = icmp ugt i8 %a, %b
865  %cmp2 = icmp sge i8 %a, %b
866  %and = and i1 %cmp1, %cmp2
867  ret i1 %and
868}
869
870define i1 @ugt_sgt(i8 %a, i8 %b) {
871; CHECK-LABEL: @ugt_sgt(
872; CHECK-NEXT:    [[CMP1:%.*]] = icmp ugt i8 %a, %b
873; CHECK-NEXT:    [[CMP2:%.*]] = icmp sgt i8 %a, %b
874; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
875; CHECK-NEXT:    ret i1 [[AND]]
876;
877  %cmp1 = icmp ugt i8 %a, %b
878  %cmp2 = icmp sgt i8 %a, %b
879  %and = and i1 %cmp1, %cmp2
880  ret i1 %and
881}
882
883define i1 @ugt_sle(i8 %a, i8 %b) {
884; CHECK-LABEL: @ugt_sle(
885; CHECK-NEXT:    [[CMP1:%.*]] = icmp ugt i8 %a, %b
886; CHECK-NEXT:    [[CMP2:%.*]] = icmp sle i8 %a, %b
887; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
888; CHECK-NEXT:    ret i1 [[AND]]
889;
890  %cmp1 = icmp ugt i8 %a, %b
891  %cmp2 = icmp sle i8 %a, %b
892  %and = and i1 %cmp1, %cmp2
893  ret i1 %and
894}
895
896define i1 @ugt_slt(i8 %a, i8 %b) {
897; CHECK-LABEL: @ugt_slt(
898; CHECK-NEXT:    [[CMP1:%.*]] = icmp ugt i8 %a, %b
899; CHECK-NEXT:    [[CMP2:%.*]] = icmp slt i8 %a, %b
900; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
901; CHECK-NEXT:    ret i1 [[AND]]
902;
903  %cmp1 = icmp ugt i8 %a, %b
904  %cmp2 = icmp slt i8 %a, %b
905  %and = and i1 %cmp1, %cmp2
906  ret i1 %and
907}
908
909define i1 @ugt_uge(i8 %a, i8 %b) {
910; CHECK-LABEL: @ugt_uge(
911; CHECK-NEXT:    [[CMP1:%.*]] = icmp ugt i8 %a, %b
912; CHECK-NEXT:    ret i1 [[CMP1]]
913;
914  %cmp1 = icmp ugt i8 %a, %b
915  %cmp2 = icmp uge i8 %a, %b
916  %and = and i1 %cmp1, %cmp2
917  ret i1 %and
918}
919
920define i1 @ugt_ugt(i8 %a, i8 %b) {
921; CHECK-LABEL: @ugt_ugt(
922; CHECK-NEXT:    [[CMP1:%.*]] = icmp ugt i8 %a, %b
923; CHECK-NEXT:    ret i1 [[CMP1]]
924;
925  %cmp1 = icmp ugt i8 %a, %b
926  %cmp2 = icmp ugt i8 %a, %b
927  %and = and i1 %cmp1, %cmp2
928  ret i1 %and
929}
930
931define i1 @ugt_ule(i8 %a, i8 %b) {
932; CHECK-LABEL: @ugt_ule(
933; CHECK-NEXT:    ret i1 false
934;
935  %cmp1 = icmp ugt i8 %a, %b
936  %cmp2 = icmp ule i8 %a, %b
937  %and = and i1 %cmp1, %cmp2
938  ret i1 %and
939}
940
941define i1 @ugt_ult(i8 %a, i8 %b) {
942; CHECK-LABEL: @ugt_ult(
943; CHECK-NEXT:    ret i1 false
944;
945  %cmp1 = icmp ugt i8 %a, %b
946  %cmp2 = icmp ult i8 %a, %b
947  %and = and i1 %cmp1, %cmp2
948  ret i1 %and
949}
950
951;
952
953define i1 @ule_eq(i8 %a, i8 %b) {
954; CHECK-LABEL: @ule_eq(
955; CHECK-NEXT:    [[CMP2:%.*]] = icmp eq i8 %a, %b
956; CHECK-NEXT:    ret i1 [[CMP2]]
957;
958  %cmp1 = icmp ule i8 %a, %b
959  %cmp2 = icmp eq i8 %a, %b
960  %and = and i1 %cmp1, %cmp2
961  ret i1 %and
962}
963
964define i1 @ule_ne(i8 %a, i8 %b) {
965; CHECK-LABEL: @ule_ne(
966; CHECK-NEXT:    [[CMP1:%.*]] = icmp ule i8 %a, %b
967; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne i8 %a, %b
968; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
969; CHECK-NEXT:    ret i1 [[AND]]
970;
971  %cmp1 = icmp ule i8 %a, %b
972  %cmp2 = icmp ne i8 %a, %b
973  %and = and i1 %cmp1, %cmp2
974  ret i1 %and
975}
976
977define i1 @ule_sge(i8 %a, i8 %b) {
978; CHECK-LABEL: @ule_sge(
979; CHECK-NEXT:    [[CMP1:%.*]] = icmp ule i8 %a, %b
980; CHECK-NEXT:    [[CMP2:%.*]] = icmp sge i8 %a, %b
981; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
982; CHECK-NEXT:    ret i1 [[AND]]
983;
984  %cmp1 = icmp ule i8 %a, %b
985  %cmp2 = icmp sge i8 %a, %b
986  %and = and i1 %cmp1, %cmp2
987  ret i1 %and
988}
989
990define i1 @ule_sgt(i8 %a, i8 %b) {
991; CHECK-LABEL: @ule_sgt(
992; CHECK-NEXT:    [[CMP1:%.*]] = icmp ule i8 %a, %b
993; CHECK-NEXT:    [[CMP2:%.*]] = icmp sgt i8 %a, %b
994; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
995; CHECK-NEXT:    ret i1 [[AND]]
996;
997  %cmp1 = icmp ule i8 %a, %b
998  %cmp2 = icmp sgt i8 %a, %b
999  %and = and i1 %cmp1, %cmp2
1000  ret i1 %and
1001}
1002
1003define i1 @ule_sle(i8 %a, i8 %b) {
1004; CHECK-LABEL: @ule_sle(
1005; CHECK-NEXT:    [[CMP1:%.*]] = icmp ule i8 %a, %b
1006; CHECK-NEXT:    [[CMP2:%.*]] = icmp sle i8 %a, %b
1007; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
1008; CHECK-NEXT:    ret i1 [[AND]]
1009;
1010  %cmp1 = icmp ule i8 %a, %b
1011  %cmp2 = icmp sle i8 %a, %b
1012  %and = and i1 %cmp1, %cmp2
1013  ret i1 %and
1014}
1015
1016define i1 @ule_slt(i8 %a, i8 %b) {
1017; CHECK-LABEL: @ule_slt(
1018; CHECK-NEXT:    [[CMP1:%.*]] = icmp ule i8 %a, %b
1019; CHECK-NEXT:    [[CMP2:%.*]] = icmp slt i8 %a, %b
1020; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
1021; CHECK-NEXT:    ret i1 [[AND]]
1022;
1023  %cmp1 = icmp ule i8 %a, %b
1024  %cmp2 = icmp slt i8 %a, %b
1025  %and = and i1 %cmp1, %cmp2
1026  ret i1 %and
1027}
1028
1029define i1 @ule_uge(i8 %a, i8 %b) {
1030; CHECK-LABEL: @ule_uge(
1031; CHECK-NEXT:    [[CMP1:%.*]] = icmp ule i8 %a, %b
1032; CHECK-NEXT:    [[CMP2:%.*]] = icmp uge i8 %a, %b
1033; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
1034; CHECK-NEXT:    ret i1 [[AND]]
1035;
1036  %cmp1 = icmp ule i8 %a, %b
1037  %cmp2 = icmp uge i8 %a, %b
1038  %and = and i1 %cmp1, %cmp2
1039  ret i1 %and
1040}
1041
1042define i1 @ule_ugt(i8 %a, i8 %b) {
1043; CHECK-LABEL: @ule_ugt(
1044; CHECK-NEXT:    ret i1 false
1045;
1046  %cmp1 = icmp ule i8 %a, %b
1047  %cmp2 = icmp ugt i8 %a, %b
1048  %and = and i1 %cmp1, %cmp2
1049  ret i1 %and
1050}
1051
1052define i1 @ule_ule(i8 %a, i8 %b) {
1053; CHECK-LABEL: @ule_ule(
1054; CHECK-NEXT:    [[CMP1:%.*]] = icmp ule i8 %a, %b
1055; CHECK-NEXT:    ret i1 [[CMP1]]
1056;
1057  %cmp1 = icmp ule i8 %a, %b
1058  %cmp2 = icmp ule i8 %a, %b
1059  %and = and i1 %cmp1, %cmp2
1060  ret i1 %and
1061}
1062
1063define i1 @ule_ult(i8 %a, i8 %b) {
1064; CHECK-LABEL: @ule_ult(
1065; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i8 %a, %b
1066; CHECK-NEXT:    ret i1 [[CMP2]]
1067;
1068  %cmp1 = icmp ule i8 %a, %b
1069  %cmp2 = icmp ult i8 %a, %b
1070  %and = and i1 %cmp1, %cmp2
1071  ret i1 %and
1072}
1073
1074;
1075
1076define i1 @ult_eq(i8 %a, i8 %b) {
1077; CHECK-LABEL: @ult_eq(
1078; CHECK-NEXT:    ret i1 false
1079;
1080  %cmp1 = icmp ult i8 %a, %b
1081  %cmp2 = icmp eq i8 %a, %b
1082  %and = and i1 %cmp1, %cmp2
1083  ret i1 %and
1084}
1085
1086define i1 @ult_ne(i8 %a, i8 %b) {
1087; CHECK-LABEL: @ult_ne(
1088; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i8 %a, %b
1089; CHECK-NEXT:    ret i1 [[CMP1]]
1090;
1091  %cmp1 = icmp ult i8 %a, %b
1092  %cmp2 = icmp ne i8 %a, %b
1093  %and = and i1 %cmp1, %cmp2
1094  ret i1 %and
1095}
1096
1097define i1 @ult_sge(i8 %a, i8 %b) {
1098; CHECK-LABEL: @ult_sge(
1099; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i8 %a, %b
1100; CHECK-NEXT:    [[CMP2:%.*]] = icmp sge i8 %a, %b
1101; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
1102; CHECK-NEXT:    ret i1 [[AND]]
1103;
1104  %cmp1 = icmp ult i8 %a, %b
1105  %cmp2 = icmp sge i8 %a, %b
1106  %and = and i1 %cmp1, %cmp2
1107  ret i1 %and
1108}
1109
1110define i1 @ult_sgt(i8 %a, i8 %b) {
1111; CHECK-LABEL: @ult_sgt(
1112; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i8 %a, %b
1113; CHECK-NEXT:    [[CMP2:%.*]] = icmp sgt i8 %a, %b
1114; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
1115; CHECK-NEXT:    ret i1 [[AND]]
1116;
1117  %cmp1 = icmp ult i8 %a, %b
1118  %cmp2 = icmp sgt i8 %a, %b
1119  %and = and i1 %cmp1, %cmp2
1120  ret i1 %and
1121}
1122
1123define i1 @ult_sle(i8 %a, i8 %b) {
1124; CHECK-LABEL: @ult_sle(
1125; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i8 %a, %b
1126; CHECK-NEXT:    [[CMP2:%.*]] = icmp sle i8 %a, %b
1127; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
1128; CHECK-NEXT:    ret i1 [[AND]]
1129;
1130  %cmp1 = icmp ult i8 %a, %b
1131  %cmp2 = icmp sle i8 %a, %b
1132  %and = and i1 %cmp1, %cmp2
1133  ret i1 %and
1134}
1135
1136define i1 @ult_slt(i8 %a, i8 %b) {
1137; CHECK-LABEL: @ult_slt(
1138; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i8 %a, %b
1139; CHECK-NEXT:    [[CMP2:%.*]] = icmp slt i8 %a, %b
1140; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
1141; CHECK-NEXT:    ret i1 [[AND]]
1142;
1143  %cmp1 = icmp ult i8 %a, %b
1144  %cmp2 = icmp slt i8 %a, %b
1145  %and = and i1 %cmp1, %cmp2
1146  ret i1 %and
1147}
1148
1149define i1 @ult_uge(i8 %a, i8 %b) {
1150; CHECK-LABEL: @ult_uge(
1151; CHECK-NEXT:    ret i1 false
1152;
1153  %cmp1 = icmp ult i8 %a, %b
1154  %cmp2 = icmp uge i8 %a, %b
1155  %and = and i1 %cmp1, %cmp2
1156  ret i1 %and
1157}
1158
1159define i1 @ult_ugt(i8 %a, i8 %b) {
1160; CHECK-LABEL: @ult_ugt(
1161; CHECK-NEXT:    ret i1 false
1162;
1163  %cmp1 = icmp ult i8 %a, %b
1164  %cmp2 = icmp ugt i8 %a, %b
1165  %and = and i1 %cmp1, %cmp2
1166  ret i1 %and
1167}
1168
1169define i1 @ult_ule(i8 %a, i8 %b) {
1170; CHECK-LABEL: @ult_ule(
1171; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i8 %a, %b
1172; CHECK-NEXT:    ret i1 [[CMP1]]
1173;
1174  %cmp1 = icmp ult i8 %a, %b
1175  %cmp2 = icmp ule i8 %a, %b
1176  %and = and i1 %cmp1, %cmp2
1177  ret i1 %and
1178}
1179
1180define i1 @ult_ult(i8 %a, i8 %b) {
1181; CHECK-LABEL: @ult_ult(
1182; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i8 %a, %b
1183; CHECK-NEXT:    ret i1 [[CMP1]]
1184;
1185  %cmp1 = icmp ult i8 %a, %b
1186  %cmp2 = icmp ult i8 %a, %b
1187  %and = and i1 %cmp1, %cmp2
1188  ret i1 %and
1189}
1190
1191; Check a couple of vector variants to make sure those work too.
1192
1193define <2 x i1> @ult_uge_vec(<2 x i8> %a, <2 x i8> %b) {
1194; CHECK-LABEL: @ult_uge_vec(
1195; CHECK-NEXT:    ret <2 x i1> zeroinitializer
1196;
1197  %cmp1 = icmp ult <2 x i8> %a, %b
1198  %cmp2 = icmp uge <2 x i8> %a, %b
1199  %and = and <2 x i1> %cmp1, %cmp2
1200  ret <2 x i1> %and
1201}
1202
1203define <2 x i1> @ult_ule_vec(<2 x i8> %a, <2 x i8> %b) {
1204; CHECK-LABEL: @ult_ule_vec(
1205; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult <2 x i8> %a, %b
1206; CHECK-NEXT:    ret <2 x i1> [[CMP1]]
1207;
1208  %cmp1 = icmp ult <2 x i8> %a, %b
1209  %cmp2 = icmp ule <2 x i8> %a, %b
1210  %and = and <2 x i1> %cmp1, %cmp2
1211  ret <2 x i1> %and
1212}
1213
1214define i1 @ult_uge_swap(i8 %a, i8 %b) {
1215; CHECK-LABEL: @ult_uge_swap(
1216; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i8 %a, %b
1217; CHECK-NEXT:    [[CMP2:%.*]] = icmp uge i8 %b, %a
1218; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
1219; CHECK-NEXT:    ret i1 [[AND]]
1220;
1221  %cmp1 = icmp ult i8 %a, %b
1222  %cmp2 = icmp uge i8 %b, %a
1223  %and = and i1 %cmp1, %cmp2
1224  ret i1 %and
1225}
1226
1227define i1 @ult_ult_swap(i8 %a, i8 %b) {
1228; CHECK-LABEL: @ult_ult_swap(
1229; CHECK-NEXT:    [[CMP1:%.*]] = icmp ult i8 %a, %b
1230; CHECK-NEXT:    [[CMP2:%.*]] = icmp ult i8 %b, %a
1231; CHECK-NEXT:    [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
1232; CHECK-NEXT:    ret i1 [[AND]]
1233;
1234  %cmp1 = icmp ult i8 %a, %b
1235  %cmp2 = icmp ult i8 %b, %a
1236  %and = and i1 %cmp1, %cmp2
1237  ret i1 %and
1238}
1239
1240