@@ -5,11 +5,8 @@ define i1 @compare_unsigned_min(i8 %0, i8 %1) {
55; CHECK-LABEL: define i1 @compare_unsigned_min(
66; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
77; CHECK-NEXT: [[START:.*:]]
8- ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i8 [[TMP0]], 0
9- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], 0
108; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i8 [[TMP0]], [[TMP1]]
11- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP4]], i1 [[TMP3]], i1 [[TMP2]]
12- ; CHECK-NEXT: ret i1 [[RESULT]]
9+ ; CHECK-NEXT: ret i1 [[TMP2]]
1310;
1411start:
1512 %2 = icmp eq i8 %0 , 0
@@ -23,11 +20,8 @@ define i1 @compare_signed_min(i8 %0, i8 %1) {
2320; CHECK-LABEL: define i1 @compare_signed_min(
2421; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
2522; CHECK-NEXT: [[START:.*:]]
26- ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP0]], -128
27- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], -128
2823; CHECK-NEXT: [[TMP4:%.*]] = icmp slt i8 [[TMP0]], [[TMP1]]
29- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP2]], i1 [[TMP3]], i1 [[TMP4]]
30- ; CHECK-NEXT: ret i1 [[RESULT]]
24+ ; CHECK-NEXT: ret i1 [[TMP4]]
3125;
3226start:
3327 %2 = icmp eq i8 %0 , -128
@@ -41,11 +35,8 @@ define i1 @compare_unsigned_max(i8 %0, i8 %1) {
4135; CHECK-LABEL: define i1 @compare_unsigned_max(
4236; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
4337; CHECK-NEXT: [[START:.*:]]
44- ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP0]], -1
45- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], -1
4638; CHECK-NEXT: [[TMP4:%.*]] = icmp ugt i8 [[TMP0]], [[TMP1]]
47- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP2]], i1 [[TMP3]], i1 [[TMP4]]
48- ; CHECK-NEXT: ret i1 [[RESULT]]
39+ ; CHECK-NEXT: ret i1 [[TMP4]]
4940;
5041start:
5142 %2 = icmp eq i8 %0 , 255
@@ -59,11 +50,8 @@ define i1 @compare_signed_max(i8 %0, i8 %1) {
5950; CHECK-LABEL: define i1 @compare_signed_max(
6051; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
6152; CHECK-NEXT: [[START:.*:]]
62- ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP0]], 127
63- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], 127
6453; CHECK-NEXT: [[TMP4:%.*]] = icmp sgt i8 [[TMP0]], [[TMP1]]
65- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP2]], i1 [[TMP3]], i1 [[TMP4]]
66- ; CHECK-NEXT: ret i1 [[RESULT]]
54+ ; CHECK-NEXT: ret i1 [[TMP4]]
6755;
6856start:
6957 %2 = icmp eq i8 %0 , 127
@@ -77,11 +65,8 @@ define i1 @relational_cmp_unsigned_min(i8 %0, i8 %1) {
7765; CHECK-LABEL: define i1 @relational_cmp_unsigned_min(
7866; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
7967; CHECK-NEXT: [[START:.*:]]
80- ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP0]], 0
81- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], 0
8268; CHECK-NEXT: [[TMP4:%.*]] = icmp ult i8 [[TMP0]], [[TMP1]]
83- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP2]], i1 [[TMP3]], i1 [[TMP4]]
84- ; CHECK-NEXT: ret i1 [[RESULT]]
69+ ; CHECK-NEXT: ret i1 [[TMP4]]
8570;
8671start:
8772 %2 = icmp ule i8 %0 , 0
@@ -95,11 +80,8 @@ define i1 @relational_cmp_signed_min(i8 %0, i8 %1) {
9580; CHECK-LABEL: define i1 @relational_cmp_signed_min(
9681; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
9782; CHECK-NEXT: [[START:.*:]]
98- ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP0]], -128
99- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], -128
10083; CHECK-NEXT: [[TMP4:%.*]] = icmp slt i8 [[TMP0]], [[TMP1]]
101- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP2]], i1 [[TMP3]], i1 [[TMP4]]
102- ; CHECK-NEXT: ret i1 [[RESULT]]
84+ ; CHECK-NEXT: ret i1 [[TMP4]]
10385;
10486start:
10587 %2 = icmp sle i8 %0 , -128
@@ -113,11 +95,8 @@ define i1 @relational_cmp_unsigned_max(i8 %0, i8 %1) {
11395; CHECK-LABEL: define i1 @relational_cmp_unsigned_max(
11496; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
11597; CHECK-NEXT: [[START:.*:]]
116- ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP0]], -1
117- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], -1
11898; CHECK-NEXT: [[TMP4:%.*]] = icmp ugt i8 [[TMP0]], [[TMP1]]
119- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP2]], i1 [[TMP3]], i1 [[TMP4]]
120- ; CHECK-NEXT: ret i1 [[RESULT]]
99+ ; CHECK-NEXT: ret i1 [[TMP4]]
121100;
122101start:
123102 %2 = icmp uge i8 %0 , 255
@@ -131,11 +110,8 @@ define i1 @relational_cmp_signed_max(i8 %0, i8 %1) {
131110; CHECK-LABEL: define i1 @relational_cmp_signed_max(
132111; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
133112; CHECK-NEXT: [[START:.*:]]
134- ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP0]], 127
135- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], 127
136113; CHECK-NEXT: [[TMP4:%.*]] = icmp sgt i8 [[TMP0]], [[TMP1]]
137- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP2]], i1 [[TMP3]], i1 [[TMP4]]
138- ; CHECK-NEXT: ret i1 [[RESULT]]
114+ ; CHECK-NEXT: ret i1 [[TMP4]]
139115;
140116start:
141117 %2 = icmp sge i8 %0 , 127
@@ -151,11 +127,9 @@ define i1 @compare_signed_max_multiuse(i8 %0, i8 %1) {
151127; CHECK-LABEL: define i1 @compare_signed_max_multiuse(
152128; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
153129; CHECK-NEXT: [[START:.*:]]
154- ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP0]], 127
155- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], 127
156130; CHECK-NEXT: [[TMP4:%.*]] = icmp sgt i8 [[TMP0]], [[TMP1]]
157131; CHECK-NEXT: call void @use(i1 [[TMP4]])
158- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP2]], i1 [[TMP3 ]], i1 [[TMP4 ]]
132+ ; CHECK-NEXT: [[RESULT:%.*]] = icmp sgt i8 [[TMP0 ]], [[TMP1 ]]
159133; CHECK-NEXT: ret i1 [[RESULT]]
160134;
161135start:
@@ -171,10 +145,7 @@ define i1 @compare_signed_min_samesign(i8 %0, i8 %1) {
171145; CHECK-LABEL: define i1 @compare_signed_min_samesign(
172146; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
173147; CHECK-NEXT: [[START:.*:]]
174- ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP0]], -128
175- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], -128
176- ; CHECK-NEXT: [[TMP4:%.*]] = icmp samesign slt i8 [[TMP0]], [[TMP1]]
177- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP2]], i1 [[TMP3]], i1 [[TMP4]]
148+ ; CHECK-NEXT: [[RESULT:%.*]] = icmp slt i8 [[TMP0]], [[TMP1]]
178149; CHECK-NEXT: ret i1 [[RESULT]]
179150;
180151start:
@@ -189,10 +160,7 @@ define i1 @compare_flipped(i8 %0, i8 %1) {
189160; CHECK-LABEL: define i1 @compare_flipped(
190161; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
191162; CHECK-NEXT: [[START:.*:]]
192- ; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i8 [[TMP0]], 0
193- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], 0
194- ; CHECK-NEXT: [[TMP4:%.*]] = icmp ugt i8 [[TMP1]], [[TMP0]]
195- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP2]], i1 [[TMP3]], i1 [[TMP4]]
163+ ; CHECK-NEXT: [[RESULT:%.*]] = icmp ult i8 [[TMP0]], [[TMP1]]
196164; CHECK-NEXT: ret i1 [[RESULT]]
197165;
198166start:
@@ -207,11 +175,8 @@ define i1 @compare_swapped(i8 %0, i8 %1) {
207175; CHECK-LABEL: define i1 @compare_swapped(
208176; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
209177; CHECK-NEXT: [[START:.*:]]
210- ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i8 [[TMP0]], 0
211- ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne i8 [[TMP1]], 0
212178; CHECK-NEXT: [[RESULT:%.*]] = icmp ult i8 [[TMP0]], [[TMP1]]
213- ; CHECK-NEXT: [[RESULT1:%.*]] = select i1 [[DOTNOT]], i1 [[TMP2]], i1 [[RESULT]]
214- ; CHECK-NEXT: ret i1 [[RESULT1]]
179+ ; CHECK-NEXT: ret i1 [[RESULT]]
215180;
216181start:
217182 %2 = icmp ne i8 %0 , 0
@@ -225,10 +190,7 @@ define i1 @compare_swapped_flipped_unsigned_max(i8 %0, i8 %1) {
225190; CHECK-LABEL: define i1 @compare_swapped_flipped_unsigned_max(
226191; CHECK-SAME: i8 [[TMP0:%.*]], i8 [[TMP1:%.*]]) {
227192; CHECK-NEXT: [[START:.*:]]
228- ; CHECK-NEXT: [[DOTNOT:%.*]] = icmp eq i8 [[TMP0]], -1
229- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i8 [[TMP1]], -1
230- ; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i8 [[TMP1]], [[TMP0]]
231- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[DOTNOT]], i1 [[TMP3]], i1 [[TMP2]]
193+ ; CHECK-NEXT: [[RESULT:%.*]] = icmp ugt i8 [[TMP0]], [[TMP1]]
232194; CHECK-NEXT: ret i1 [[RESULT]]
233195;
234196start:
@@ -243,11 +205,8 @@ define i1 @compare_unsigned_min_illegal_type(i9 %0, i9 %1) {
243205; CHECK-LABEL: define i1 @compare_unsigned_min_illegal_type(
244206; CHECK-SAME: i9 [[TMP0:%.*]], i9 [[TMP1:%.*]]) {
245207; CHECK-NEXT: [[START:.*:]]
246- ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i9 [[TMP0]], 0
247- ; CHECK-NEXT: [[TMP3:%.*]] = icmp ne i9 [[TMP1]], 0
248208; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i9 [[TMP0]], [[TMP1]]
249- ; CHECK-NEXT: [[RESULT:%.*]] = select i1 [[TMP4]], i1 [[TMP3]], i1 [[TMP2]]
250- ; CHECK-NEXT: ret i1 [[RESULT]]
209+ ; CHECK-NEXT: ret i1 [[TMP2]]
251210;
252211start:
253212 %2 = icmp eq i9 %0 , 0
@@ -260,11 +219,8 @@ start:
260219define <2 x i1 > @compare_vector (<2 x i8 > %x , <2 x i8 > %y ) {
261220; CHECK-LABEL: define <2 x i1> @compare_vector(
262221; CHECK-SAME: <2 x i8> [[X:%.*]], <2 x i8> [[Y:%.*]]) {
263- ; CHECK-NEXT: [[TMP3:%.*]] = icmp eq <2 x i8> [[X]], zeroinitializer
264- ; CHECK-NEXT: [[TMP2:%.*]] = icmp ne <2 x i8> [[Y]], zeroinitializer
265222; CHECK-NEXT: [[TMP1:%.*]] = icmp ult <2 x i8> [[X]], [[Y]]
266- ; CHECK-NEXT: [[RESULT:%.*]] = select <2 x i1> [[TMP3]], <2 x i1> [[TMP2]], <2 x i1> [[TMP1]]
267- ; CHECK-NEXT: ret <2 x i1> [[RESULT]]
223+ ; CHECK-NEXT: ret <2 x i1> [[TMP1]]
268224;
269225 %2 = icmp eq <2 x i8 > %x , <i8 0 , i8 0 >
270226 %3 = icmp ne <2 x i8 > %y , <i8 0 , i8 0 >
0 commit comments