1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
4 declare i8 @llvm.smin.i8(i8, i8)
5 declare i8 @llvm.smax.i8(i8, i8)
6 declare i8 @llvm.umin.i8(i8, i8)
7 declare i8 @llvm.umax.i8(i8, i8)
8 declare <4 x i8> @llvm.smin.v4i8(<4 x i8>, <4 x i8>)
9 declare <4 x i8> @llvm.smax.v4i8(<4 x i8>, <4 x i8>)
10 declare <4 x i8> @llvm.umin.v4i8(<4 x i8>, <4 x i8>)
11 declare <4 x i8> @llvm.umax.v4i8(<4 x i8>, <4 x i8>)
15 define i8 @slt_xy_smin_fval(i8 %x, i8 %y) {
16 ; CHECK-LABEL: @slt_xy_smin_fval(
17 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
18 ; CHECK-NEXT: ret i8 [[M]]
20 %i = icmp slt i8 %x, %y
21 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
22 %r = select i1 %i, i8 %x, i8 %m
26 define i8 @sle_xy_smin_fval(i8 %x, i8 %y) {
27 ; CHECK-LABEL: @sle_xy_smin_fval(
28 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
29 ; CHECK-NEXT: ret i8 [[M]]
31 %i = icmp sle i8 %x, %y
32 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
33 %r = select i1 %i, i8 %x, i8 %m
37 define i8 @sgt_xy_smin_fval(i8 %x, i8 %y) {
38 ; CHECK-LABEL: @sgt_xy_smin_fval(
39 ; CHECK-NEXT: ret i8 [[X:%.*]]
41 %i = icmp sgt i8 %x, %y
42 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
43 %r = select i1 %i, i8 %x, i8 %m
47 define i8 @sge_xy_smin_fval(i8 %x, i8 %y) {
48 ; CHECK-LABEL: @sge_xy_smin_fval(
49 ; CHECK-NEXT: ret i8 [[X:%.*]]
51 %i = icmp sge i8 %x, %y
52 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
53 %r = select i1 %i, i8 %x, i8 %m
57 define i8 @ult_xy_smin_fval(i8 %x, i8 %y) {
58 ; CHECK-LABEL: @ult_xy_smin_fval(
59 ; CHECK-NEXT: [[I:%.*]] = icmp ult i8 [[X:%.*]], [[Y:%.*]]
60 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X]], i8 [[Y]])
61 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
62 ; CHECK-NEXT: ret i8 [[R]]
64 %i = icmp ult i8 %x, %y
65 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
66 %r = select i1 %i, i8 %x, i8 %m
70 define i8 @ule_xy_smin_fval(i8 %x, i8 %y) {
71 ; CHECK-LABEL: @ule_xy_smin_fval(
72 ; CHECK-NEXT: [[I:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]]
73 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y]], i8 [[X]])
74 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
75 ; CHECK-NEXT: ret i8 [[R]]
77 %i = icmp ule i8 %x, %y
78 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
79 %r = select i1 %i, i8 %x, i8 %m
83 define i8 @ugt_xy_smin_fval(i8 %x, i8 %y) {
84 ; CHECK-LABEL: @ugt_xy_smin_fval(
85 ; CHECK-NEXT: [[I:%.*]] = icmp ugt i8 [[X:%.*]], [[Y:%.*]]
86 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X]], i8 [[Y]])
87 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
88 ; CHECK-NEXT: ret i8 [[R]]
90 %i = icmp ugt i8 %x, %y
91 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
92 %r = select i1 %i, i8 %x, i8 %m
96 define i8 @uge_xy_smin_fval(i8 %x, i8 %y) {
97 ; CHECK-LABEL: @uge_xy_smin_fval(
98 ; CHECK-NEXT: [[I:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
99 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y]], i8 [[X]])
100 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
101 ; CHECK-NEXT: ret i8 [[R]]
103 %i = icmp uge i8 %x, %y
104 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
105 %r = select i1 %i, i8 %x, i8 %m
109 define i8 @eq_xy_smin_fval(i8 %x, i8 %y) {
110 ; CHECK-LABEL: @eq_xy_smin_fval(
111 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
112 ; CHECK-NEXT: ret i8 [[M]]
114 %i = icmp eq i8 %x, %y
115 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
116 %r = select i1 %i, i8 %x, i8 %m
120 define i8 @ne_xy_smin_fval(i8 %x, i8 %y) {
121 ; CHECK-LABEL: @ne_xy_smin_fval(
122 ; CHECK-NEXT: ret i8 [[X:%.*]]
124 %i = icmp ne i8 %x, %y
125 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
126 %r = select i1 %i, i8 %x, i8 %m
132 define i8 @slt_yx_smin_fval(i8 %x, i8 %y) {
133 ; CHECK-LABEL: @slt_yx_smin_fval(
134 ; CHECK-NEXT: ret i8 [[X:%.*]]
136 %i = icmp slt i8 %y, %x
137 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
138 %r = select i1 %i, i8 %x, i8 %m
142 define i8 @sle_yx_smin_fval(i8 %x, i8 %y) {
143 ; CHECK-LABEL: @sle_yx_smin_fval(
144 ; CHECK-NEXT: ret i8 [[X:%.*]]
146 %i = icmp sle i8 %y, %x
147 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
148 %r = select i1 %i, i8 %x, i8 %m
152 define i8 @sgt_yx_smin_fval(i8 %x, i8 %y) {
153 ; CHECK-LABEL: @sgt_yx_smin_fval(
154 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
155 ; CHECK-NEXT: ret i8 [[M]]
157 %i = icmp sgt i8 %y, %x
158 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
159 %r = select i1 %i, i8 %x, i8 %m
163 define i8 @sge_yx_smin_fval(i8 %x, i8 %y) {
164 ; CHECK-LABEL: @sge_yx_smin_fval(
165 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
166 ; CHECK-NEXT: ret i8 [[M]]
168 %i = icmp sge i8 %y, %x
169 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
170 %r = select i1 %i, i8 %x, i8 %m
174 define i8 @ult_yx_smin_fval(i8 %x, i8 %y) {
175 ; CHECK-LABEL: @ult_yx_smin_fval(
176 ; CHECK-NEXT: [[I:%.*]] = icmp ult i8 [[Y:%.*]], [[X:%.*]]
177 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X]], i8 [[Y]])
178 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
179 ; CHECK-NEXT: ret i8 [[R]]
181 %i = icmp ult i8 %y, %x
182 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
183 %r = select i1 %i, i8 %x, i8 %m
187 define i8 @ule_yx_smin_fval(i8 %x, i8 %y) {
188 ; CHECK-LABEL: @ule_yx_smin_fval(
189 ; CHECK-NEXT: [[I:%.*]] = icmp ule i8 [[Y:%.*]], [[X:%.*]]
190 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y]], i8 [[X]])
191 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
192 ; CHECK-NEXT: ret i8 [[R]]
194 %i = icmp ule i8 %y, %x
195 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
196 %r = select i1 %i, i8 %x, i8 %m
200 define i8 @ugt_yx_smin_fval(i8 %x, i8 %y) {
201 ; CHECK-LABEL: @ugt_yx_smin_fval(
202 ; CHECK-NEXT: [[I:%.*]] = icmp ugt i8 [[Y:%.*]], [[X:%.*]]
203 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X]], i8 [[Y]])
204 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
205 ; CHECK-NEXT: ret i8 [[R]]
207 %i = icmp ugt i8 %y, %x
208 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
209 %r = select i1 %i, i8 %x, i8 %m
213 define i8 @uge_yx_smin_fval(i8 %x, i8 %y) {
214 ; CHECK-LABEL: @uge_yx_smin_fval(
215 ; CHECK-NEXT: [[I:%.*]] = icmp uge i8 [[Y:%.*]], [[X:%.*]]
216 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y]], i8 [[X]])
217 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
218 ; CHECK-NEXT: ret i8 [[R]]
220 %i = icmp uge i8 %y, %x
221 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
222 %r = select i1 %i, i8 %x, i8 %m
226 define i8 @eq_yx_smin_fval(i8 %x, i8 %y) {
227 ; CHECK-LABEL: @eq_yx_smin_fval(
228 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
229 ; CHECK-NEXT: ret i8 [[M]]
231 %i = icmp eq i8 %y, %x
232 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
233 %r = select i1 %i, i8 %x, i8 %m
237 define i8 @ne_yx_smin_fval(i8 %x, i8 %y) {
238 ; CHECK-LABEL: @ne_yx_smin_fval(
239 ; CHECK-NEXT: ret i8 [[X:%.*]]
241 %i = icmp ne i8 %y, %x
242 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
243 %r = select i1 %i, i8 %x, i8 %m
247 ; swap select operands
249 define i8 @slt_xy_smin_tval(i8 %x, i8 %y) {
250 ; CHECK-LABEL: @slt_xy_smin_tval(
251 ; CHECK-NEXT: ret i8 [[X:%.*]]
253 %i = icmp slt i8 %x, %y
254 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
255 %r = select i1 %i, i8 %m, i8 %x
259 define i8 @sle_xy_smin_tval(i8 %x, i8 %y) {
260 ; CHECK-LABEL: @sle_xy_smin_tval(
261 ; CHECK-NEXT: ret i8 [[X:%.*]]
263 %i = icmp sle i8 %x, %y
264 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
265 %r = select i1 %i, i8 %m, i8 %x
269 define i8 @sgt_xy_smin_tval(i8 %x, i8 %y) {
270 ; CHECK-LABEL: @sgt_xy_smin_tval(
271 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
272 ; CHECK-NEXT: ret i8 [[M]]
274 %i = icmp sgt i8 %x, %y
275 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
276 %r = select i1 %i, i8 %m, i8 %x
280 define i8 @sge_xy_smin_tval(i8 %x, i8 %y) {
281 ; CHECK-LABEL: @sge_xy_smin_tval(
282 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
283 ; CHECK-NEXT: ret i8 [[M]]
285 %i = icmp sge i8 %x, %y
286 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
287 %r = select i1 %i, i8 %m, i8 %x
291 define i8 @ult_xy_smin_tval(i8 %x, i8 %y) {
292 ; CHECK-LABEL: @ult_xy_smin_tval(
293 ; CHECK-NEXT: [[I:%.*]] = icmp ult i8 [[X:%.*]], [[Y:%.*]]
294 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X]], i8 [[Y]])
295 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
296 ; CHECK-NEXT: ret i8 [[R]]
298 %i = icmp ult i8 %x, %y
299 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
300 %r = select i1 %i, i8 %m, i8 %x
304 define i8 @ule_xy_smin_tval(i8 %x, i8 %y) {
305 ; CHECK-LABEL: @ule_xy_smin_tval(
306 ; CHECK-NEXT: [[I:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]]
307 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y]], i8 [[X]])
308 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
309 ; CHECK-NEXT: ret i8 [[R]]
311 %i = icmp ule i8 %x, %y
312 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
313 %r = select i1 %i, i8 %m, i8 %x
317 define i8 @ugt_xy_smin_tval(i8 %x, i8 %y) {
318 ; CHECK-LABEL: @ugt_xy_smin_tval(
319 ; CHECK-NEXT: [[I:%.*]] = icmp ugt i8 [[X:%.*]], [[Y:%.*]]
320 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X]], i8 [[Y]])
321 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
322 ; CHECK-NEXT: ret i8 [[R]]
324 %i = icmp ugt i8 %x, %y
325 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
326 %r = select i1 %i, i8 %m, i8 %x
330 define i8 @uge_xy_smin_tval(i8 %x, i8 %y) {
331 ; CHECK-LABEL: @uge_xy_smin_tval(
332 ; CHECK-NEXT: [[I:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
333 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y]], i8 [[X]])
334 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
335 ; CHECK-NEXT: ret i8 [[R]]
337 %i = icmp uge i8 %x, %y
338 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
339 %r = select i1 %i, i8 %m, i8 %x
343 define i8 @eq_xy_smin_tval(i8 %x, i8 %y) {
344 ; CHECK-LABEL: @eq_xy_smin_tval(
345 ; CHECK-NEXT: ret i8 [[X:%.*]]
347 %i = icmp eq i8 %x, %y
348 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
349 %r = select i1 %i, i8 %m, i8 %x
353 define i8 @ne_xy_smin_tval(i8 %x, i8 %y) {
354 ; CHECK-LABEL: @ne_xy_smin_tval(
355 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
356 ; CHECK-NEXT: ret i8 [[M]]
358 %i = icmp ne i8 %x, %y
359 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
360 %r = select i1 %i, i8 %m, i8 %x
364 ; swap icmp and select operands
366 define i8 @slt_yx_smin_tval(i8 %x, i8 %y) {
367 ; CHECK-LABEL: @slt_yx_smin_tval(
368 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
369 ; CHECK-NEXT: ret i8 [[M]]
371 %i = icmp slt i8 %y, %x
372 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
373 %r = select i1 %i, i8 %m, i8 %x
377 define i8 @sle_yx_smin_tval(i8 %x, i8 %y) {
378 ; CHECK-LABEL: @sle_yx_smin_tval(
379 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
380 ; CHECK-NEXT: ret i8 [[M]]
382 %i = icmp sle i8 %y, %x
383 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
384 %r = select i1 %i, i8 %m, i8 %x
388 define i8 @sgt_yx_smin_tval(i8 %x, i8 %y) {
389 ; CHECK-LABEL: @sgt_yx_smin_tval(
390 ; CHECK-NEXT: ret i8 [[X:%.*]]
392 %i = icmp sgt i8 %y, %x
393 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
394 %r = select i1 %i, i8 %m, i8 %x
398 define i8 @sge_yx_smin_tval(i8 %x, i8 %y) {
399 ; CHECK-LABEL: @sge_yx_smin_tval(
400 ; CHECK-NEXT: ret i8 [[X:%.*]]
402 %i = icmp sge i8 %y, %x
403 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
404 %r = select i1 %i, i8 %m, i8 %x
408 define i8 @ult_yx_smin_tval(i8 %x, i8 %y) {
409 ; CHECK-LABEL: @ult_yx_smin_tval(
410 ; CHECK-NEXT: [[I:%.*]] = icmp ult i8 [[Y:%.*]], [[X:%.*]]
411 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X]], i8 [[Y]])
412 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
413 ; CHECK-NEXT: ret i8 [[R]]
415 %i = icmp ult i8 %y, %x
416 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
417 %r = select i1 %i, i8 %m, i8 %x
421 define i8 @ule_yx_smin_tval(i8 %x, i8 %y) {
422 ; CHECK-LABEL: @ule_yx_smin_tval(
423 ; CHECK-NEXT: [[I:%.*]] = icmp ule i8 [[Y:%.*]], [[X:%.*]]
424 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y]], i8 [[X]])
425 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
426 ; CHECK-NEXT: ret i8 [[R]]
428 %i = icmp ule i8 %y, %x
429 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
430 %r = select i1 %i, i8 %m, i8 %x
434 define i8 @ugt_yx_smin_tval(i8 %x, i8 %y) {
435 ; CHECK-LABEL: @ugt_yx_smin_tval(
436 ; CHECK-NEXT: [[I:%.*]] = icmp ugt i8 [[Y:%.*]], [[X:%.*]]
437 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X]], i8 [[Y]])
438 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
439 ; CHECK-NEXT: ret i8 [[R]]
441 %i = icmp ugt i8 %y, %x
442 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
443 %r = select i1 %i, i8 %m, i8 %x
447 define i8 @uge_yx_smin_tval(i8 %x, i8 %y) {
448 ; CHECK-LABEL: @uge_yx_smin_tval(
449 ; CHECK-NEXT: [[I:%.*]] = icmp uge i8 [[Y:%.*]], [[X:%.*]]
450 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y]], i8 [[X]])
451 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
452 ; CHECK-NEXT: ret i8 [[R]]
454 %i = icmp uge i8 %y, %x
455 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
456 %r = select i1 %i, i8 %m, i8 %x
460 define i8 @eq_yx_smin_tval(i8 %x, i8 %y) {
461 ; CHECK-LABEL: @eq_yx_smin_tval(
462 ; CHECK-NEXT: ret i8 [[X:%.*]]
464 %i = icmp eq i8 %y, %x
465 %m = call i8 @llvm.smin.i8(i8 %x, i8 %y)
466 %r = select i1 %i, i8 %m, i8 %x
470 define i8 @ne_yx_smin_tval(i8 %x, i8 %y) {
471 ; CHECK-LABEL: @ne_yx_smin_tval(
472 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
473 ; CHECK-NEXT: ret i8 [[M]]
475 %i = icmp ne i8 %y, %x
476 %m = call i8 @llvm.smin.i8(i8 %y, i8 %x)
477 %r = select i1 %i, i8 %m, i8 %x
483 define i8 @slt_xy_smax_fval(i8 %x, i8 %y) {
484 ; CHECK-LABEL: @slt_xy_smax_fval(
485 ; CHECK-NEXT: ret i8 [[X:%.*]]
487 %i = icmp slt i8 %x, %y
488 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
489 %r = select i1 %i, i8 %x, i8 %m
493 define i8 @sle_xy_smax_fval(i8 %x, i8 %y) {
494 ; CHECK-LABEL: @sle_xy_smax_fval(
495 ; CHECK-NEXT: ret i8 [[X:%.*]]
497 %i = icmp sle i8 %x, %y
498 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
499 %r = select i1 %i, i8 %x, i8 %m
503 define i8 @sgt_xy_smax_fval(i8 %x, i8 %y) {
504 ; CHECK-LABEL: @sgt_xy_smax_fval(
505 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
506 ; CHECK-NEXT: ret i8 [[M]]
508 %i = icmp sgt i8 %x, %y
509 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
510 %r = select i1 %i, i8 %x, i8 %m
514 define i8 @sge_xy_smax_fval(i8 %x, i8 %y) {
515 ; CHECK-LABEL: @sge_xy_smax_fval(
516 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
517 ; CHECK-NEXT: ret i8 [[M]]
519 %i = icmp sge i8 %x, %y
520 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
521 %r = select i1 %i, i8 %x, i8 %m
525 define i8 @ult_xy_smax_fval(i8 %x, i8 %y) {
526 ; CHECK-LABEL: @ult_xy_smax_fval(
527 ; CHECK-NEXT: [[I:%.*]] = icmp ult i8 [[X:%.*]], [[Y:%.*]]
528 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X]], i8 [[Y]])
529 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
530 ; CHECK-NEXT: ret i8 [[R]]
532 %i = icmp ult i8 %x, %y
533 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
534 %r = select i1 %i, i8 %x, i8 %m
538 define i8 @ule_xy_smax_fval(i8 %x, i8 %y) {
539 ; CHECK-LABEL: @ule_xy_smax_fval(
540 ; CHECK-NEXT: [[I:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]]
541 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y]], i8 [[X]])
542 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
543 ; CHECK-NEXT: ret i8 [[R]]
545 %i = icmp ule i8 %x, %y
546 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
547 %r = select i1 %i, i8 %x, i8 %m
551 define i8 @ugt_xy_smax_fval(i8 %x, i8 %y) {
552 ; CHECK-LABEL: @ugt_xy_smax_fval(
553 ; CHECK-NEXT: [[I:%.*]] = icmp ugt i8 [[X:%.*]], [[Y:%.*]]
554 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X]], i8 [[Y]])
555 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
556 ; CHECK-NEXT: ret i8 [[R]]
558 %i = icmp ugt i8 %x, %y
559 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
560 %r = select i1 %i, i8 %x, i8 %m
564 define i8 @uge_xy_smax_fval(i8 %x, i8 %y) {
565 ; CHECK-LABEL: @uge_xy_smax_fval(
566 ; CHECK-NEXT: [[I:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
567 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y]], i8 [[X]])
568 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
569 ; CHECK-NEXT: ret i8 [[R]]
571 %i = icmp uge i8 %x, %y
572 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
573 %r = select i1 %i, i8 %x, i8 %m
577 define i8 @eq_xy_smax_fval(i8 %x, i8 %y) {
578 ; CHECK-LABEL: @eq_xy_smax_fval(
579 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
580 ; CHECK-NEXT: ret i8 [[M]]
582 %i = icmp eq i8 %x, %y
583 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
584 %r = select i1 %i, i8 %x, i8 %m
588 define i8 @ne_xy_smax_fval(i8 %x, i8 %y) {
589 ; CHECK-LABEL: @ne_xy_smax_fval(
590 ; CHECK-NEXT: ret i8 [[X:%.*]]
592 %i = icmp ne i8 %x, %y
593 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
594 %r = select i1 %i, i8 %x, i8 %m
600 define i8 @slt_yx_smax_fval(i8 %x, i8 %y) {
601 ; CHECK-LABEL: @slt_yx_smax_fval(
602 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
603 ; CHECK-NEXT: ret i8 [[M]]
605 %i = icmp slt i8 %y, %x
606 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
607 %r = select i1 %i, i8 %x, i8 %m
611 define i8 @sle_yx_smax_fval(i8 %x, i8 %y) {
612 ; CHECK-LABEL: @sle_yx_smax_fval(
613 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
614 ; CHECK-NEXT: ret i8 [[M]]
616 %i = icmp sle i8 %y, %x
617 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
618 %r = select i1 %i, i8 %x, i8 %m
622 define i8 @sgt_yx_smax_fval(i8 %x, i8 %y) {
623 ; CHECK-LABEL: @sgt_yx_smax_fval(
624 ; CHECK-NEXT: ret i8 [[X:%.*]]
626 %i = icmp sgt i8 %y, %x
627 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
628 %r = select i1 %i, i8 %x, i8 %m
632 define i8 @sge_yx_smax_fval(i8 %x, i8 %y) {
633 ; CHECK-LABEL: @sge_yx_smax_fval(
634 ; CHECK-NEXT: ret i8 [[X:%.*]]
636 %i = icmp sge i8 %y, %x
637 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
638 %r = select i1 %i, i8 %x, i8 %m
642 define i8 @ult_yx_smax_fval(i8 %x, i8 %y) {
643 ; CHECK-LABEL: @ult_yx_smax_fval(
644 ; CHECK-NEXT: [[I:%.*]] = icmp ult i8 [[Y:%.*]], [[X:%.*]]
645 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X]], i8 [[Y]])
646 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
647 ; CHECK-NEXT: ret i8 [[R]]
649 %i = icmp ult i8 %y, %x
650 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
651 %r = select i1 %i, i8 %x, i8 %m
655 define i8 @ule_yx_smax_fval(i8 %x, i8 %y) {
656 ; CHECK-LABEL: @ule_yx_smax_fval(
657 ; CHECK-NEXT: [[I:%.*]] = icmp ule i8 [[Y:%.*]], [[X:%.*]]
658 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y]], i8 [[X]])
659 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
660 ; CHECK-NEXT: ret i8 [[R]]
662 %i = icmp ule i8 %y, %x
663 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
664 %r = select i1 %i, i8 %x, i8 %m
668 define i8 @ugt_yx_smax_fval(i8 %x, i8 %y) {
669 ; CHECK-LABEL: @ugt_yx_smax_fval(
670 ; CHECK-NEXT: [[I:%.*]] = icmp ugt i8 [[Y:%.*]], [[X:%.*]]
671 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X]], i8 [[Y]])
672 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
673 ; CHECK-NEXT: ret i8 [[R]]
675 %i = icmp ugt i8 %y, %x
676 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
677 %r = select i1 %i, i8 %x, i8 %m
681 define i8 @uge_yx_smax_fval(i8 %x, i8 %y) {
682 ; CHECK-LABEL: @uge_yx_smax_fval(
683 ; CHECK-NEXT: [[I:%.*]] = icmp uge i8 [[Y:%.*]], [[X:%.*]]
684 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y]], i8 [[X]])
685 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
686 ; CHECK-NEXT: ret i8 [[R]]
688 %i = icmp uge i8 %y, %x
689 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
690 %r = select i1 %i, i8 %x, i8 %m
694 define i8 @eq_yx_smax_fval(i8 %x, i8 %y) {
695 ; CHECK-LABEL: @eq_yx_smax_fval(
696 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
697 ; CHECK-NEXT: ret i8 [[M]]
699 %i = icmp eq i8 %y, %x
700 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
701 %r = select i1 %i, i8 %x, i8 %m
705 define i8 @ne_yx_smax_fval(i8 %x, i8 %y) {
706 ; CHECK-LABEL: @ne_yx_smax_fval(
707 ; CHECK-NEXT: ret i8 [[X:%.*]]
709 %i = icmp ne i8 %y, %x
710 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
711 %r = select i1 %i, i8 %x, i8 %m
715 ; swap select operands
717 define i8 @slt_xy_smax_tval(i8 %x, i8 %y) {
718 ; CHECK-LABEL: @slt_xy_smax_tval(
719 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
720 ; CHECK-NEXT: ret i8 [[M]]
722 %i = icmp slt i8 %x, %y
723 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
724 %r = select i1 %i, i8 %m, i8 %x
728 define i8 @sle_xy_smax_tval(i8 %x, i8 %y) {
729 ; CHECK-LABEL: @sle_xy_smax_tval(
730 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
731 ; CHECK-NEXT: ret i8 [[M]]
733 %i = icmp sle i8 %x, %y
734 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
735 %r = select i1 %i, i8 %m, i8 %x
739 define i8 @sgt_xy_smax_tval(i8 %x, i8 %y) {
740 ; CHECK-LABEL: @sgt_xy_smax_tval(
741 ; CHECK-NEXT: ret i8 [[X:%.*]]
743 %i = icmp sgt i8 %x, %y
744 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
745 %r = select i1 %i, i8 %m, i8 %x
749 define i8 @sge_xy_smax_tval(i8 %x, i8 %y) {
750 ; CHECK-LABEL: @sge_xy_smax_tval(
751 ; CHECK-NEXT: ret i8 [[X:%.*]]
753 %i = icmp sge i8 %x, %y
754 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
755 %r = select i1 %i, i8 %m, i8 %x
759 define i8 @ult_xy_smax_tval(i8 %x, i8 %y) {
760 ; CHECK-LABEL: @ult_xy_smax_tval(
761 ; CHECK-NEXT: [[I:%.*]] = icmp ult i8 [[X:%.*]], [[Y:%.*]]
762 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X]], i8 [[Y]])
763 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
764 ; CHECK-NEXT: ret i8 [[R]]
766 %i = icmp ult i8 %x, %y
767 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
768 %r = select i1 %i, i8 %m, i8 %x
772 define i8 @ule_xy_smax_tval(i8 %x, i8 %y) {
773 ; CHECK-LABEL: @ule_xy_smax_tval(
774 ; CHECK-NEXT: [[I:%.*]] = icmp ule i8 [[X:%.*]], [[Y:%.*]]
775 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y]], i8 [[X]])
776 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
777 ; CHECK-NEXT: ret i8 [[R]]
779 %i = icmp ule i8 %x, %y
780 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
781 %r = select i1 %i, i8 %m, i8 %x
785 define i8 @ugt_xy_smax_tval(i8 %x, i8 %y) {
786 ; CHECK-LABEL: @ugt_xy_smax_tval(
787 ; CHECK-NEXT: [[I:%.*]] = icmp ugt i8 [[X:%.*]], [[Y:%.*]]
788 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X]], i8 [[Y]])
789 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
790 ; CHECK-NEXT: ret i8 [[R]]
792 %i = icmp ugt i8 %x, %y
793 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
794 %r = select i1 %i, i8 %m, i8 %x
798 define i8 @uge_xy_smax_tval(i8 %x, i8 %y) {
799 ; CHECK-LABEL: @uge_xy_smax_tval(
800 ; CHECK-NEXT: [[I:%.*]] = icmp uge i8 [[X:%.*]], [[Y:%.*]]
801 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y]], i8 [[X]])
802 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
803 ; CHECK-NEXT: ret i8 [[R]]
805 %i = icmp uge i8 %x, %y
806 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
807 %r = select i1 %i, i8 %m, i8 %x
811 define i8 @eq_xy_smax_tval(i8 %x, i8 %y) {
812 ; CHECK-LABEL: @eq_xy_smax_tval(
813 ; CHECK-NEXT: ret i8 [[X:%.*]]
815 %i = icmp eq i8 %x, %y
816 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
817 %r = select i1 %i, i8 %m, i8 %x
821 define i8 @ne_xy_smax_tval(i8 %x, i8 %y) {
822 ; CHECK-LABEL: @ne_xy_smax_tval(
823 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
824 ; CHECK-NEXT: ret i8 [[M]]
826 %i = icmp ne i8 %x, %y
827 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
828 %r = select i1 %i, i8 %m, i8 %x
832 ; swap icmp and select operands
834 define i8 @slt_yx_smax_tval(i8 %x, i8 %y) {
835 ; CHECK-LABEL: @slt_yx_smax_tval(
836 ; CHECK-NEXT: ret i8 [[X:%.*]]
838 %i = icmp slt i8 %y, %x
839 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
840 %r = select i1 %i, i8 %m, i8 %x
844 define i8 @sle_yx_smax_tval(i8 %x, i8 %y) {
845 ; CHECK-LABEL: @sle_yx_smax_tval(
846 ; CHECK-NEXT: ret i8 [[X:%.*]]
848 %i = icmp sle i8 %y, %x
849 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
850 %r = select i1 %i, i8 %m, i8 %x
854 define i8 @sgt_yx_smax_tval(i8 %x, i8 %y) {
855 ; CHECK-LABEL: @sgt_yx_smax_tval(
856 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
857 ; CHECK-NEXT: ret i8 [[M]]
859 %i = icmp sgt i8 %y, %x
860 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
861 %r = select i1 %i, i8 %m, i8 %x
865 define i8 @sge_yx_smax_tval(i8 %x, i8 %y) {
866 ; CHECK-LABEL: @sge_yx_smax_tval(
867 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
868 ; CHECK-NEXT: ret i8 [[M]]
870 %i = icmp sge i8 %y, %x
871 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
872 %r = select i1 %i, i8 %m, i8 %x
876 define i8 @ult_yx_smax_tval(i8 %x, i8 %y) {
877 ; CHECK-LABEL: @ult_yx_smax_tval(
878 ; CHECK-NEXT: [[I:%.*]] = icmp ult i8 [[Y:%.*]], [[X:%.*]]
879 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X]], i8 [[Y]])
880 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
881 ; CHECK-NEXT: ret i8 [[R]]
883 %i = icmp ult i8 %y, %x
884 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
885 %r = select i1 %i, i8 %m, i8 %x
889 define i8 @ule_yx_smax_tval(i8 %x, i8 %y) {
890 ; CHECK-LABEL: @ule_yx_smax_tval(
891 ; CHECK-NEXT: [[I:%.*]] = icmp ule i8 [[Y:%.*]], [[X:%.*]]
892 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y]], i8 [[X]])
893 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
894 ; CHECK-NEXT: ret i8 [[R]]
896 %i = icmp ule i8 %y, %x
897 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
898 %r = select i1 %i, i8 %m, i8 %x
902 define i8 @ugt_yx_smax_tval(i8 %x, i8 %y) {
903 ; CHECK-LABEL: @ugt_yx_smax_tval(
904 ; CHECK-NEXT: [[I:%.*]] = icmp ugt i8 [[Y:%.*]], [[X:%.*]]
905 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X]], i8 [[Y]])
906 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
907 ; CHECK-NEXT: ret i8 [[R]]
909 %i = icmp ugt i8 %y, %x
910 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
911 %r = select i1 %i, i8 %m, i8 %x
915 define i8 @uge_yx_smax_tval(i8 %x, i8 %y) {
916 ; CHECK-LABEL: @uge_yx_smax_tval(
917 ; CHECK-NEXT: [[I:%.*]] = icmp uge i8 [[Y:%.*]], [[X:%.*]]
918 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y]], i8 [[X]])
919 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
920 ; CHECK-NEXT: ret i8 [[R]]
922 %i = icmp uge i8 %y, %x
923 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
924 %r = select i1 %i, i8 %m, i8 %x
928 define i8 @eq_yx_smax_tval(i8 %x, i8 %y) {
929 ; CHECK-LABEL: @eq_yx_smax_tval(
930 ; CHECK-NEXT: ret i8 [[X:%.*]]
932 %i = icmp eq i8 %y, %x
933 %m = call i8 @llvm.smax.i8(i8 %x, i8 %y)
934 %r = select i1 %i, i8 %m, i8 %x
938 define i8 @ne_yx_smax_tval(i8 %x, i8 %y) {
939 ; CHECK-LABEL: @ne_yx_smax_tval(
940 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
941 ; CHECK-NEXT: ret i8 [[M]]
943 %i = icmp ne i8 %y, %x
944 %m = call i8 @llvm.smax.i8(i8 %y, i8 %x)
945 %r = select i1 %i, i8 %m, i8 %x
951 define i8 @slt_xy_umin_fval(i8 %x, i8 %y) {
952 ; CHECK-LABEL: @slt_xy_umin_fval(
953 ; CHECK-NEXT: [[I:%.*]] = icmp slt i8 [[X:%.*]], [[Y:%.*]]
954 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X]], i8 [[Y]])
955 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
956 ; CHECK-NEXT: ret i8 [[R]]
958 %i = icmp slt i8 %x, %y
959 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
960 %r = select i1 %i, i8 %x, i8 %m
964 define i8 @sle_xy_umin_fval(i8 %x, i8 %y) {
965 ; CHECK-LABEL: @sle_xy_umin_fval(
966 ; CHECK-NEXT: [[I:%.*]] = icmp sle i8 [[X:%.*]], [[Y:%.*]]
967 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y]], i8 [[X]])
968 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
969 ; CHECK-NEXT: ret i8 [[R]]
971 %i = icmp sle i8 %x, %y
972 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
973 %r = select i1 %i, i8 %x, i8 %m
977 define i8 @sgt_xy_umin_fval(i8 %x, i8 %y) {
978 ; CHECK-LABEL: @sgt_xy_umin_fval(
979 ; CHECK-NEXT: [[I:%.*]] = icmp sgt i8 [[X:%.*]], [[Y:%.*]]
980 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X]], i8 [[Y]])
981 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
982 ; CHECK-NEXT: ret i8 [[R]]
984 %i = icmp sgt i8 %x, %y
985 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
986 %r = select i1 %i, i8 %x, i8 %m
990 define i8 @sge_xy_umin_fval(i8 %x, i8 %y) {
991 ; CHECK-LABEL: @sge_xy_umin_fval(
992 ; CHECK-NEXT: [[I:%.*]] = icmp sge i8 [[X:%.*]], [[Y:%.*]]
993 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y]], i8 [[X]])
994 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
995 ; CHECK-NEXT: ret i8 [[R]]
997 %i = icmp sge i8 %x, %y
998 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
999 %r = select i1 %i, i8 %x, i8 %m
1003 define i8 @ult_xy_umin_fval(i8 %x, i8 %y) {
1004 ; CHECK-LABEL: @ult_xy_umin_fval(
1005 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1006 ; CHECK-NEXT: ret i8 [[M]]
1008 %i = icmp ult i8 %x, %y
1009 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1010 %r = select i1 %i, i8 %x, i8 %m
1014 define i8 @ule_xy_umin_fval(i8 %x, i8 %y) {
1015 ; CHECK-LABEL: @ule_xy_umin_fval(
1016 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1017 ; CHECK-NEXT: ret i8 [[M]]
1019 %i = icmp ule i8 %x, %y
1020 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1021 %r = select i1 %i, i8 %x, i8 %m
1025 define i8 @ugt_xy_umin_fval(i8 %x, i8 %y) {
1026 ; CHECK-LABEL: @ugt_xy_umin_fval(
1027 ; CHECK-NEXT: ret i8 [[X:%.*]]
1029 %i = icmp ugt i8 %x, %y
1030 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1031 %r = select i1 %i, i8 %x, i8 %m
1035 define i8 @uge_xy_umin_fval(i8 %x, i8 %y) {
1036 ; CHECK-LABEL: @uge_xy_umin_fval(
1037 ; CHECK-NEXT: ret i8 [[X:%.*]]
1039 %i = icmp uge i8 %x, %y
1040 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1041 %r = select i1 %i, i8 %x, i8 %m
1045 define i8 @eq_xy_umin_fval(i8 %x, i8 %y) {
1046 ; CHECK-LABEL: @eq_xy_umin_fval(
1047 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1048 ; CHECK-NEXT: ret i8 [[M]]
1050 %i = icmp eq i8 %x, %y
1051 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1052 %r = select i1 %i, i8 %x, i8 %m
1056 define i8 @ne_xy_umin_fval(i8 %x, i8 %y) {
1057 ; CHECK-LABEL: @ne_xy_umin_fval(
1058 ; CHECK-NEXT: ret i8 [[X:%.*]]
1060 %i = icmp ne i8 %x, %y
1061 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1062 %r = select i1 %i, i8 %x, i8 %m
1066 ; swap icmp operands
1068 define i8 @slt_yx_umin_fval(i8 %x, i8 %y) {
1069 ; CHECK-LABEL: @slt_yx_umin_fval(
1070 ; CHECK-NEXT: [[I:%.*]] = icmp slt i8 [[Y:%.*]], [[X:%.*]]
1071 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X]], i8 [[Y]])
1072 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1073 ; CHECK-NEXT: ret i8 [[R]]
1075 %i = icmp slt i8 %y, %x
1076 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1077 %r = select i1 %i, i8 %x, i8 %m
1081 define i8 @sle_yx_umin_fval(i8 %x, i8 %y) {
1082 ; CHECK-LABEL: @sle_yx_umin_fval(
1083 ; CHECK-NEXT: [[I:%.*]] = icmp sle i8 [[Y:%.*]], [[X:%.*]]
1084 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y]], i8 [[X]])
1085 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1086 ; CHECK-NEXT: ret i8 [[R]]
1088 %i = icmp sle i8 %y, %x
1089 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1090 %r = select i1 %i, i8 %x, i8 %m
1094 define i8 @sgt_yx_umin_fval(i8 %x, i8 %y) {
1095 ; CHECK-LABEL: @sgt_yx_umin_fval(
1096 ; CHECK-NEXT: [[I:%.*]] = icmp sgt i8 [[Y:%.*]], [[X:%.*]]
1097 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X]], i8 [[Y]])
1098 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1099 ; CHECK-NEXT: ret i8 [[R]]
1101 %i = icmp sgt i8 %y, %x
1102 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1103 %r = select i1 %i, i8 %x, i8 %m
1107 define i8 @sge_yx_umin_fval(i8 %x, i8 %y) {
1108 ; CHECK-LABEL: @sge_yx_umin_fval(
1109 ; CHECK-NEXT: [[I:%.*]] = icmp sge i8 [[Y:%.*]], [[X:%.*]]
1110 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y]], i8 [[X]])
1111 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1112 ; CHECK-NEXT: ret i8 [[R]]
1114 %i = icmp sge i8 %y, %x
1115 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1116 %r = select i1 %i, i8 %x, i8 %m
1120 define i8 @ult_yx_umin_fval(i8 %x, i8 %y) {
1121 ; CHECK-LABEL: @ult_yx_umin_fval(
1122 ; CHECK-NEXT: ret i8 [[X:%.*]]
1124 %i = icmp ult i8 %y, %x
1125 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1126 %r = select i1 %i, i8 %x, i8 %m
1130 define i8 @ule_yx_umin_fval(i8 %x, i8 %y) {
1131 ; CHECK-LABEL: @ule_yx_umin_fval(
1132 ; CHECK-NEXT: ret i8 [[X:%.*]]
1134 %i = icmp ule i8 %y, %x
1135 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1136 %r = select i1 %i, i8 %x, i8 %m
1140 define i8 @ugt_yx_umin_fval(i8 %x, i8 %y) {
1141 ; CHECK-LABEL: @ugt_yx_umin_fval(
1142 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1143 ; CHECK-NEXT: ret i8 [[M]]
1145 %i = icmp ugt i8 %y, %x
1146 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1147 %r = select i1 %i, i8 %x, i8 %m
1151 define i8 @uge_yx_umin_fval(i8 %x, i8 %y) {
1152 ; CHECK-LABEL: @uge_yx_umin_fval(
1153 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1154 ; CHECK-NEXT: ret i8 [[M]]
1156 %i = icmp uge i8 %y, %x
1157 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1158 %r = select i1 %i, i8 %x, i8 %m
1162 define i8 @eq_yx_umin_fval(i8 %x, i8 %y) {
1163 ; CHECK-LABEL: @eq_yx_umin_fval(
1164 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1165 ; CHECK-NEXT: ret i8 [[M]]
1167 %i = icmp eq i8 %y, %x
1168 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1169 %r = select i1 %i, i8 %x, i8 %m
1173 define i8 @ne_yx_umin_fval(i8 %x, i8 %y) {
1174 ; CHECK-LABEL: @ne_yx_umin_fval(
1175 ; CHECK-NEXT: ret i8 [[X:%.*]]
1177 %i = icmp ne i8 %y, %x
1178 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1179 %r = select i1 %i, i8 %x, i8 %m
1183 ; swap select operands
1185 define i8 @slt_xy_umin_tval(i8 %x, i8 %y) {
1186 ; CHECK-LABEL: @slt_xy_umin_tval(
1187 ; CHECK-NEXT: [[I:%.*]] = icmp slt i8 [[X:%.*]], [[Y:%.*]]
1188 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X]], i8 [[Y]])
1189 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1190 ; CHECK-NEXT: ret i8 [[R]]
1192 %i = icmp slt i8 %x, %y
1193 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1194 %r = select i1 %i, i8 %m, i8 %x
1198 define i8 @sle_xy_umin_tval(i8 %x, i8 %y) {
1199 ; CHECK-LABEL: @sle_xy_umin_tval(
1200 ; CHECK-NEXT: [[I:%.*]] = icmp sle i8 [[X:%.*]], [[Y:%.*]]
1201 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y]], i8 [[X]])
1202 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1203 ; CHECK-NEXT: ret i8 [[R]]
1205 %i = icmp sle i8 %x, %y
1206 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1207 %r = select i1 %i, i8 %m, i8 %x
1211 define i8 @sgt_xy_umin_tval(i8 %x, i8 %y) {
1212 ; CHECK-LABEL: @sgt_xy_umin_tval(
1213 ; CHECK-NEXT: [[I:%.*]] = icmp sgt i8 [[X:%.*]], [[Y:%.*]]
1214 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X]], i8 [[Y]])
1215 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1216 ; CHECK-NEXT: ret i8 [[R]]
1218 %i = icmp sgt i8 %x, %y
1219 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1220 %r = select i1 %i, i8 %m, i8 %x
1224 define i8 @sge_xy_umin_tval(i8 %x, i8 %y) {
1225 ; CHECK-LABEL: @sge_xy_umin_tval(
1226 ; CHECK-NEXT: [[I:%.*]] = icmp sge i8 [[X:%.*]], [[Y:%.*]]
1227 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y]], i8 [[X]])
1228 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1229 ; CHECK-NEXT: ret i8 [[R]]
1231 %i = icmp sge i8 %x, %y
1232 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1233 %r = select i1 %i, i8 %m, i8 %x
1237 define i8 @ult_xy_umin_tval(i8 %x, i8 %y) {
1238 ; CHECK-LABEL: @ult_xy_umin_tval(
1239 ; CHECK-NEXT: ret i8 [[X:%.*]]
1241 %i = icmp ult i8 %x, %y
1242 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1243 %r = select i1 %i, i8 %m, i8 %x
1247 define i8 @ule_xy_umin_tval(i8 %x, i8 %y) {
1248 ; CHECK-LABEL: @ule_xy_umin_tval(
1249 ; CHECK-NEXT: ret i8 [[X:%.*]]
1251 %i = icmp ule i8 %x, %y
1252 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1253 %r = select i1 %i, i8 %m, i8 %x
1257 define i8 @ugt_xy_umin_tval(i8 %x, i8 %y) {
1258 ; CHECK-LABEL: @ugt_xy_umin_tval(
1259 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1260 ; CHECK-NEXT: ret i8 [[M]]
1262 %i = icmp ugt i8 %x, %y
1263 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1264 %r = select i1 %i, i8 %m, i8 %x
1268 define i8 @uge_xy_umin_tval(i8 %x, i8 %y) {
1269 ; CHECK-LABEL: @uge_xy_umin_tval(
1270 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1271 ; CHECK-NEXT: ret i8 [[M]]
1273 %i = icmp uge i8 %x, %y
1274 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1275 %r = select i1 %i, i8 %m, i8 %x
1279 define i8 @eq_xy_umin_tval(i8 %x, i8 %y) {
1280 ; CHECK-LABEL: @eq_xy_umin_tval(
1281 ; CHECK-NEXT: ret i8 [[X:%.*]]
1283 %i = icmp eq i8 %x, %y
1284 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1285 %r = select i1 %i, i8 %m, i8 %x
1289 define i8 @ne_xy_umin_tval(i8 %x, i8 %y) {
1290 ; CHECK-LABEL: @ne_xy_umin_tval(
1291 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1292 ; CHECK-NEXT: ret i8 [[M]]
1294 %i = icmp ne i8 %x, %y
1295 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1296 %r = select i1 %i, i8 %m, i8 %x
1300 ; swap icmp and select operands
1302 define i8 @slt_yx_umin_tval(i8 %x, i8 %y) {
1303 ; CHECK-LABEL: @slt_yx_umin_tval(
1304 ; CHECK-NEXT: [[I:%.*]] = icmp slt i8 [[Y:%.*]], [[X:%.*]]
1305 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X]], i8 [[Y]])
1306 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1307 ; CHECK-NEXT: ret i8 [[R]]
1309 %i = icmp slt i8 %y, %x
1310 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1311 %r = select i1 %i, i8 %m, i8 %x
1315 define i8 @sle_yx_umin_tval(i8 %x, i8 %y) {
1316 ; CHECK-LABEL: @sle_yx_umin_tval(
1317 ; CHECK-NEXT: [[I:%.*]] = icmp sle i8 [[Y:%.*]], [[X:%.*]]
1318 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y]], i8 [[X]])
1319 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1320 ; CHECK-NEXT: ret i8 [[R]]
1322 %i = icmp sle i8 %y, %x
1323 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1324 %r = select i1 %i, i8 %m, i8 %x
1328 define i8 @sgt_yx_umin_tval(i8 %x, i8 %y) {
1329 ; CHECK-LABEL: @sgt_yx_umin_tval(
1330 ; CHECK-NEXT: [[I:%.*]] = icmp sgt i8 [[Y:%.*]], [[X:%.*]]
1331 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X]], i8 [[Y]])
1332 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1333 ; CHECK-NEXT: ret i8 [[R]]
1335 %i = icmp sgt i8 %y, %x
1336 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1337 %r = select i1 %i, i8 %m, i8 %x
1341 define i8 @sge_yx_umin_tval(i8 %x, i8 %y) {
1342 ; CHECK-LABEL: @sge_yx_umin_tval(
1343 ; CHECK-NEXT: [[I:%.*]] = icmp sge i8 [[Y:%.*]], [[X:%.*]]
1344 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y]], i8 [[X]])
1345 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1346 ; CHECK-NEXT: ret i8 [[R]]
1348 %i = icmp sge i8 %y, %x
1349 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1350 %r = select i1 %i, i8 %m, i8 %x
1354 define i8 @ult_yx_umin_tval(i8 %x, i8 %y) {
1355 ; CHECK-LABEL: @ult_yx_umin_tval(
1356 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1357 ; CHECK-NEXT: ret i8 [[M]]
1359 %i = icmp ult i8 %y, %x
1360 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1361 %r = select i1 %i, i8 %m, i8 %x
1365 define i8 @ule_yx_umin_tval(i8 %x, i8 %y) {
1366 ; CHECK-LABEL: @ule_yx_umin_tval(
1367 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1368 ; CHECK-NEXT: ret i8 [[M]]
1370 %i = icmp ule i8 %y, %x
1371 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1372 %r = select i1 %i, i8 %m, i8 %x
1376 define i8 @ugt_yx_umin_tval(i8 %x, i8 %y) {
1377 ; CHECK-LABEL: @ugt_yx_umin_tval(
1378 ; CHECK-NEXT: ret i8 [[X:%.*]]
1380 %i = icmp ugt i8 %y, %x
1381 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1382 %r = select i1 %i, i8 %m, i8 %x
1386 define i8 @uge_yx_umin_tval(i8 %x, i8 %y) {
1387 ; CHECK-LABEL: @uge_yx_umin_tval(
1388 ; CHECK-NEXT: ret i8 [[X:%.*]]
1390 %i = icmp uge i8 %y, %x
1391 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1392 %r = select i1 %i, i8 %m, i8 %x
1396 define i8 @eq_yx_umin_tval(i8 %x, i8 %y) {
1397 ; CHECK-LABEL: @eq_yx_umin_tval(
1398 ; CHECK-NEXT: ret i8 [[X:%.*]]
1400 %i = icmp eq i8 %y, %x
1401 %m = call i8 @llvm.umin.i8(i8 %x, i8 %y)
1402 %r = select i1 %i, i8 %m, i8 %x
1406 define i8 @ne_yx_umin_tval(i8 %x, i8 %y) {
1407 ; CHECK-LABEL: @ne_yx_umin_tval(
1408 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1409 ; CHECK-NEXT: ret i8 [[M]]
1411 %i = icmp ne i8 %y, %x
1412 %m = call i8 @llvm.umin.i8(i8 %y, i8 %x)
1413 %r = select i1 %i, i8 %m, i8 %x
1419 define i8 @slt_xy_umax_fval(i8 %x, i8 %y) {
1420 ; CHECK-LABEL: @slt_xy_umax_fval(
1421 ; CHECK-NEXT: [[I:%.*]] = icmp slt i8 [[X:%.*]], [[Y:%.*]]
1422 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X]], i8 [[Y]])
1423 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1424 ; CHECK-NEXT: ret i8 [[R]]
1426 %i = icmp slt i8 %x, %y
1427 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1428 %r = select i1 %i, i8 %x, i8 %m
1432 define i8 @sle_xy_umax_fval(i8 %x, i8 %y) {
1433 ; CHECK-LABEL: @sle_xy_umax_fval(
1434 ; CHECK-NEXT: [[I:%.*]] = icmp sle i8 [[X:%.*]], [[Y:%.*]]
1435 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[X]])
1436 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1437 ; CHECK-NEXT: ret i8 [[R]]
1439 %i = icmp sle i8 %x, %y
1440 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1441 %r = select i1 %i, i8 %x, i8 %m
1445 define i8 @sgt_xy_umax_fval(i8 %x, i8 %y) {
1446 ; CHECK-LABEL: @sgt_xy_umax_fval(
1447 ; CHECK-NEXT: [[I:%.*]] = icmp sgt i8 [[X:%.*]], [[Y:%.*]]
1448 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X]], i8 [[Y]])
1449 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1450 ; CHECK-NEXT: ret i8 [[R]]
1452 %i = icmp sgt i8 %x, %y
1453 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1454 %r = select i1 %i, i8 %x, i8 %m
1458 define i8 @sge_xy_umax_fval(i8 %x, i8 %y) {
1459 ; CHECK-LABEL: @sge_xy_umax_fval(
1460 ; CHECK-NEXT: [[I:%.*]] = icmp sge i8 [[X:%.*]], [[Y:%.*]]
1461 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[X]])
1462 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1463 ; CHECK-NEXT: ret i8 [[R]]
1465 %i = icmp sge i8 %x, %y
1466 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1467 %r = select i1 %i, i8 %x, i8 %m
1471 define i8 @ult_xy_umax_fval(i8 %x, i8 %y) {
1472 ; CHECK-LABEL: @ult_xy_umax_fval(
1473 ; CHECK-NEXT: ret i8 [[X:%.*]]
1475 %i = icmp ult i8 %x, %y
1476 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1477 %r = select i1 %i, i8 %x, i8 %m
1481 define i8 @ule_xy_umax_fval(i8 %x, i8 %y) {
1482 ; CHECK-LABEL: @ule_xy_umax_fval(
1483 ; CHECK-NEXT: ret i8 [[X:%.*]]
1485 %i = icmp ule i8 %x, %y
1486 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1487 %r = select i1 %i, i8 %x, i8 %m
1491 define i8 @ugt_xy_umax_fval(i8 %x, i8 %y) {
1492 ; CHECK-LABEL: @ugt_xy_umax_fval(
1493 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1494 ; CHECK-NEXT: ret i8 [[M]]
1496 %i = icmp ugt i8 %x, %y
1497 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1498 %r = select i1 %i, i8 %x, i8 %m
1502 define i8 @uge_xy_umax_fval(i8 %x, i8 %y) {
1503 ; CHECK-LABEL: @uge_xy_umax_fval(
1504 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1505 ; CHECK-NEXT: ret i8 [[M]]
1507 %i = icmp uge i8 %x, %y
1508 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1509 %r = select i1 %i, i8 %x, i8 %m
1513 define i8 @eq_xy_umax_fval(i8 %x, i8 %y) {
1514 ; CHECK-LABEL: @eq_xy_umax_fval(
1515 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1516 ; CHECK-NEXT: ret i8 [[M]]
1518 %i = icmp eq i8 %x, %y
1519 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1520 %r = select i1 %i, i8 %x, i8 %m
1524 define i8 @ne_xy_umax_fval(i8 %x, i8 %y) {
1525 ; CHECK-LABEL: @ne_xy_umax_fval(
1526 ; CHECK-NEXT: ret i8 [[X:%.*]]
1528 %i = icmp ne i8 %x, %y
1529 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1530 %r = select i1 %i, i8 %x, i8 %m
1534 ; swap icmp operands
1536 define i8 @slt_yx_umax_fval(i8 %x, i8 %y) {
1537 ; CHECK-LABEL: @slt_yx_umax_fval(
1538 ; CHECK-NEXT: [[I:%.*]] = icmp slt i8 [[Y:%.*]], [[X:%.*]]
1539 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X]], i8 [[Y]])
1540 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1541 ; CHECK-NEXT: ret i8 [[R]]
1543 %i = icmp slt i8 %y, %x
1544 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1545 %r = select i1 %i, i8 %x, i8 %m
1549 define i8 @sle_yx_umax_fval(i8 %x, i8 %y) {
1550 ; CHECK-LABEL: @sle_yx_umax_fval(
1551 ; CHECK-NEXT: [[I:%.*]] = icmp sle i8 [[Y:%.*]], [[X:%.*]]
1552 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[X]])
1553 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1554 ; CHECK-NEXT: ret i8 [[R]]
1556 %i = icmp sle i8 %y, %x
1557 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1558 %r = select i1 %i, i8 %x, i8 %m
1562 define i8 @sgt_yx_umax_fval(i8 %x, i8 %y) {
1563 ; CHECK-LABEL: @sgt_yx_umax_fval(
1564 ; CHECK-NEXT: [[I:%.*]] = icmp sgt i8 [[Y:%.*]], [[X:%.*]]
1565 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X]], i8 [[Y]])
1566 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1567 ; CHECK-NEXT: ret i8 [[R]]
1569 %i = icmp sgt i8 %y, %x
1570 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1571 %r = select i1 %i, i8 %x, i8 %m
1575 define i8 @sge_yx_umax_fval(i8 %x, i8 %y) {
1576 ; CHECK-LABEL: @sge_yx_umax_fval(
1577 ; CHECK-NEXT: [[I:%.*]] = icmp sge i8 [[Y:%.*]], [[X:%.*]]
1578 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[X]])
1579 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[X]], i8 [[M]]
1580 ; CHECK-NEXT: ret i8 [[R]]
1582 %i = icmp sge i8 %y, %x
1583 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1584 %r = select i1 %i, i8 %x, i8 %m
1588 define i8 @ult_yx_umax_fval(i8 %x, i8 %y) {
1589 ; CHECK-LABEL: @ult_yx_umax_fval(
1590 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1591 ; CHECK-NEXT: ret i8 [[M]]
1593 %i = icmp ult i8 %y, %x
1594 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1595 %r = select i1 %i, i8 %x, i8 %m
1599 define i8 @ule_yx_umax_fval(i8 %x, i8 %y) {
1600 ; CHECK-LABEL: @ule_yx_umax_fval(
1601 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1602 ; CHECK-NEXT: ret i8 [[M]]
1604 %i = icmp ule i8 %y, %x
1605 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1606 %r = select i1 %i, i8 %x, i8 %m
1610 define i8 @ugt_yx_umax_fval(i8 %x, i8 %y) {
1611 ; CHECK-LABEL: @ugt_yx_umax_fval(
1612 ; CHECK-NEXT: ret i8 [[X:%.*]]
1614 %i = icmp ugt i8 %y, %x
1615 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1616 %r = select i1 %i, i8 %x, i8 %m
1620 define i8 @uge_yx_umax_fval(i8 %x, i8 %y) {
1621 ; CHECK-LABEL: @uge_yx_umax_fval(
1622 ; CHECK-NEXT: ret i8 [[X:%.*]]
1624 %i = icmp uge i8 %y, %x
1625 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1626 %r = select i1 %i, i8 %x, i8 %m
1630 define i8 @eq_yx_umax_fval(i8 %x, i8 %y) {
1631 ; CHECK-LABEL: @eq_yx_umax_fval(
1632 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1633 ; CHECK-NEXT: ret i8 [[M]]
1635 %i = icmp eq i8 %y, %x
1636 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1637 %r = select i1 %i, i8 %x, i8 %m
1641 define i8 @ne_yx_umax_fval(i8 %x, i8 %y) {
1642 ; CHECK-LABEL: @ne_yx_umax_fval(
1643 ; CHECK-NEXT: ret i8 [[X:%.*]]
1645 %i = icmp ne i8 %y, %x
1646 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1647 %r = select i1 %i, i8 %x, i8 %m
1651 ; swap select operands
1653 define i8 @slt_xy_umax_tval(i8 %x, i8 %y) {
1654 ; CHECK-LABEL: @slt_xy_umax_tval(
1655 ; CHECK-NEXT: [[I:%.*]] = icmp slt i8 [[X:%.*]], [[Y:%.*]]
1656 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X]], i8 [[Y]])
1657 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1658 ; CHECK-NEXT: ret i8 [[R]]
1660 %i = icmp slt i8 %x, %y
1661 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1662 %r = select i1 %i, i8 %m, i8 %x
1666 define i8 @sle_xy_umax_tval(i8 %x, i8 %y) {
1667 ; CHECK-LABEL: @sle_xy_umax_tval(
1668 ; CHECK-NEXT: [[I:%.*]] = icmp sle i8 [[X:%.*]], [[Y:%.*]]
1669 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[X]])
1670 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1671 ; CHECK-NEXT: ret i8 [[R]]
1673 %i = icmp sle i8 %x, %y
1674 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1675 %r = select i1 %i, i8 %m, i8 %x
1679 define i8 @sgt_xy_umax_tval(i8 %x, i8 %y) {
1680 ; CHECK-LABEL: @sgt_xy_umax_tval(
1681 ; CHECK-NEXT: [[I:%.*]] = icmp sgt i8 [[X:%.*]], [[Y:%.*]]
1682 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X]], i8 [[Y]])
1683 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1684 ; CHECK-NEXT: ret i8 [[R]]
1686 %i = icmp sgt i8 %x, %y
1687 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1688 %r = select i1 %i, i8 %m, i8 %x
1692 define i8 @sge_xy_umax_tval(i8 %x, i8 %y) {
1693 ; CHECK-LABEL: @sge_xy_umax_tval(
1694 ; CHECK-NEXT: [[I:%.*]] = icmp sge i8 [[X:%.*]], [[Y:%.*]]
1695 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[X]])
1696 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1697 ; CHECK-NEXT: ret i8 [[R]]
1699 %i = icmp sge i8 %x, %y
1700 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1701 %r = select i1 %i, i8 %m, i8 %x
1705 define i8 @ult_xy_umax_tval(i8 %x, i8 %y) {
1706 ; CHECK-LABEL: @ult_xy_umax_tval(
1707 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1708 ; CHECK-NEXT: ret i8 [[M]]
1710 %i = icmp ult i8 %x, %y
1711 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1712 %r = select i1 %i, i8 %m, i8 %x
1716 define i8 @ule_xy_umax_tval(i8 %x, i8 %y) {
1717 ; CHECK-LABEL: @ule_xy_umax_tval(
1718 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1719 ; CHECK-NEXT: ret i8 [[M]]
1721 %i = icmp ule i8 %x, %y
1722 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1723 %r = select i1 %i, i8 %m, i8 %x
1727 define i8 @ugt_xy_umax_tval(i8 %x, i8 %y) {
1728 ; CHECK-LABEL: @ugt_xy_umax_tval(
1729 ; CHECK-NEXT: ret i8 [[X:%.*]]
1731 %i = icmp ugt i8 %x, %y
1732 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1733 %r = select i1 %i, i8 %m, i8 %x
1737 define i8 @uge_xy_umax_tval(i8 %x, i8 %y) {
1738 ; CHECK-LABEL: @uge_xy_umax_tval(
1739 ; CHECK-NEXT: ret i8 [[X:%.*]]
1741 %i = icmp uge i8 %x, %y
1742 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1743 %r = select i1 %i, i8 %m, i8 %x
1747 define i8 @eq_xy_umax_tval(i8 %x, i8 %y) {
1748 ; CHECK-LABEL: @eq_xy_umax_tval(
1749 ; CHECK-NEXT: ret i8 [[X:%.*]]
1751 %i = icmp eq i8 %x, %y
1752 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1753 %r = select i1 %i, i8 %m, i8 %x
1757 define i8 @ne_xy_umax_tval(i8 %x, i8 %y) {
1758 ; CHECK-LABEL: @ne_xy_umax_tval(
1759 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1760 ; CHECK-NEXT: ret i8 [[M]]
1762 %i = icmp ne i8 %x, %y
1763 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1764 %r = select i1 %i, i8 %m, i8 %x
1768 ; swap icmp and select operands
1770 define i8 @slt_yx_umax_tval(i8 %x, i8 %y) {
1771 ; CHECK-LABEL: @slt_yx_umax_tval(
1772 ; CHECK-NEXT: [[I:%.*]] = icmp slt i8 [[Y:%.*]], [[X:%.*]]
1773 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X]], i8 [[Y]])
1774 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1775 ; CHECK-NEXT: ret i8 [[R]]
1777 %i = icmp slt i8 %y, %x
1778 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1779 %r = select i1 %i, i8 %m, i8 %x
1783 define i8 @sle_yx_umax_tval(i8 %x, i8 %y) {
1784 ; CHECK-LABEL: @sle_yx_umax_tval(
1785 ; CHECK-NEXT: [[I:%.*]] = icmp sle i8 [[Y:%.*]], [[X:%.*]]
1786 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[X]])
1787 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1788 ; CHECK-NEXT: ret i8 [[R]]
1790 %i = icmp sle i8 %y, %x
1791 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1792 %r = select i1 %i, i8 %m, i8 %x
1796 define i8 @sgt_yx_umax_tval(i8 %x, i8 %y) {
1797 ; CHECK-LABEL: @sgt_yx_umax_tval(
1798 ; CHECK-NEXT: [[I:%.*]] = icmp sgt i8 [[Y:%.*]], [[X:%.*]]
1799 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X]], i8 [[Y]])
1800 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1801 ; CHECK-NEXT: ret i8 [[R]]
1803 %i = icmp sgt i8 %y, %x
1804 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1805 %r = select i1 %i, i8 %m, i8 %x
1809 define i8 @sge_yx_umax_tval(i8 %x, i8 %y) {
1810 ; CHECK-LABEL: @sge_yx_umax_tval(
1811 ; CHECK-NEXT: [[I:%.*]] = icmp sge i8 [[Y:%.*]], [[X:%.*]]
1812 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[X]])
1813 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1814 ; CHECK-NEXT: ret i8 [[R]]
1816 %i = icmp sge i8 %y, %x
1817 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1818 %r = select i1 %i, i8 %m, i8 %x
1822 define i8 @ult_yx_umax_tval(i8 %x, i8 %y) {
1823 ; CHECK-LABEL: @ult_yx_umax_tval(
1824 ; CHECK-NEXT: ret i8 [[X:%.*]]
1826 %i = icmp ult i8 %y, %x
1827 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1828 %r = select i1 %i, i8 %m, i8 %x
1832 define i8 @ule_yx_umax_tval(i8 %x, i8 %y) {
1833 ; CHECK-LABEL: @ule_yx_umax_tval(
1834 ; CHECK-NEXT: ret i8 [[X:%.*]]
1836 %i = icmp ule i8 %y, %x
1837 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1838 %r = select i1 %i, i8 %m, i8 %x
1842 define i8 @ugt_yx_umax_tval(i8 %x, i8 %y) {
1843 ; CHECK-LABEL: @ugt_yx_umax_tval(
1844 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X:%.*]], i8 [[Y:%.*]])
1845 ; CHECK-NEXT: ret i8 [[M]]
1847 %i = icmp ugt i8 %y, %x
1848 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1849 %r = select i1 %i, i8 %m, i8 %x
1853 define i8 @uge_yx_umax_tval(i8 %x, i8 %y) {
1854 ; CHECK-LABEL: @uge_yx_umax_tval(
1855 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1856 ; CHECK-NEXT: ret i8 [[M]]
1858 %i = icmp uge i8 %y, %x
1859 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1860 %r = select i1 %i, i8 %m, i8 %x
1864 define i8 @eq_yx_umax_tval(i8 %x, i8 %y) {
1865 ; CHECK-LABEL: @eq_yx_umax_tval(
1866 ; CHECK-NEXT: ret i8 [[X:%.*]]
1868 %i = icmp eq i8 %y, %x
1869 %m = call i8 @llvm.umax.i8(i8 %x, i8 %y)
1870 %r = select i1 %i, i8 %m, i8 %x
1874 define i8 @ne_yx_umax_tval(i8 %x, i8 %y) {
1875 ; CHECK-LABEL: @ne_yx_umax_tval(
1876 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y:%.*]], i8 [[X:%.*]])
1877 ; CHECK-NEXT: ret i8 [[M]]
1879 %i = icmp ne i8 %y, %x
1880 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1881 %r = select i1 %i, i8 %m, i8 %x
1885 ; negative test - wrong cmp op
1887 define i8 @ne_yz_umax_tval(i8 %x, i8 %y, i8 %z) {
1888 ; CHECK-LABEL: @ne_yz_umax_tval(
1889 ; CHECK-NEXT: [[I:%.*]] = icmp ne i8 [[Y:%.*]], [[Z:%.*]]
1890 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[X:%.*]])
1891 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1892 ; CHECK-NEXT: ret i8 [[R]]
1894 %i = icmp ne i8 %y, %z
1895 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1896 %r = select i1 %i, i8 %m, i8 %x
1900 ; negative test - wrong max op
1902 define i8 @ne_yx_umax_tval_wrong_op(i8 %x, i8 %y, i8 %z) {
1903 ; CHECK-LABEL: @ne_yx_umax_tval_wrong_op(
1904 ; CHECK-NEXT: [[I:%.*]] = icmp ne i8 [[Y:%.*]], [[X:%.*]]
1905 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Z:%.*]], i8 [[X]])
1906 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1907 ; CHECK-NEXT: ret i8 [[R]]
1909 %i = icmp ne i8 %y, %x
1910 %m = call i8 @llvm.umax.i8(i8 %z, i8 %x)
1911 %r = select i1 %i, i8 %m, i8 %x
1915 ; negative test - wrong cmp op
1917 define i8 @eq_yz_umax_tval(i8 %x, i8 %y, i8 %z) {
1918 ; CHECK-LABEL: @eq_yz_umax_tval(
1919 ; CHECK-NEXT: [[I:%.*]] = icmp eq i8 [[Y:%.*]], [[Z:%.*]]
1920 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Y]], i8 [[X:%.*]])
1921 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1922 ; CHECK-NEXT: ret i8 [[R]]
1924 %i = icmp eq i8 %y, %z
1925 %m = call i8 @llvm.umax.i8(i8 %y, i8 %x)
1926 %r = select i1 %i, i8 %m, i8 %x
1930 ; negative test - wrong max op
1932 define i8 @eq_yx_umax_tval_wrong_op(i8 %x, i8 %y, i8 %z) {
1933 ; CHECK-LABEL: @eq_yx_umax_tval_wrong_op(
1934 ; CHECK-NEXT: [[I:%.*]] = icmp eq i8 [[Y:%.*]], [[X:%.*]]
1935 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[Z:%.*]], i8 [[X]])
1936 ; CHECK-NEXT: [[R:%.*]] = select i1 [[I]], i8 [[M]], i8 [[X]]
1937 ; CHECK-NEXT: ret i8 [[R]]
1939 %i = icmp eq i8 %y, %x
1940 %m = call i8 @llvm.umax.i8(i8 %z, i8 %x)
1941 %r = select i1 %i, i8 %m, i8 %x
1945 ; select with smin pred
1947 define <4 x i8> @slt_xy_smin_select_y_shuf_fval(<4 x i8> %x, <4 x i8> %y) {
1948 ; CHECK-LABEL: @slt_xy_smin_select_y_shuf_fval(
1949 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.smin.v4i8(<4 x i8> [[X:%.*]], <4 x i8> [[Y:%.*]])
1950 ; CHECK-NEXT: ret <4 x i8> [[M]]
1952 %i = icmp slt <4 x i8> %x, %y
1953 %m = call <4 x i8> @llvm.smin.v4i8(<4 x i8> %x, <4 x i8> %y)
1954 %s = shufflevector <4 x i8> %y, <4 x i8> %m, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
1955 %r = select <4 x i1> %i, <4 x i8> %x, <4 x i8> %s
1959 ; negative test - wrong pred
1961 define <4 x i8> @sgt_xy_smin_select_y_shuf_fval(<4 x i8> %x, <4 x i8> %y) {
1962 ; CHECK-LABEL: @sgt_xy_smin_select_y_shuf_fval(
1963 ; CHECK-NEXT: [[I:%.*]] = icmp sgt <4 x i8> [[X:%.*]], [[Y:%.*]]
1964 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.smin.v4i8(<4 x i8> [[X]], <4 x i8> [[Y]])
1965 ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x i8> [[Y]], <4 x i8> [[M]], <4 x i32> <i32 0, i32 1, i32 6, i32 7>
1966 ; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[I]], <4 x i8> [[X]], <4 x i8> [[S]]
1967 ; CHECK-NEXT: ret <4 x i8> [[R]]
1969 %i = icmp sgt <4 x i8> %x, %y
1970 %m = call <4 x i8> @llvm.smin.v4i8(<4 x i8> %x, <4 x i8> %y)
1971 %s = shufflevector <4 x i8> %y, <4 x i8> %m, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
1972 %r = select <4 x i1> %i, <4 x i8> %x, <4 x i8> %s
1976 ; negative test - wrong shuffle op
1978 define <4 x i8> @slt_xy_smin_select_x_shuf_fval(<4 x i8> %x, <4 x i8> %y) {
1979 ; CHECK-LABEL: @slt_xy_smin_select_x_shuf_fval(
1980 ; CHECK-NEXT: [[I:%.*]] = icmp slt <4 x i8> [[X:%.*]], [[Y:%.*]]
1981 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.smin.v4i8(<4 x i8> [[X]], <4 x i8> [[Y]])
1982 ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x i8> [[X]], <4 x i8> [[M]], <4 x i32> <i32 0, i32 1, i32 6, i32 7>
1983 ; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[I]], <4 x i8> [[X]], <4 x i8> [[S]]
1984 ; CHECK-NEXT: ret <4 x i8> [[R]]
1986 %i = icmp slt <4 x i8> %x, %y
1987 %m = call <4 x i8> @llvm.smin.v4i8(<4 x i8> %x, <4 x i8> %y)
1988 %s = shufflevector <4 x i8> %x, <4 x i8> %m, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
1989 %r = select <4 x i1> %i, <4 x i8> %x, <4 x i8> %s
1993 ; select with non-strict smax pred
1995 define <4 x i8> @sge_xy_smax_select_y_shuf_fval(<4 x i8> %x, <4 x i8> %y) {
1996 ; CHECK-LABEL: @sge_xy_smax_select_y_shuf_fval(
1997 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.smax.v4i8(<4 x i8> [[Y:%.*]], <4 x i8> [[X:%.*]])
1998 ; CHECK-NEXT: ret <4 x i8> [[M]]
2000 %i = icmp sge <4 x i8> %x, %y
2001 %m = call <4 x i8> @llvm.smax.v4i8(<4 x i8> %y, <4 x i8> %x)
2002 %s = shufflevector <4 x i8> %y, <4 x i8> %m, <4 x i32> <i32 4, i32 1, i32 6, i32 3>
2003 %r = select <4 x i1> %i, <4 x i8> %x, <4 x i8> %s
2007 ; negative test - wrong (swapped) pred
2009 define <4 x i8> @sle_yx_smax_select_y_shuf_fval(<4 x i8> %x, <4 x i8> %y) {
2010 ; CHECK-LABEL: @sle_yx_smax_select_y_shuf_fval(
2011 ; CHECK-NEXT: [[I:%.*]] = icmp sge <4 x i8> [[Y:%.*]], [[X:%.*]]
2012 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.smax.v4i8(<4 x i8> [[Y]], <4 x i8> [[X]])
2013 ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x i8> [[Y]], <4 x i8> [[M]], <4 x i32> <i32 4, i32 1, i32 6, i32 3>
2014 ; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[I]], <4 x i8> [[X]], <4 x i8> [[S]]
2015 ; CHECK-NEXT: ret <4 x i8> [[R]]
2017 %i = icmp sge <4 x i8> %y, %x
2018 %m = call <4 x i8> @llvm.smax.v4i8(<4 x i8> %y, <4 x i8> %x)
2019 %s = shufflevector <4 x i8> %y, <4 x i8> %m, <4 x i32> <i32 4, i32 1, i32 6, i32 3>
2020 %r = select <4 x i1> %i, <4 x i8> %x, <4 x i8> %s
2024 ; negative test - wrong shuffle op
2026 define <4 x i8> @sge_xy_smax_select_x_shuf_fval(<4 x i8> %x, <4 x i8> %y) {
2027 ; CHECK-LABEL: @sge_xy_smax_select_x_shuf_fval(
2028 ; CHECK-NEXT: [[I:%.*]] = icmp sge <4 x i8> [[X:%.*]], [[Y:%.*]]
2029 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.smax.v4i8(<4 x i8> [[Y]], <4 x i8> [[X]])
2030 ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x i8> [[X]], <4 x i8> [[M]], <4 x i32> <i32 4, i32 1, i32 6, i32 3>
2031 ; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[I]], <4 x i8> [[X]], <4 x i8> [[S]]
2032 ; CHECK-NEXT: ret <4 x i8> [[R]]
2034 %i = icmp sge <4 x i8> %x, %y
2035 %m = call <4 x i8> @llvm.smax.v4i8(<4 x i8> %y, <4 x i8> %x)
2036 %s = shufflevector <4 x i8> %x, <4 x i8> %m, <4 x i32> <i32 4, i32 1, i32 6, i32 3>
2037 %r = select <4 x i1> %i, <4 x i8> %x, <4 x i8> %s
2041 ; select with non-strict inverted umin pred
2043 define <4 x i8> @uge_xy_umin_select_y_shuf_tval(<4 x i8> %x, <4 x i8> %y) {
2044 ; CHECK-LABEL: @uge_xy_umin_select_y_shuf_tval(
2045 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.umin.v4i8(<4 x i8> [[X:%.*]], <4 x i8> [[Y:%.*]])
2046 ; CHECK-NEXT: ret <4 x i8> [[M]]
2048 %i = icmp uge <4 x i8> %x, %y
2049 %m = call <4 x i8> @llvm.umin.v4i8(<4 x i8> %x, <4 x i8> %y)
2050 %s = shufflevector <4 x i8> %m, <4 x i8> %y, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
2051 %r = select <4 x i1> %i, <4 x i8> %s, <4 x i8> %x
2055 ; negative test - wrong pred
2057 define <4 x i8> @uge_xy_umin_select_y_shuf_fval(<4 x i8> %x, <4 x i8> %y) {
2058 ; CHECK-LABEL: @uge_xy_umin_select_y_shuf_fval(
2059 ; CHECK-NEXT: [[I:%.*]] = icmp uge <4 x i8> [[X:%.*]], [[Y:%.*]]
2060 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.umin.v4i8(<4 x i8> [[X]], <4 x i8> [[Y]])
2061 ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x i8> [[M]], <4 x i8> [[Y]], <4 x i32> <i32 0, i32 1, i32 2, i32 7>
2062 ; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[I]], <4 x i8> [[X]], <4 x i8> [[S]]
2063 ; CHECK-NEXT: ret <4 x i8> [[R]]
2065 %i = icmp uge <4 x i8> %x, %y
2066 %m = call <4 x i8> @llvm.umin.v4i8(<4 x i8> %x, <4 x i8> %y)
2067 %s = shufflevector <4 x i8> %m, <4 x i8> %y, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
2068 %r = select <4 x i1> %i, <4 x i8> %x, <4 x i8> %s
2072 ; negative test - wrong shuffle op
2074 define <4 x i8> @uge_xy_umin_select_x_shuf_tval(<4 x i8> %x, <4 x i8> %y) {
2075 ; CHECK-LABEL: @uge_xy_umin_select_x_shuf_tval(
2076 ; CHECK-NEXT: [[I:%.*]] = icmp uge <4 x i8> [[X:%.*]], [[Y:%.*]]
2077 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.umin.v4i8(<4 x i8> [[X]], <4 x i8> [[Y]])
2078 ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x i8> [[M]], <4 x i8> [[X]], <4 x i32> <i32 0, i32 1, i32 2, i32 7>
2079 ; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[I]], <4 x i8> [[S]], <4 x i8> [[X]]
2080 ; CHECK-NEXT: ret <4 x i8> [[R]]
2082 %i = icmp uge <4 x i8> %x, %y
2083 %m = call <4 x i8> @llvm.umin.v4i8(<4 x i8> %x, <4 x i8> %y)
2084 %s = shufflevector <4 x i8> %m, <4 x i8> %x, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
2085 %r = select <4 x i1> %i, <4 x i8> %s, <4 x i8> %x
2089 ; select with swapped umax pred
2091 define <4 x i8> @ult_yx_umax_select_y_shuf_fval(<4 x i8> %x, <4 x i8> %y) {
2092 ; CHECK-LABEL: @ult_yx_umax_select_y_shuf_fval(
2093 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.umax.v4i8(<4 x i8> [[Y:%.*]], <4 x i8> [[X:%.*]])
2094 ; CHECK-NEXT: ret <4 x i8> [[M]]
2096 %i = icmp ult <4 x i8> %y, %x
2097 %m = call <4 x i8> @llvm.umax.v4i8(<4 x i8> %y, <4 x i8> %x)
2098 %s = shufflevector <4 x i8> %y, <4 x i8> %m, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
2099 %r = select <4 x i1> %i, <4 x i8> %x, <4 x i8> %s
2103 ; negative test - wrong (inverted+swapped) pred
2105 define <4 x i8> @ult_yx_umax_select_y_shuf_tval(<4 x i8> %x, <4 x i8> %y) {
2106 ; CHECK-LABEL: @ult_yx_umax_select_y_shuf_tval(
2107 ; CHECK-NEXT: [[I:%.*]] = icmp ult <4 x i8> [[Y:%.*]], [[X:%.*]]
2108 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.umax.v4i8(<4 x i8> [[Y]], <4 x i8> [[X]])
2109 ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x i8> [[Y]], <4 x i8> [[M]], <4 x i32> <i32 4, i32 1, i32 2, i32 3>
2110 ; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[I]], <4 x i8> [[S]], <4 x i8> [[X]]
2111 ; CHECK-NEXT: ret <4 x i8> [[R]]
2113 %i = icmp ult <4 x i8> %y, %x
2114 %m = call <4 x i8> @llvm.umax.v4i8(<4 x i8> %y, <4 x i8> %x)
2115 %s = shufflevector <4 x i8> %y, <4 x i8> %m, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
2116 %r = select <4 x i1> %i, <4 x i8> %s, <4 x i8> %x
2120 ; negative test - wrong shuffle mask
2122 define <4 x i8> @ult_yx_umax_select_y_shuf_mask_fval(<4 x i8> %x, <4 x i8> %y) {
2123 ; CHECK-LABEL: @ult_yx_umax_select_y_shuf_mask_fval(
2124 ; CHECK-NEXT: [[I:%.*]] = icmp ult <4 x i8> [[Y:%.*]], [[X:%.*]]
2125 ; CHECK-NEXT: [[M:%.*]] = call <4 x i8> @llvm.umax.v4i8(<4 x i8> [[Y]], <4 x i8> [[X]])
2126 ; CHECK-NEXT: [[S:%.*]] = shufflevector <4 x i8> [[Y]], <4 x i8> [[M]], <4 x i32> <i32 5, i32 1, i32 2, i32 3>
2127 ; CHECK-NEXT: [[R:%.*]] = select <4 x i1> [[I]], <4 x i8> [[X]], <4 x i8> [[S]]
2128 ; CHECK-NEXT: ret <4 x i8> [[R]]
2130 %i = icmp ult <4 x i8> %y, %x
2131 %m = call <4 x i8> @llvm.umax.v4i8(<4 x i8> %y, <4 x i8> %x)
2132 %s = shufflevector <4 x i8> %y, <4 x i8> %m, <4 x i32> <i32 5, i32 1, i32 2, i32 3>
2133 %r = select <4 x i1> %i, <4 x i8> %x, <4 x i8> %s
2137 define i8 @select_umin_with_icmp_zero(i8 %x, i8 %y) {
2138 ; CHECK-LABEL: @select_umin_with_icmp_zero(
2139 ; CHECK-NEXT: ret i8 0
2141 %min = call i8 @llvm.umin.i8(i8 %x, i8 %y)
2142 %cmp = icmp eq i8 %x, 0
2143 %sel = select i1 %cmp, i8 %min, i8 0