11
11
12
12
define i1 @eq_smin1 (i32 %x , i32 %y ) {
13
13
; CHECK-LABEL: @eq_smin1(
14
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 %x, %y
15
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 %x, i32 %y
16
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i32 [[SEL]], %x
14
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i32 %x, %y
17
15
; CHECK-NEXT: ret i1 [[CMP2]]
18
16
;
19
17
%cmp1 = icmp slt i32 %x , %y
@@ -26,9 +24,7 @@ define i1 @eq_smin1(i32 %x, i32 %y) {
26
24
27
25
define i1 @eq_smin2 (i32 %x , i32 %y ) {
28
26
; CHECK-LABEL: @eq_smin2(
29
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 %y, %x
30
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 %y, i32 %x
31
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i32 [[SEL]], %x
27
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i32 %x, %y
32
28
; CHECK-NEXT: ret i1 [[CMP2]]
33
29
;
34
30
%cmp1 = icmp slt i32 %y , %x
@@ -42,9 +38,7 @@ define i1 @eq_smin2(i32 %x, i32 %y) {
42
38
define i1 @eq_smin3 (i32 %a , i32 %y ) {
43
39
; CHECK-LABEL: @eq_smin3(
44
40
; CHECK-NEXT: [[X:%.*]] = add i32 %a, 3
45
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[X]], %y
46
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 [[X]], i32 %y
47
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i32 [[X]], [[SEL]]
41
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i32 [[X]], %y
48
42
; CHECK-NEXT: ret i1 [[CMP2]]
49
43
;
50
44
%x = add i32 %a , 3 ; thwart complexity-based canonicalization
@@ -59,9 +53,7 @@ define i1 @eq_smin3(i32 %a, i32 %y) {
59
53
define i1 @eq_smin4 (i32 %a , i32 %y ) {
60
54
; CHECK-LABEL: @eq_smin4(
61
55
; CHECK-NEXT: [[X:%.*]] = add i32 %a, 3
62
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[X]], %y
63
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 %y, i32 [[X]]
64
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp eq i32 [[X]], [[SEL]]
56
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i32 [[X]], %y
65
57
; CHECK-NEXT: ret i1 [[CMP2]]
66
58
;
67
59
%x = add i32 %a , 3 ; thwart complexity-based canonicalization
@@ -75,9 +67,7 @@ define i1 @eq_smin4(i32 %a, i32 %y) {
75
67
76
68
define i1 @sge_smin1 (i32 %x , i32 %y ) {
77
69
; CHECK-LABEL: @sge_smin1(
78
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 %x, %y
79
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 %x, i32 %y
80
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i32 [[SEL]], %x
70
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i32 %x, %y
81
71
; CHECK-NEXT: ret i1 [[CMP2]]
82
72
;
83
73
%cmp1 = icmp slt i32 %x , %y
@@ -90,9 +80,7 @@ define i1 @sge_smin1(i32 %x, i32 %y) {
90
80
91
81
define i1 @sge_smin2 (i32 %x , i32 %y ) {
92
82
; CHECK-LABEL: @sge_smin2(
93
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 %y, %x
94
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 %y, i32 %x
95
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp sge i32 [[SEL]], %x
83
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i32 %x, %y
96
84
; CHECK-NEXT: ret i1 [[CMP2]]
97
85
;
98
86
%cmp1 = icmp slt i32 %y , %x
@@ -106,9 +94,7 @@ define i1 @sge_smin2(i32 %x, i32 %y) {
106
94
define i1 @sge_smin3 (i32 %a , i32 %y ) {
107
95
; CHECK-LABEL: @sge_smin3(
108
96
; CHECK-NEXT: [[X:%.*]] = add i32 %a, 3
109
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[X]], %y
110
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 [[X]], i32 %y
111
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i32 [[X]], [[SEL]]
97
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i32 [[X]], %y
112
98
; CHECK-NEXT: ret i1 [[CMP2]]
113
99
;
114
100
%x = add i32 %a , 3 ; thwart complexity-based canonicalization
@@ -123,9 +109,7 @@ define i1 @sge_smin3(i32 %a, i32 %y) {
123
109
define i1 @sge_smin4 (i32 %a , i32 %y ) {
124
110
; CHECK-LABEL: @sge_smin4(
125
111
; CHECK-NEXT: [[X:%.*]] = add i32 %a, 3
126
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp sgt i32 [[X]], %y
127
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 %y, i32 [[X]]
128
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i32 [[X]], [[SEL]]
112
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sle i32 [[X]], %y
129
113
; CHECK-NEXT: ret i1 [[CMP2]]
130
114
;
131
115
%x = add i32 %a , 3 ; thwart complexity-based canonicalization
@@ -139,9 +123,7 @@ define i1 @sge_smin4(i32 %a, i32 %y) {
139
123
140
124
define i1 @ne_smin1 (i32 %x , i32 %y ) {
141
125
; CHECK-LABEL: @ne_smin1(
142
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 %x, %y
143
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 %x, i32 %y
144
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[SEL]], %x
126
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 %x, %y
145
127
; CHECK-NEXT: ret i1 [[CMP2]]
146
128
;
147
129
%cmp1 = icmp slt i32 %x , %y
@@ -168,9 +150,7 @@ define i1 @ne_smin2(i32 %x, i32 %y) {
168
150
define i1 @ne_smin3 (i32 %a , i32 %y ) {
169
151
; CHECK-LABEL: @ne_smin3(
170
152
; CHECK-NEXT: [[X:%.*]] = add i32 %a, 3
171
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[X]], %y
172
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 [[X]], i32 %y
173
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[X]], [[SEL]]
153
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[X]], %y
174
154
; CHECK-NEXT: ret i1 [[CMP2]]
175
155
;
176
156
%x = add i32 %a , 3 ; thwart complexity-based canonicalization
@@ -199,9 +179,7 @@ define i1 @ne_smin4(i32 %a, i32 %y) {
199
179
200
180
define i1 @slt_smin1 (i32 %x , i32 %y ) {
201
181
; CHECK-LABEL: @slt_smin1(
202
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 %x, %y
203
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 %x, i32 %y
204
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp slt i32 [[SEL]], %x
182
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 %x, %y
205
183
; CHECK-NEXT: ret i1 [[CMP2]]
206
184
;
207
185
%cmp1 = icmp slt i32 %x , %y
@@ -228,9 +206,7 @@ define i1 @slt_smin2(i32 %x, i32 %y) {
228
206
define i1 @slt_smin3 (i32 %a , i32 %y ) {
229
207
; CHECK-LABEL: @slt_smin3(
230
208
; CHECK-NEXT: [[X:%.*]] = add i32 %a, 3
231
- ; CHECK-NEXT: [[CMP1:%.*]] = icmp slt i32 [[X]], %y
232
- ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[CMP1]], i32 [[X]], i32 %y
233
- ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[X]], [[SEL]]
209
+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp sgt i32 [[X]], %y
234
210
; CHECK-NEXT: ret i1 [[CMP2]]
235
211
;
236
212
%x = add i32 %a , 3 ; thwart complexity-based canonicalization
0 commit comments