Skip to content

Commit 841aac0

Browse files
committedMar 25, 2018
[InstCombine] peek through more icmp of FP cast + bitcast
This is an extension of rL328426 as noted in D44367. llvm-svn: 328448
1 parent 48baeb0 commit 841aac0

File tree

2 files changed

+59
-139
lines changed

2 files changed

+59
-139
lines changed
 

‎llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4506,13 +4506,23 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
45064506
return New;
45074507
}
45084508

4509-
// Sign-bit checks are preserved through signed floating-point casts:
4510-
// icmp slt (bitcast (sitofp X)), 0 --> icmp slt X, 0
4511-
// icmp sgt (bitcast (sitofp X)), -1 --> icmp sgt X, -1
4509+
// Zero-equality and sign-bit checks are preserved through sitofp + bitcast.
45124510
Value *X;
45134511
if (match(Op0, m_BitCast(m_SIToFP(m_Value(X))))) {
4514-
if (Pred == ICmpInst::ICMP_SLT && match(Op1, m_Zero()))
4512+
// icmp eq (bitcast (sitofp X)), 0 --> icmp eq X, 0
4513+
// icmp ne (bitcast (sitofp X)), 0 --> icmp ne X, 0
4514+
// icmp slt (bitcast (sitofp X)), 0 --> icmp slt X, 0
4515+
// icmp sgt (bitcast (sitofp X)), 0 --> icmp sgt X, 0
4516+
if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_SLT ||
4517+
Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT) &&
4518+
match(Op1, m_Zero()))
45154519
return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType()));
4520+
4521+
// icmp slt (bitcast (sitofp X)), 1 --> icmp slt X, 1
4522+
if (Pred == ICmpInst::ICMP_SLT && match(Op1, m_One()))
4523+
return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), 1));
4524+
4525+
// icmp sgt (bitcast (sitofp X)), -1 --> icmp sgt X, -1
45164526
if (Pred == ICmpInst::ICMP_SGT && match(Op1, m_AllOnes()))
45174527
return new ICmpInst(Pred, X, ConstantInt::getAllOnesValue(X->getType()));
45184528
}

‎llvm/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll

Lines changed: 45 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616

1717
define i1 @i32_cast_cmp_eq_int_0_sitofp_float(i32 %i) {
1818
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_sitofp_float(
19-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to float
20-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
21-
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[B]], 0
19+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 0
2220
; CHECK-NEXT: ret i1 [[CMP]]
2321
;
2422
%f = sitofp i32 %i to float
@@ -42,9 +40,7 @@ define <3 x i1> @i32_cast_cmp_eq_int_0_sitofp_float_vec(<3 x i32> %i) {
4240

4341
define i1 @i32_cast_cmp_ne_int_0_sitofp_float(i32 %i) {
4442
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_sitofp_float(
45-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to float
46-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
47-
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[B]], 0
43+
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0
4844
; CHECK-NEXT: ret i1 [[CMP]]
4945
;
5046
%f = sitofp i32 %i to float
@@ -92,9 +88,7 @@ define <3 x i1> @i32_cast_cmp_slt_int_0_sitofp_float_vec(<3 x i32> %i) {
9288

9389
define i1 @i32_cast_cmp_sgt_int_0_sitofp_float(i32 %i) {
9490
; CHECK-LABEL: @i32_cast_cmp_sgt_int_0_sitofp_float(
95-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to float
96-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
97-
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[B]], 0
91+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[I:%.*]], 0
9892
; CHECK-NEXT: ret i1 [[CMP]]
9993
;
10094
%f = sitofp i32 %i to float
@@ -118,9 +112,7 @@ define <3 x i1> @i32_cast_cmp_sgt_int_0_sitofp_float_vec(<3 x i32> %i) {
118112

119113
define i1 @i32_cast_cmp_slt_int_1_sitofp_float(i32 %i) {
120114
; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_float(
121-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to float
122-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
123-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[B]], 1
115+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I:%.*]], 1
124116
; CHECK-NEXT: ret i1 [[CMP]]
125117
;
126118
%f = sitofp i32 %i to float
@@ -131,9 +123,7 @@ define i1 @i32_cast_cmp_slt_int_1_sitofp_float(i32 %i) {
131123

132124
define <3 x i1> @i32_cast_cmp_slt_int_1_sitofp_float_vec(<3 x i32> %i) {
133125
; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_float_vec(
134-
; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i32> [[I:%.*]] to <3 x float>
135-
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x float> [[F]] to <3 x i32>
136-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[B]], <i32 1, i32 undef, i32 1>
126+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[I:%.*]], <i32 1, i32 1, i32 1>
137127
; CHECK-NEXT: ret <3 x i1> [[CMP]]
138128
;
139129
%f = sitofp <3 x i32> %i to <3 x float>
@@ -166,9 +156,7 @@ define <3 x i1> @i32_cast_cmp_sgt_int_m1_sitofp_float_vec(<3 x i32> %i) {
166156

167157
define i1 @i32_cast_cmp_eq_int_0_sitofp_double(i32 %i) {
168158
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_sitofp_double(
169-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to double
170-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
171-
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[B]], 0
159+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 0
172160
; CHECK-NEXT: ret i1 [[CMP]]
173161
;
174162
%f = sitofp i32 %i to double
@@ -192,9 +180,7 @@ define <3 x i1> @i32_cast_cmp_eq_int_0_sitofp_double_vec(<3 x i32> %i) {
192180

193181
define i1 @i32_cast_cmp_ne_int_0_sitofp_double(i32 %i) {
194182
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_sitofp_double(
195-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to double
196-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
197-
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[B]], 0
183+
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0
198184
; CHECK-NEXT: ret i1 [[CMP]]
199185
;
200186
%f = sitofp i32 %i to double
@@ -242,9 +228,7 @@ define <3 x i1> @i32_cast_cmp_slt_int_0_sitofp_double_vec(<3 x i32> %i) {
242228

243229
define i1 @i32_cast_cmp_sgt_int_0_sitofp_double(i32 %i) {
244230
; CHECK-LABEL: @i32_cast_cmp_sgt_int_0_sitofp_double(
245-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to double
246-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
247-
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[B]], 0
231+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[I:%.*]], 0
248232
; CHECK-NEXT: ret i1 [[CMP]]
249233
;
250234
%f = sitofp i32 %i to double
@@ -268,9 +252,7 @@ define <3 x i1> @i32_cast_cmp_sgt_int_0_sitofp_double_vec(<3 x i32> %i) {
268252

269253
define i1 @i32_cast_cmp_slt_int_1_sitofp_double(i32 %i) {
270254
; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_double(
271-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to double
272-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
273-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[B]], 1
255+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I:%.*]], 1
274256
; CHECK-NEXT: ret i1 [[CMP]]
275257
;
276258
%f = sitofp i32 %i to double
@@ -281,9 +263,7 @@ define i1 @i32_cast_cmp_slt_int_1_sitofp_double(i32 %i) {
281263

282264
define <3 x i1> @i32_cast_cmp_slt_int_1_sitofp_double_vec(<3 x i32> %i) {
283265
; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_double_vec(
284-
; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i32> [[I:%.*]] to <3 x double>
285-
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x double> [[F]] to <3 x i64>
286-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[B]], <i64 1, i64 undef, i64 1>
266+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[I:%.*]], <i32 1, i32 1, i32 1>
287267
; CHECK-NEXT: ret <3 x i1> [[CMP]]
288268
;
289269
%f = sitofp <3 x i32> %i to <3 x double>
@@ -316,9 +296,7 @@ define <3 x i1> @i32_cast_cmp_sgt_int_m1_sitofp_double_vec(<3 x i32> %i) {
316296

317297
define i1 @i32_cast_cmp_eq_int_0_sitofp_half(i32 %i) {
318298
; CHECK-LABEL: @i32_cast_cmp_eq_int_0_sitofp_half(
319-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to half
320-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
321-
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[B]], 0
299+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 0
322300
; CHECK-NEXT: ret i1 [[CMP]]
323301
;
324302
%f = sitofp i32 %i to half
@@ -342,9 +320,7 @@ define <3 x i1> @i32_cast_cmp_eq_int_0_sitofp_half_vec(<3 x i32> %i) {
342320

343321
define i1 @i32_cast_cmp_ne_int_0_sitofp_half(i32 %i) {
344322
; CHECK-LABEL: @i32_cast_cmp_ne_int_0_sitofp_half(
345-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to half
346-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
347-
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[B]], 0
323+
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0
348324
; CHECK-NEXT: ret i1 [[CMP]]
349325
;
350326
%f = sitofp i32 %i to half
@@ -392,9 +368,7 @@ define <3 x i1> @i32_cast_cmp_slt_int_0_sitofp_half_vec(<3 x i32> %i) {
392368

393369
define i1 @i32_cast_cmp_sgt_int_0_sitofp_half(i32 %i) {
394370
; CHECK-LABEL: @i32_cast_cmp_sgt_int_0_sitofp_half(
395-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to half
396-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
397-
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[B]], 0
371+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[I:%.*]], 0
398372
; CHECK-NEXT: ret i1 [[CMP]]
399373
;
400374
%f = sitofp i32 %i to half
@@ -418,9 +392,7 @@ define <3 x i1> @i32_cast_cmp_sgt_int_0_sitofp_half_vec(<3 x i32> %i) {
418392

419393
define i1 @i32_cast_cmp_slt_int_1_sitofp_half(i32 %i) {
420394
; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_half(
421-
; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to half
422-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
423-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[B]], 1
395+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I:%.*]], 1
424396
; CHECK-NEXT: ret i1 [[CMP]]
425397
;
426398
%f = sitofp i32 %i to half
@@ -431,9 +403,7 @@ define i1 @i32_cast_cmp_slt_int_1_sitofp_half(i32 %i) {
431403

432404
define <3 x i1> @i32_cast_cmp_slt_int_1_sitofp_half_vec(<3 x i32> %i) {
433405
; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_half_vec(
434-
; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i32> [[I:%.*]] to <3 x half>
435-
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x half> [[F]] to <3 x i16>
436-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[B]], <i16 1, i16 undef, i16 1>
406+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[I:%.*]], <i32 1, i32 1, i32 1>
437407
; CHECK-NEXT: ret <3 x i1> [[CMP]]
438408
;
439409
%f = sitofp <3 x i32> %i to <3 x half>
@@ -466,9 +436,7 @@ define <3 x i1> @i32_cast_cmp_sgt_int_m1_sitofp_half_vec(<3 x i32> %i) {
466436

467437
define i1 @i64_cast_cmp_eq_int_0_sitofp_float(i64 %i) {
468438
; CHECK-LABEL: @i64_cast_cmp_eq_int_0_sitofp_float(
469-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to float
470-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
471-
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[B]], 0
439+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[I:%.*]], 0
472440
; CHECK-NEXT: ret i1 [[CMP]]
473441
;
474442
%f = sitofp i64 %i to float
@@ -492,9 +460,7 @@ define <3 x i1> @i64_cast_cmp_eq_int_0_sitofp_float_vec(<3 x i64> %i) {
492460

493461
define i1 @i64_cast_cmp_ne_int_0_sitofp_float(i64 %i) {
494462
; CHECK-LABEL: @i64_cast_cmp_ne_int_0_sitofp_float(
495-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to float
496-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
497-
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[B]], 0
463+
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[I:%.*]], 0
498464
; CHECK-NEXT: ret i1 [[CMP]]
499465
;
500466
%f = sitofp i64 %i to float
@@ -542,9 +508,7 @@ define <3 x i1> @i64_cast_cmp_slt_int_0_sitofp_float_vec(<3 x i64> %i) {
542508

543509
define i1 @i64_cast_cmp_sgt_int_0_sitofp_float(i64 %i) {
544510
; CHECK-LABEL: @i64_cast_cmp_sgt_int_0_sitofp_float(
545-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to float
546-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
547-
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[B]], 0
511+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[I:%.*]], 0
548512
; CHECK-NEXT: ret i1 [[CMP]]
549513
;
550514
%f = sitofp i64 %i to float
@@ -568,9 +532,7 @@ define <3 x i1> @i64_cast_cmp_sgt_int_0_sitofp_float_vec(<3 x i64> %i) {
568532

569533
define i1 @i64_cast_cmp_slt_int_1_sitofp_float(i64 %i) {
570534
; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_float(
571-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to float
572-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
573-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[B]], 1
535+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[I:%.*]], 1
574536
; CHECK-NEXT: ret i1 [[CMP]]
575537
;
576538
%f = sitofp i64 %i to float
@@ -581,9 +543,7 @@ define i1 @i64_cast_cmp_slt_int_1_sitofp_float(i64 %i) {
581543

582544
define <3 x i1> @i64_cast_cmp_slt_int_1_sitofp_float_vec(<3 x i64> %i) {
583545
; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_float_vec(
584-
; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i64> [[I:%.*]] to <3 x float>
585-
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x float> [[F]] to <3 x i32>
586-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[B]], <i32 1, i32 undef, i32 1>
546+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[I:%.*]], <i64 1, i64 1, i64 1>
587547
; CHECK-NEXT: ret <3 x i1> [[CMP]]
588548
;
589549
%f = sitofp <3 x i64> %i to <3 x float>
@@ -616,9 +576,7 @@ define <3 x i1> @i64_cast_cmp_sgt_int_m1_sitofp_float_vec(<3 x i64> %i) {
616576

617577
define i1 @i64_cast_cmp_eq_int_0_sitofp_double(i64 %i) {
618578
; CHECK-LABEL: @i64_cast_cmp_eq_int_0_sitofp_double(
619-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to double
620-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
621-
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[B]], 0
579+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[I:%.*]], 0
622580
; CHECK-NEXT: ret i1 [[CMP]]
623581
;
624582
%f = sitofp i64 %i to double
@@ -642,9 +600,7 @@ define <3 x i1> @i64_cast_cmp_eq_int_0_sitofp_double_vec(<3 x i64> %i) {
642600

643601
define i1 @i64_cast_cmp_ne_int_0_sitofp_double(i64 %i) {
644602
; CHECK-LABEL: @i64_cast_cmp_ne_int_0_sitofp_double(
645-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to double
646-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
647-
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[B]], 0
603+
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[I:%.*]], 0
648604
; CHECK-NEXT: ret i1 [[CMP]]
649605
;
650606
%f = sitofp i64 %i to double
@@ -692,9 +648,7 @@ define <3 x i1> @i64_cast_cmp_slt_int_0_sitofp_double_vec(<3 x i64> %i) {
692648

693649
define i1 @i64_cast_cmp_sgt_int_0_sitofp_double(i64 %i) {
694650
; CHECK-LABEL: @i64_cast_cmp_sgt_int_0_sitofp_double(
695-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to double
696-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
697-
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[B]], 0
651+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[I:%.*]], 0
698652
; CHECK-NEXT: ret i1 [[CMP]]
699653
;
700654
%f = sitofp i64 %i to double
@@ -718,9 +672,7 @@ define <3 x i1> @i64_cast_cmp_sgt_int_0_sitofp_double_vec(<3 x i64> %i) {
718672

719673
define i1 @i64_cast_cmp_slt_int_1_sitofp_double(i64 %i) {
720674
; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_double(
721-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to double
722-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
723-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[B]], 1
675+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[I:%.*]], 1
724676
; CHECK-NEXT: ret i1 [[CMP]]
725677
;
726678
%f = sitofp i64 %i to double
@@ -731,9 +683,7 @@ define i1 @i64_cast_cmp_slt_int_1_sitofp_double(i64 %i) {
731683

732684
define <3 x i1> @i64_cast_cmp_slt_int_1_sitofp_double_vec(<3 x i64> %i) {
733685
; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_double_vec(
734-
; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i64> [[I:%.*]] to <3 x double>
735-
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x double> [[F]] to <3 x i64>
736-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[B]], <i64 1, i64 undef, i64 1>
686+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[I:%.*]], <i64 1, i64 1, i64 1>
737687
; CHECK-NEXT: ret <3 x i1> [[CMP]]
738688
;
739689
%f = sitofp <3 x i64> %i to <3 x double>
@@ -766,9 +716,7 @@ define <3 x i1> @i64_cast_cmp_sgt_int_m1_sitofp_double_vec(<3 x i64> %i) {
766716

767717
define i1 @i64_cast_cmp_eq_int_0_sitofp_half(i64 %i) {
768718
; CHECK-LABEL: @i64_cast_cmp_eq_int_0_sitofp_half(
769-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to half
770-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
771-
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[B]], 0
719+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[I:%.*]], 0
772720
; CHECK-NEXT: ret i1 [[CMP]]
773721
;
774722
%f = sitofp i64 %i to half
@@ -792,9 +740,7 @@ define <3 x i1> @i64_cast_cmp_eq_int_0_sitofp_half_vec(<3 x i64> %i) {
792740

793741
define i1 @i64_cast_cmp_ne_int_0_sitofp_half(i64 %i) {
794742
; CHECK-LABEL: @i64_cast_cmp_ne_int_0_sitofp_half(
795-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to half
796-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
797-
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[B]], 0
743+
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[I:%.*]], 0
798744
; CHECK-NEXT: ret i1 [[CMP]]
799745
;
800746
%f = sitofp i64 %i to half
@@ -842,9 +788,7 @@ define <3 x i1> @i64_cast_cmp_slt_int_0_sitofp_half_vec(<3 x i64> %i) {
842788

843789
define i1 @i64_cast_cmp_sgt_int_0_sitofp_half(i64 %i) {
844790
; CHECK-LABEL: @i64_cast_cmp_sgt_int_0_sitofp_half(
845-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to half
846-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
847-
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[B]], 0
791+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[I:%.*]], 0
848792
; CHECK-NEXT: ret i1 [[CMP]]
849793
;
850794
%f = sitofp i64 %i to half
@@ -868,9 +812,7 @@ define <3 x i1> @i64_cast_cmp_sgt_int_0_sitofp_half_vec(<3 x i64> %i) {
868812

869813
define i1 @i64_cast_cmp_slt_int_1_sitofp_half(i64 %i) {
870814
; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_half(
871-
; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to half
872-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
873-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[B]], 1
815+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[I:%.*]], 1
874816
; CHECK-NEXT: ret i1 [[CMP]]
875817
;
876818
%f = sitofp i64 %i to half
@@ -881,9 +823,7 @@ define i1 @i64_cast_cmp_slt_int_1_sitofp_half(i64 %i) {
881823

882824
define <3 x i1> @i64_cast_cmp_slt_int_1_sitofp_half_vec(<3 x i64> %i) {
883825
; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_half_vec(
884-
; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i64> [[I:%.*]] to <3 x half>
885-
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x half> [[F]] to <3 x i16>
886-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[B]], <i16 1, i16 undef, i16 1>
826+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[I:%.*]], <i64 1, i64 1, i64 1>
887827
; CHECK-NEXT: ret <3 x i1> [[CMP]]
888828
;
889829
%f = sitofp <3 x i64> %i to <3 x half>
@@ -916,9 +856,7 @@ define <3 x i1> @i64_cast_cmp_sgt_int_m1_sitofp_half_vec(<3 x i64> %i) {
916856

917857
define i1 @i16_cast_cmp_eq_int_0_sitofp_float(i16 %i) {
918858
; CHECK-LABEL: @i16_cast_cmp_eq_int_0_sitofp_float(
919-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to float
920-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
921-
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[B]], 0
859+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[I:%.*]], 0
922860
; CHECK-NEXT: ret i1 [[CMP]]
923861
;
924862
%f = sitofp i16 %i to float
@@ -942,9 +880,7 @@ define <3 x i1> @i16_cast_cmp_eq_int_0_sitofp_float_vec(<3 x i16> %i) {
942880

943881
define i1 @i16_cast_cmp_ne_int_0_sitofp_float(i16 %i) {
944882
; CHECK-LABEL: @i16_cast_cmp_ne_int_0_sitofp_float(
945-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to float
946-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
947-
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[B]], 0
883+
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[I:%.*]], 0
948884
; CHECK-NEXT: ret i1 [[CMP]]
949885
;
950886
%f = sitofp i16 %i to float
@@ -992,9 +928,7 @@ define <3 x i1> @i16_cast_cmp_slt_int_0_sitofp_float_vec(<3 x i16> %i) {
992928

993929
define i1 @i16_cast_cmp_sgt_int_0_sitofp_float(i16 %i) {
994930
; CHECK-LABEL: @i16_cast_cmp_sgt_int_0_sitofp_float(
995-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to float
996-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
997-
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[B]], 0
931+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[I:%.*]], 0
998932
; CHECK-NEXT: ret i1 [[CMP]]
999933
;
1000934
%f = sitofp i16 %i to float
@@ -1018,9 +952,7 @@ define <3 x i1> @i16_cast_cmp_sgt_int_0_sitofp_float_vec(<3 x i16> %i) {
1018952

1019953
define i1 @i16_cast_cmp_slt_int_1_sitofp_float(i16 %i) {
1020954
; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_float(
1021-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to float
1022-
; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32
1023-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[B]], 1
955+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[I:%.*]], 1
1024956
; CHECK-NEXT: ret i1 [[CMP]]
1025957
;
1026958
%f = sitofp i16 %i to float
@@ -1031,9 +963,7 @@ define i1 @i16_cast_cmp_slt_int_1_sitofp_float(i16 %i) {
1031963

1032964
define <3 x i1> @i16_cast_cmp_slt_int_1_sitofp_float_vec(<3 x i16> %i) {
1033965
; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_float_vec(
1034-
; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i16> [[I:%.*]] to <3 x float>
1035-
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x float> [[F]] to <3 x i32>
1036-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[B]], <i32 1, i32 undef, i32 1>
966+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[I:%.*]], <i16 1, i16 1, i16 1>
1037967
; CHECK-NEXT: ret <3 x i1> [[CMP]]
1038968
;
1039969
%f = sitofp <3 x i16> %i to <3 x float>
@@ -1066,9 +996,7 @@ define <3 x i1> @i16_cast_cmp_sgt_int_m1_sitofp_float_vec(<3 x i16> %i) {
1066996

1067997
define i1 @i16_cast_cmp_eq_int_0_sitofp_double(i16 %i) {
1068998
; CHECK-LABEL: @i16_cast_cmp_eq_int_0_sitofp_double(
1069-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to double
1070-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
1071-
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[B]], 0
999+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[I:%.*]], 0
10721000
; CHECK-NEXT: ret i1 [[CMP]]
10731001
;
10741002
%f = sitofp i16 %i to double
@@ -1092,9 +1020,7 @@ define <3 x i1> @i16_cast_cmp_eq_int_0_sitofp_double_vec(<3 x i16> %i) {
10921020

10931021
define i1 @i16_cast_cmp_ne_int_0_sitofp_double(i16 %i) {
10941022
; CHECK-LABEL: @i16_cast_cmp_ne_int_0_sitofp_double(
1095-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to double
1096-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
1097-
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[B]], 0
1023+
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[I:%.*]], 0
10981024
; CHECK-NEXT: ret i1 [[CMP]]
10991025
;
11001026
%f = sitofp i16 %i to double
@@ -1142,9 +1068,7 @@ define <3 x i1> @i16_cast_cmp_slt_int_0_sitofp_double_vec(<3 x i16> %i) {
11421068

11431069
define i1 @i16_cast_cmp_sgt_int_0_sitofp_double(i16 %i) {
11441070
; CHECK-LABEL: @i16_cast_cmp_sgt_int_0_sitofp_double(
1145-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to double
1146-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
1147-
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[B]], 0
1071+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[I:%.*]], 0
11481072
; CHECK-NEXT: ret i1 [[CMP]]
11491073
;
11501074
%f = sitofp i16 %i to double
@@ -1168,9 +1092,7 @@ define <3 x i1> @i16_cast_cmp_sgt_int_0_sitofp_double_vec(<3 x i16> %i) {
11681092

11691093
define i1 @i16_cast_cmp_slt_int_1_sitofp_double(i16 %i) {
11701094
; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_double(
1171-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to double
1172-
; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64
1173-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[B]], 1
1095+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[I:%.*]], 1
11741096
; CHECK-NEXT: ret i1 [[CMP]]
11751097
;
11761098
%f = sitofp i16 %i to double
@@ -1181,9 +1103,7 @@ define i1 @i16_cast_cmp_slt_int_1_sitofp_double(i16 %i) {
11811103

11821104
define <3 x i1> @i16_cast_cmp_slt_int_1_sitofp_double_vec(<3 x i16> %i) {
11831105
; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_double_vec(
1184-
; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i16> [[I:%.*]] to <3 x double>
1185-
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x double> [[F]] to <3 x i64>
1186-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[B]], <i64 1, i64 undef, i64 1>
1106+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[I:%.*]], <i16 1, i16 1, i16 1>
11871107
; CHECK-NEXT: ret <3 x i1> [[CMP]]
11881108
;
11891109
%f = sitofp <3 x i16> %i to <3 x double>
@@ -1216,9 +1136,7 @@ define <3 x i1> @i16_cast_cmp_sgt_int_m1_sitofp_double_vec(<3 x i16> %i) {
12161136

12171137
define i1 @i16_cast_cmp_eq_int_0_sitofp_half(i16 %i) {
12181138
; CHECK-LABEL: @i16_cast_cmp_eq_int_0_sitofp_half(
1219-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to half
1220-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
1221-
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[B]], 0
1139+
; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[I:%.*]], 0
12221140
; CHECK-NEXT: ret i1 [[CMP]]
12231141
;
12241142
%f = sitofp i16 %i to half
@@ -1242,9 +1160,7 @@ define <3 x i1> @i16_cast_cmp_eq_int_0_sitofp_half_vec(<3 x i16> %i) {
12421160

12431161
define i1 @i16_cast_cmp_ne_int_0_sitofp_half(i16 %i) {
12441162
; CHECK-LABEL: @i16_cast_cmp_ne_int_0_sitofp_half(
1245-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to half
1246-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
1247-
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[B]], 0
1163+
; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[I:%.*]], 0
12481164
; CHECK-NEXT: ret i1 [[CMP]]
12491165
;
12501166
%f = sitofp i16 %i to half
@@ -1292,9 +1208,7 @@ define <3 x i1> @i16_cast_cmp_slt_int_0_sitofp_half_vec(<3 x i16> %i) {
12921208

12931209
define i1 @i16_cast_cmp_sgt_int_0_sitofp_half(i16 %i) {
12941210
; CHECK-LABEL: @i16_cast_cmp_sgt_int_0_sitofp_half(
1295-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to half
1296-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
1297-
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[B]], 0
1211+
; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[I:%.*]], 0
12981212
; CHECK-NEXT: ret i1 [[CMP]]
12991213
;
13001214
%f = sitofp i16 %i to half
@@ -1318,9 +1232,7 @@ define <3 x i1> @i16_cast_cmp_sgt_int_0_sitofp_half_vec(<3 x i16> %i) {
13181232

13191233
define i1 @i16_cast_cmp_slt_int_1_sitofp_half(i16 %i) {
13201234
; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_half(
1321-
; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to half
1322-
; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16
1323-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[B]], 1
1235+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[I:%.*]], 1
13241236
; CHECK-NEXT: ret i1 [[CMP]]
13251237
;
13261238
%f = sitofp i16 %i to half
@@ -1331,9 +1243,7 @@ define i1 @i16_cast_cmp_slt_int_1_sitofp_half(i16 %i) {
13311243

13321244
define <3 x i1> @i16_cast_cmp_slt_int_1_sitofp_half_vec(<3 x i16> %i) {
13331245
; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_half_vec(
1334-
; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i16> [[I:%.*]] to <3 x half>
1335-
; CHECK-NEXT: [[B:%.*]] = bitcast <3 x half> [[F]] to <3 x i16>
1336-
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[B]], <i16 1, i16 undef, i16 1>
1246+
; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[I:%.*]], <i16 1, i16 1, i16 1>
13371247
; CHECK-NEXT: ret <3 x i1> [[CMP]]
13381248
;
13391249
%f = sitofp <3 x i16> %i to <3 x half>

0 commit comments

Comments
 (0)
Please sign in to comment.