1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=bdce < %s | FileCheck %s
4 declare i8 @llvm.umax.i8(i8, i8)
5 declare i8 @llvm.umin.i8(i8, i8)
6 declare i8 @llvm.smax.i8(i8, i8)
7 declare i8 @llvm.smin.i8(i8, i8)
9 define i8 @umax(i8 %x, i8 %y, i1 %a, i1 %b) {
11 ; CHECK-NEXT: [[A2:%.*]] = zext i1 false to i8
12 ; CHECK-NEXT: [[B2:%.*]] = zext i1 false to i8
13 ; CHECK-NEXT: [[X2:%.*]] = or i8 [[X:%.*]], [[A2]]
14 ; CHECK-NEXT: [[Y2:%.*]] = or i8 [[Y:%.*]], [[B2]]
15 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umax.i8(i8 [[X2]], i8 [[Y2]])
16 ; CHECK-NEXT: [[R:%.*]] = lshr i8 [[M]], 1
17 ; CHECK-NEXT: ret i8 [[R]]
19 %a2 = zext i1 %a to i8
20 %b2 = zext i1 %b to i8
23 %m = call i8 @llvm.umax.i8(i8 %x2, i8 %y2)
28 define i8 @umin(i8 %x, i8 %y, i1 %a, i1 %b) {
30 ; CHECK-NEXT: [[A2:%.*]] = zext i1 false to i8
31 ; CHECK-NEXT: [[B2:%.*]] = zext i1 false to i8
32 ; CHECK-NEXT: [[X2:%.*]] = or i8 [[X:%.*]], [[A2]]
33 ; CHECK-NEXT: [[Y2:%.*]] = or i8 [[Y:%.*]], [[B2]]
34 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.umin.i8(i8 [[X2]], i8 [[Y2]])
35 ; CHECK-NEXT: [[R:%.*]] = lshr i8 [[M]], 1
36 ; CHECK-NEXT: ret i8 [[R]]
38 %a2 = zext i1 %a to i8
39 %b2 = zext i1 %b to i8
42 %m = call i8 @llvm.umin.i8(i8 %x2, i8 %y2)
47 define i8 @smax(i8 %x, i8 %y, i1 %a, i1 %b) {
49 ; CHECK-NEXT: [[A2:%.*]] = zext i1 false to i8
50 ; CHECK-NEXT: [[B2:%.*]] = zext i1 false to i8
51 ; CHECK-NEXT: [[X2:%.*]] = or i8 [[X:%.*]], [[A2]]
52 ; CHECK-NEXT: [[Y2:%.*]] = or i8 [[Y:%.*]], [[B2]]
53 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smax.i8(i8 [[X2]], i8 [[Y2]])
54 ; CHECK-NEXT: [[R:%.*]] = lshr i8 [[M]], 1
55 ; CHECK-NEXT: ret i8 [[R]]
57 %a2 = zext i1 %a to i8
58 %b2 = zext i1 %b to i8
61 %m = call i8 @llvm.smax.i8(i8 %x2, i8 %y2)
66 define i8 @smin(i8 %x, i8 %y, i1 %a, i1 %b) {
68 ; CHECK-NEXT: [[A2:%.*]] = zext i1 false to i8
69 ; CHECK-NEXT: [[B2:%.*]] = zext i1 false to i8
70 ; CHECK-NEXT: [[X2:%.*]] = or i8 [[X:%.*]], [[A2]]
71 ; CHECK-NEXT: [[Y2:%.*]] = or i8 [[Y:%.*]], [[B2]]
72 ; CHECK-NEXT: [[M:%.*]] = call i8 @llvm.smin.i8(i8 [[X2]], i8 [[Y2]])
73 ; CHECK-NEXT: [[R:%.*]] = lshr i8 [[M]], 1
74 ; CHECK-NEXT: ret i8 [[R]]
76 %a2 = zext i1 %a to i8
77 %b2 = zext i1 %b to i8
80 %m = call i8 @llvm.smin.i8(i8 %x2, i8 %y2)