summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCameron McInally <cameron.mcinally@nyu.edu>2019-05-31 15:40:03 +0000
committerCameron McInally <cameron.mcinally@nyu.edu>2019-05-31 15:40:03 +0000
commit6d2a4712f3accd3fa34ed2bdecdf2ebf987dccca (patch)
tree37d29d35813a5752e9a4dba7eddbf93d5491fb68
parent18e7bf5c4dcb16a723654ee89b1952a5f59283bf (diff)
downloadbcm5719-llvm-6d2a4712f3accd3fa34ed2bdecdf2ebf987dccca.tar.gz
bcm5719-llvm-6d2a4712f3accd3fa34ed2bdecdf2ebf987dccca.zip
[NFC][InstCombine] Add unary FNeg tests to fcmp.ll
llvm-svn: 362234
-rw-r--r--llvm/test/Transforms/InstCombine/fcmp.ll118
1 files changed, 118 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fcmp.ll b/llvm/test/Transforms/InstCombine/fcmp.ll
index be7aedc7c60..cd941fea90e 100644
--- a/llvm/test/Transforms/InstCombine/fcmp.ll
+++ b/llvm/test/Transforms/InstCombine/fcmp.ll
@@ -68,6 +68,16 @@ define i1 @fneg_constant_swap_pred(float %x) {
ret i1 %cmp
}
+define i1 @unary_fneg_constant_swap_pred(float %x) {
+; CHECK-LABEL: @unary_fneg_constant_swap_pred(
+; CHECK-NEXT: [[CMP:%.*]] = fcmp olt float [[X:%.*]], -1.000000e+00
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %neg = fneg float %x
+ %cmp = fcmp ogt float %neg, 1.0
+ ret i1 %cmp
+}
+
define <2 x i1> @fneg_constant_swap_pred_vec(<2 x float> %x) {
; CHECK-LABEL: @fneg_constant_swap_pred_vec(
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <2 x float> [[X:%.*]], <float -1.000000e+00, float -2.000000e+00>
@@ -78,6 +88,16 @@ define <2 x i1> @fneg_constant_swap_pred_vec(<2 x float> %x) {
ret <2 x i1> %cmp
}
+define <2 x i1> @unary_fneg_constant_swap_pred_vec(<2 x float> %x) {
+; CHECK-LABEL: @unary_fneg_constant_swap_pred_vec(
+; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <2 x float> [[X:%.*]], <float -1.000000e+00, float -2.000000e+00>
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %neg = fneg <2 x float> %x
+ %cmp = fcmp ogt <2 x float> %neg, <float 1.0, float 2.0>
+ ret <2 x i1> %cmp
+}
+
define <2 x i1> @fneg_constant_swap_pred_vec_undef(<2 x float> %x) {
; CHECK-LABEL: @fneg_constant_swap_pred_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = fcmp olt <2 x float> [[X:%.*]], <float -1.000000e+00, float -2.000000e+00>
@@ -100,6 +120,16 @@ define i1 @fneg_fmf(float %x) {
ret i1 %r
}
+define i1 @unary_fneg_fmf(float %x) {
+; CHECK-LABEL: @unary_fneg_fmf(
+; CHECK-NEXT: [[R:%.*]] = fcmp fast oeq float [[X:%.*]], -4.200000e+01
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %n = fneg fast float %x
+ %r = fcmp fast oeq float %n, 42.0
+ ret i1 %r
+}
+
; The new fcmp should have the same FMF as the original, vector edition.
define <2 x i1> @fcmp_fneg_fmf_vec(<2 x float> %x) {
@@ -123,6 +153,39 @@ define i1 @fneg_fneg_swap_pred(float %x, float %y) {
ret i1 %cmp
}
+define i1 @unary_fneg_unary_fneg_swap_pred(float %x, float %y) {
+; CHECK-LABEL: @unary_fneg_unary_fneg_swap_pred(
+; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan ogt float [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %neg1 = fneg float %x
+ %neg2 = fneg float %y
+ %cmp = fcmp nnan olt float %neg1, %neg2
+ ret i1 %cmp
+}
+
+define i1 @unary_fneg_fneg_swap_pred(float %x, float %y) {
+; CHECK-LABEL: @unary_fneg_fneg_swap_pred(
+; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan ogt float [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %neg1 = fneg float %x
+ %neg2 = fsub float -0.0, %y
+ %cmp = fcmp nnan olt float %neg1, %neg2
+ ret i1 %cmp
+}
+
+define i1 @fneg_unary_fneg_swap_pred(float %x, float %y) {
+; CHECK-LABEL: @fneg_unary_fneg_swap_pred(
+; CHECK-NEXT: [[CMP:%.*]] = fcmp nnan ogt float [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %neg1 = fsub float -0.0, %x
+ %neg2 = fneg float %y
+ %cmp = fcmp nnan olt float %neg1, %neg2
+ ret i1 %cmp
+}
+
define <2 x i1> @fneg_fneg_swap_pred_vec(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @fneg_fneg_swap_pred_vec(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt <2 x float> [[X:%.*]], [[Y:%.*]]
@@ -134,6 +197,39 @@ define <2 x i1> @fneg_fneg_swap_pred_vec(<2 x float> %x, <2 x float> %y) {
ret <2 x i1> %cmp
}
+define <2 x i1> @unary_fneg_unary_fneg_swap_pred_vec(<2 x float> %x, <2 x float> %y) {
+; CHECK-LABEL: @unary_fneg_unary_fneg_swap_pred_vec(
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt <2 x float> [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %neg1 = fneg <2 x float> %x
+ %neg2 = fneg <2 x float> %y
+ %cmp = fcmp ninf olt <2 x float> %neg1, %neg2
+ ret <2 x i1> %cmp
+}
+
+define <2 x i1> @unary_fneg_fneg_swap_pred_vec(<2 x float> %x, <2 x float> %y) {
+; CHECK-LABEL: @unary_fneg_fneg_swap_pred_vec(
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt <2 x float> [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %neg1 = fneg <2 x float> %x
+ %neg2 = fsub <2 x float> <float -0.0, float -0.0>, %y
+ %cmp = fcmp ninf olt <2 x float> %neg1, %neg2
+ ret <2 x i1> %cmp
+}
+
+define <2 x i1> @fneg_unary_fneg_swap_pred_vec(<2 x float> %x, <2 x float> %y) {
+; CHECK-LABEL: @fneg_unary_fneg_swap_pred_vec(
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ninf ogt <2 x float> [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %neg1 = fsub <2 x float> <float -0.0, float -0.0>, %x
+ %neg2 = fneg <2 x float> %y
+ %cmp = fcmp ninf olt <2 x float> %neg1, %neg2
+ ret <2 x i1> %cmp
+}
+
define <2 x i1> @fneg_fneg_swap_pred_vec_undef(<2 x float> %x, <2 x float> %y) {
; CHECK-LABEL: @fneg_fneg_swap_pred_vec_undef(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt <2 x float> [[X:%.*]], [[Y:%.*]]
@@ -145,6 +241,28 @@ define <2 x i1> @fneg_fneg_swap_pred_vec_undef(<2 x float> %x, <2 x float> %y) {
ret <2 x i1> %cmp
}
+define <2 x i1> @unary_fneg_fneg_swap_pred_vec_undef(<2 x float> %x, <2 x float> %y) {
+; CHECK-LABEL: @unary_fneg_fneg_swap_pred_vec_undef(
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt <2 x float> [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %neg1 = fneg <2 x float> %x
+ %neg2 = fsub <2 x float> <float undef, float -0.0>, %y
+ %cmp = fcmp olt <2 x float> %neg1, %neg2
+ ret <2 x i1> %cmp
+}
+
+define <2 x i1> @fneg_unary_fneg_swap_pred_vec_undef(<2 x float> %x, <2 x float> %y) {
+; CHECK-LABEL: @fneg_unary_fneg_swap_pred_vec_undef(
+; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt <2 x float> [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %neg1 = fsub <2 x float> <float -0.0, float undef>, %x
+ %neg2 = fneg <2 x float> %y
+ %cmp = fcmp olt <2 x float> %neg1, %neg2
+ ret <2 x i1> %cmp
+}
+
define i1 @test7(float %x) {
; CHECK-LABEL: @test7(
; CHECK-NEXT: [[CMP:%.*]] = fcmp ogt float [[X:%.*]], 0.000000e+00
OpenPOWER on IntegriCloud