1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -instcombine -S | FileCheck %s
7 ; @llvm.sub.with.overflow(%x, %y) + extractvalue
9 define i1 @t0_basic(i8 %x, i8 %y) {
10 ; CHECK-LABEL: @t0_basic(
11 ; CHECK-NEXT: [[R:%.*]] = icmp ugt i8 [[Y:%.*]], [[X:%.*]]
12 ; CHECK-NEXT: ret i1 [[R]]
15 %r = icmp ugt i8 %t0, %x
19 define <2 x i1> @t1_vec(<2 x i8> %x, <2 x i8> %y) {
20 ; CHECK-LABEL: @t1_vec(
21 ; CHECK-NEXT: [[R:%.*]] = icmp ugt <2 x i8> [[Y:%.*]], [[X:%.*]]
22 ; CHECK-NEXT: ret <2 x i1> [[R]]
24 %t0 = sub <2 x i8> %x, %y
25 %r = icmp ugt <2 x i8> %t0, %x
31 define i1 @t2_commutative(i8 %x, i8 %y) {
32 ; CHECK-LABEL: @t2_commutative(
33 ; CHECK-NEXT: [[R:%.*]] = icmp ugt i8 [[Y:%.*]], [[X:%.*]]
34 ; CHECK-NEXT: ret i1 [[R]]
37 %r = icmp ult i8 %x, %t0 ; swapped
43 declare void @use8(i8)
45 define i1 @t3_extrause0(i8 %x, i8 %y) {
46 ; CHECK-LABEL: @t3_extrause0(
47 ; CHECK-NEXT: [[T0:%.*]] = sub i8 [[X:%.*]], [[Y:%.*]]
48 ; CHECK-NEXT: call void @use8(i8 [[T0]])
49 ; CHECK-NEXT: [[R:%.*]] = icmp ult i8 [[X]], [[Y]]
50 ; CHECK-NEXT: ret i1 [[R]]
53 call void @use8(i8 %t0)
54 %r = icmp ugt i8 %t0, %x
60 define i1 @n4_not_commutative(i8 %x, i8 %y) {
61 ; CHECK-LABEL: @n4_not_commutative(
62 ; CHECK-NEXT: [[T0:%.*]] = sub i8 [[X:%.*]], [[Y:%.*]]
63 ; CHECK-NEXT: [[R:%.*]] = icmp ugt i8 [[T0]], [[Y]]
64 ; CHECK-NEXT: ret i1 [[R]]
67 %r = icmp ugt i8 %t0, %y ; can't check against %y.
71 define i1 @n5_wrong_pred0(i8 %x, i8 %y) {
72 ; CHECK-LABEL: @n5_wrong_pred0(
73 ; CHECK-NEXT: [[T0:%.*]] = sub i8 [[X:%.*]], [[Y:%.*]]
74 ; CHECK-NEXT: [[R:%.*]] = icmp uge i8 [[T0]], [[X]]
75 ; CHECK-NEXT: ret i1 [[R]]
78 %r = icmp uge i8 %t0, %x
82 define i1 @n6_wrong_pred1(i8 %x, i8 %y) {
83 ; CHECK-LABEL: @n6_wrong_pred1(
84 ; CHECK-NEXT: [[T0:%.*]] = sub i8 [[X:%.*]], [[Y:%.*]]
85 ; CHECK-NEXT: [[R:%.*]] = icmp ult i8 [[T0]], [[X]]
86 ; CHECK-NEXT: ret i1 [[R]]
89 %r = icmp ult i8 %t0, %x
93 define i1 @n7_wrong_pred2(i8 %x, i8 %y) {
94 ; CHECK-LABEL: @n7_wrong_pred2(
95 ; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[Y:%.*]], 0
96 ; CHECK-NEXT: ret i1 [[R]]
99 %r = icmp eq i8 %t0, %x
103 define i1 @n8_wrong_pred3(i8 %x, i8 %y) {
104 ; CHECK-LABEL: @n8_wrong_pred3(
105 ; CHECK-NEXT: [[R:%.*]] = icmp ne i8 [[Y:%.*]], 0
106 ; CHECK-NEXT: ret i1 [[R]]
109 %r = icmp ne i8 %t0, %x
113 define i1 @n9_wrong_pred4(i8 %x, i8 %y) {
114 ; CHECK-LABEL: @n9_wrong_pred4(
115 ; CHECK-NEXT: [[T0:%.*]] = sub i8 [[X:%.*]], [[Y:%.*]]
116 ; CHECK-NEXT: [[R:%.*]] = icmp slt i8 [[T0]], [[X]]
117 ; CHECK-NEXT: ret i1 [[R]]
120 %r = icmp slt i8 %t0, %x
124 define i1 @n10_wrong_pred5(i8 %x, i8 %y) {
125 ; CHECK-LABEL: @n10_wrong_pred5(
126 ; CHECK-NEXT: [[T0:%.*]] = sub i8 [[X:%.*]], [[Y:%.*]]
127 ; CHECK-NEXT: [[R:%.*]] = icmp sle i8 [[T0]], [[X]]
128 ; CHECK-NEXT: ret i1 [[R]]
131 %r = icmp sle i8 %t0, %x
135 define i1 @n11_wrong_pred6(i8 %x, i8 %y) {
136 ; CHECK-LABEL: @n11_wrong_pred6(
137 ; CHECK-NEXT: [[T0:%.*]] = sub i8 [[X:%.*]], [[Y:%.*]]
138 ; CHECK-NEXT: [[R:%.*]] = icmp sgt i8 [[T0]], [[X]]
139 ; CHECK-NEXT: ret i1 [[R]]
142 %r = icmp sgt i8 %t0, %x
146 define i1 @n12_wrong_pred7(i8 %x, i8 %y) {
147 ; CHECK-LABEL: @n12_wrong_pred7(
148 ; CHECK-NEXT: [[T0:%.*]] = sub i8 [[X:%.*]], [[Y:%.*]]
149 ; CHECK-NEXT: [[R:%.*]] = icmp sge i8 [[T0]], [[X]]
150 ; CHECK-NEXT: ret i1 [[R]]
153 %r = icmp sge i8 %t0, %x