From 841aac04d4130688fba1b372531445fedf4e1f34 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Sun, 25 Mar 2018 14:01:42 +0000 Subject: [PATCH] [InstCombine] peek through more icmp of FP cast + bitcast This is an extension of rL328426 as noted in D44367. llvm-svn: 328448 --- .../Transforms/InstCombine/InstCombineCompares.cpp | 18 ++- .../Transforms/InstCombine/cast-int-icmp-eq-0.ll | 180 ++++++--------------- 2 files changed, 59 insertions(+), 139 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index 61e1d92..46448aa 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -4506,13 +4506,23 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { return New; } - // Sign-bit checks are preserved through signed floating-point casts: - // icmp slt (bitcast (sitofp X)), 0 --> icmp slt X, 0 - // icmp sgt (bitcast (sitofp X)), -1 --> icmp sgt X, -1 + // Zero-equality and sign-bit checks are preserved through sitofp + bitcast. Value *X; if (match(Op0, m_BitCast(m_SIToFP(m_Value(X))))) { - if (Pred == ICmpInst::ICMP_SLT && match(Op1, m_Zero())) + // icmp eq (bitcast (sitofp X)), 0 --> icmp eq X, 0 + // icmp ne (bitcast (sitofp X)), 0 --> icmp ne X, 0 + // icmp slt (bitcast (sitofp X)), 0 --> icmp slt X, 0 + // icmp sgt (bitcast (sitofp X)), 0 --> icmp sgt X, 0 + if ((Pred == ICmpInst::ICMP_EQ || Pred == ICmpInst::ICMP_SLT || + Pred == ICmpInst::ICMP_NE || Pred == ICmpInst::ICMP_SGT) && + match(Op1, m_Zero())) return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType())); + + // icmp slt (bitcast (sitofp X)), 1 --> icmp slt X, 1 + if (Pred == ICmpInst::ICMP_SLT && match(Op1, m_One())) + return new ICmpInst(Pred, X, ConstantInt::get(X->getType(), 1)); + + // icmp sgt (bitcast (sitofp X)), -1 --> icmp sgt X, -1 if (Pred == ICmpInst::ICMP_SGT && match(Op1, m_AllOnes())) return new ICmpInst(Pred, X, ConstantInt::getAllOnesValue(X->getType())); } diff --git a/llvm/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll b/llvm/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll index 2208e529..fe5c5c5 100644 --- a/llvm/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll +++ b/llvm/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll @@ -16,9 +16,7 @@ define i1 @i32_cast_cmp_eq_int_0_sitofp_float(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_eq_int_0_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i32_cast_cmp_ne_int_0_sitofp_float(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_ne_int_0_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i32_cast_cmp_sgt_int_0_sitofp_float(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_sgt_int_0_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i32_cast_cmp_slt_int_1_sitofp_float(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[B]], 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I:%.*]], 1 ; CHECK-NEXT: ret i1 [[CMP]] ; %f = sitofp i32 %i to float @@ -131,9 +123,7 @@ define i1 @i32_cast_cmp_slt_int_1_sitofp_float(i32 %i) { define <3 x i1> @i32_cast_cmp_slt_int_1_sitofp_float_vec(<3 x i32> %i) { ; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_float_vec( -; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i32> [[I:%.*]] to <3 x float> -; CHECK-NEXT: [[B:%.*]] = bitcast <3 x float> [[F]] to <3 x i32> -; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[B]], +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[I:%.*]], ; CHECK-NEXT: ret <3 x i1> [[CMP]] ; %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) { define i1 @i32_cast_cmp_eq_int_0_sitofp_double(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_eq_int_0_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i32_cast_cmp_ne_int_0_sitofp_double(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_ne_int_0_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i32_cast_cmp_sgt_int_0_sitofp_double(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_sgt_int_0_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i32_cast_cmp_slt_int_1_sitofp_double(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[B]], 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I:%.*]], 1 ; CHECK-NEXT: ret i1 [[CMP]] ; %f = sitofp i32 %i to double @@ -281,9 +263,7 @@ define i1 @i32_cast_cmp_slt_int_1_sitofp_double(i32 %i) { define <3 x i1> @i32_cast_cmp_slt_int_1_sitofp_double_vec(<3 x i32> %i) { ; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_double_vec( -; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i32> [[I:%.*]] to <3 x double> -; CHECK-NEXT: [[B:%.*]] = bitcast <3 x double> [[F]] to <3 x i64> -; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[B]], +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[I:%.*]], ; CHECK-NEXT: ret <3 x i1> [[CMP]] ; %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) { define i1 @i32_cast_cmp_eq_int_0_sitofp_half(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_eq_int_0_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i32_cast_cmp_ne_int_0_sitofp_half(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_ne_int_0_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i32_cast_cmp_sgt_int_0_sitofp_half(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_sgt_int_0_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i32_cast_cmp_slt_int_1_sitofp_half(i32 %i) { ; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i32 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[B]], 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[I:%.*]], 1 ; CHECK-NEXT: ret i1 [[CMP]] ; %f = sitofp i32 %i to half @@ -431,9 +403,7 @@ define i1 @i32_cast_cmp_slt_int_1_sitofp_half(i32 %i) { define <3 x i1> @i32_cast_cmp_slt_int_1_sitofp_half_vec(<3 x i32> %i) { ; CHECK-LABEL: @i32_cast_cmp_slt_int_1_sitofp_half_vec( -; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i32> [[I:%.*]] to <3 x half> -; CHECK-NEXT: [[B:%.*]] = bitcast <3 x half> [[F]] to <3 x i16> -; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[B]], +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[I:%.*]], ; CHECK-NEXT: ret <3 x i1> [[CMP]] ; %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) { define i1 @i64_cast_cmp_eq_int_0_sitofp_float(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_eq_int_0_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i64_cast_cmp_ne_int_0_sitofp_float(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_ne_int_0_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i64_cast_cmp_sgt_int_0_sitofp_float(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_sgt_int_0_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i64_cast_cmp_slt_int_1_sitofp_float(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[B]], 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[I:%.*]], 1 ; CHECK-NEXT: ret i1 [[CMP]] ; %f = sitofp i64 %i to float @@ -581,9 +543,7 @@ define i1 @i64_cast_cmp_slt_int_1_sitofp_float(i64 %i) { define <3 x i1> @i64_cast_cmp_slt_int_1_sitofp_float_vec(<3 x i64> %i) { ; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_float_vec( -; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i64> [[I:%.*]] to <3 x float> -; CHECK-NEXT: [[B:%.*]] = bitcast <3 x float> [[F]] to <3 x i32> -; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[B]], +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[I:%.*]], ; CHECK-NEXT: ret <3 x i1> [[CMP]] ; %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) { define i1 @i64_cast_cmp_eq_int_0_sitofp_double(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_eq_int_0_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i64_cast_cmp_ne_int_0_sitofp_double(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_ne_int_0_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i64_cast_cmp_sgt_int_0_sitofp_double(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_sgt_int_0_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i64_cast_cmp_slt_int_1_sitofp_double(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[B]], 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[I:%.*]], 1 ; CHECK-NEXT: ret i1 [[CMP]] ; %f = sitofp i64 %i to double @@ -731,9 +683,7 @@ define i1 @i64_cast_cmp_slt_int_1_sitofp_double(i64 %i) { define <3 x i1> @i64_cast_cmp_slt_int_1_sitofp_double_vec(<3 x i64> %i) { ; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_double_vec( -; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i64> [[I:%.*]] to <3 x double> -; CHECK-NEXT: [[B:%.*]] = bitcast <3 x double> [[F]] to <3 x i64> -; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[B]], +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[I:%.*]], ; CHECK-NEXT: ret <3 x i1> [[CMP]] ; %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) { define i1 @i64_cast_cmp_eq_int_0_sitofp_half(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_eq_int_0_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i64_cast_cmp_ne_int_0_sitofp_half(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_ne_int_0_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i64_cast_cmp_sgt_int_0_sitofp_half(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_sgt_int_0_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i64_cast_cmp_slt_int_1_sitofp_half(i64 %i) { ; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i64 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[B]], 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[I:%.*]], 1 ; CHECK-NEXT: ret i1 [[CMP]] ; %f = sitofp i64 %i to half @@ -881,9 +823,7 @@ define i1 @i64_cast_cmp_slt_int_1_sitofp_half(i64 %i) { define <3 x i1> @i64_cast_cmp_slt_int_1_sitofp_half_vec(<3 x i64> %i) { ; CHECK-LABEL: @i64_cast_cmp_slt_int_1_sitofp_half_vec( -; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i64> [[I:%.*]] to <3 x half> -; CHECK-NEXT: [[B:%.*]] = bitcast <3 x half> [[F]] to <3 x i16> -; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[B]], +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[I:%.*]], ; CHECK-NEXT: ret <3 x i1> [[CMP]] ; %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) { define i1 @i16_cast_cmp_eq_int_0_sitofp_float(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_eq_int_0_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i16_cast_cmp_ne_int_0_sitofp_float(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_ne_int_0_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i32 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i16_cast_cmp_sgt_int_0_sitofp_float(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_sgt_int_0_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i32 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i16_cast_cmp_slt_int_1_sitofp_float(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_float( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to float -; CHECK-NEXT: [[B:%.*]] = bitcast float [[F]] to i32 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i32 [[B]], 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[I:%.*]], 1 ; CHECK-NEXT: ret i1 [[CMP]] ; %f = sitofp i16 %i to float @@ -1031,9 +963,7 @@ define i1 @i16_cast_cmp_slt_int_1_sitofp_float(i16 %i) { define <3 x i1> @i16_cast_cmp_slt_int_1_sitofp_float_vec(<3 x i16> %i) { ; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_float_vec( -; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i16> [[I:%.*]] to <3 x float> -; CHECK-NEXT: [[B:%.*]] = bitcast <3 x float> [[F]] to <3 x i32> -; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[B]], +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[I:%.*]], ; CHECK-NEXT: ret <3 x i1> [[CMP]] ; %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) { define i1 @i16_cast_cmp_eq_int_0_sitofp_double(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_eq_int_0_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i16_cast_cmp_ne_int_0_sitofp_double(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_ne_int_0_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i64 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i16_cast_cmp_sgt_int_0_sitofp_double(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_sgt_int_0_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i64 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i16_cast_cmp_slt_int_1_sitofp_double(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_double( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to double -; CHECK-NEXT: [[B:%.*]] = bitcast double [[F]] to i64 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i64 [[B]], 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[I:%.*]], 1 ; CHECK-NEXT: ret i1 [[CMP]] ; %f = sitofp i16 %i to double @@ -1181,9 +1103,7 @@ define i1 @i16_cast_cmp_slt_int_1_sitofp_double(i16 %i) { define <3 x i1> @i16_cast_cmp_slt_int_1_sitofp_double_vec(<3 x i16> %i) { ; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_double_vec( -; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i16> [[I:%.*]] to <3 x double> -; CHECK-NEXT: [[B:%.*]] = bitcast <3 x double> [[F]] to <3 x i64> -; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[B]], +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[I:%.*]], ; CHECK-NEXT: ret <3 x i1> [[CMP]] ; %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) { define i1 @i16_cast_cmp_eq_int_0_sitofp_half(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_eq_int_0_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp eq i16 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i16_cast_cmp_ne_int_0_sitofp_half(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_ne_int_0_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp ne i16 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i16_cast_cmp_sgt_int_0_sitofp_half(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_sgt_int_0_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[B]], 0 +; CHECK-NEXT: [[CMP:%.*]] = icmp sgt i16 [[I:%.*]], 0 ; CHECK-NEXT: ret i1 [[CMP]] ; %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) { define i1 @i16_cast_cmp_slt_int_1_sitofp_half(i16 %i) { ; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_half( -; CHECK-NEXT: [[F:%.*]] = sitofp i16 [[I:%.*]] to half -; CHECK-NEXT: [[B:%.*]] = bitcast half [[F]] to i16 -; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[B]], 1 +; CHECK-NEXT: [[CMP:%.*]] = icmp slt i16 [[I:%.*]], 1 ; CHECK-NEXT: ret i1 [[CMP]] ; %f = sitofp i16 %i to half @@ -1331,9 +1243,7 @@ define i1 @i16_cast_cmp_slt_int_1_sitofp_half(i16 %i) { define <3 x i1> @i16_cast_cmp_slt_int_1_sitofp_half_vec(<3 x i16> %i) { ; CHECK-LABEL: @i16_cast_cmp_slt_int_1_sitofp_half_vec( -; CHECK-NEXT: [[F:%.*]] = sitofp <3 x i16> [[I:%.*]] to <3 x half> -; CHECK-NEXT: [[B:%.*]] = bitcast <3 x half> [[F]] to <3 x i16> -; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[B]], +; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[I:%.*]], ; CHECK-NEXT: ret <3 x i1> [[CMP]] ; %f = sitofp <3 x i16> %i to <3 x half> -- 2.7.4