[llvm] r328448 - [InstCombine] peek through more icmp of FP cast + bitcast
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 25 07:01:42 PDT 2018
Author: spatel
Date: Sun Mar 25 07:01:42 2018
New Revision: 328448
URL: http://llvm.org/viewvc/llvm-project?rev=328448&view=rev
Log:
[InstCombine] peek through more icmp of FP cast + bitcast
This is an extension of rL328426 as noted in D44367.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
llvm/trunk/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=328448&r1=328447&r2=328448&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp Sun Mar 25 07:01:42 2018
@@ -4506,13 +4506,23 @@ Instruction *InstCombiner::visitICmpInst
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()));
}
Modified: llvm/trunk/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll?rev=328448&r1=328447&r2=328448&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/cast-int-icmp-eq-0.ll Sun Mar 25 07:01:42 2018
@@ -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_s
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_
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_
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
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]], <i32 1, i32 undef, i32 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[I:%.*]], <i32 1, i32 1, i32 1>
; 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
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_s
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_
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_
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
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]], <i64 1, i64 undef, i64 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[I:%.*]], <i32 1, i32 1, i32 1>
; 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
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_s
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_
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_
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
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]], <i16 1, i16 undef, i16 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i32> [[I:%.*]], <i32 1, i32 1, i32 1>
; 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
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_s
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_
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_
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
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]], <i32 1, i32 undef, i32 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[I:%.*]], <i64 1, i64 1, i64 1>
; 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
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_s
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_
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_
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
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]], <i64 1, i64 undef, i64 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[I:%.*]], <i64 1, i64 1, i64 1>
; 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
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_s
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_
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_
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
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]], <i16 1, i16 undef, i16 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i64> [[I:%.*]], <i64 1, i64 1, i64 1>
; 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
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_s
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_
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_
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
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]], <i32 1, i32 undef, i32 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[I:%.*]], <i16 1, i16 1, i16 1>
; 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
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_s
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_
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_
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
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]], <i64 1, i64 undef, i64 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[I:%.*]], <i16 1, i16 1, i16 1>
; 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
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_s
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_
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_
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
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]], <i16 1, i16 undef, i16 1>
+; CHECK-NEXT: [[CMP:%.*]] = icmp slt <3 x i16> [[I:%.*]], <i16 1, i16 1, i16 1>
; CHECK-NEXT: ret <3 x i1> [[CMP]]
;
%f = sitofp <3 x i16> %i to <3 x half>
More information about the llvm-commits
mailing list