[llvm] r362234 - [NFC][InstCombine] Add unary FNeg tests to fcmp.ll

Cameron McInally via llvm-commits llvm-commits at lists.llvm.org
Fri May 31 08:40:03 PDT 2019


Author: mcinally
Date: Fri May 31 08:40:03 2019
New Revision: 362234

URL: http://llvm.org/viewvc/llvm-project?rev=362234&view=rev
Log:
[NFC][InstCombine] Add unary FNeg tests to fcmp.ll

Modified:
    llvm/trunk/test/Transforms/InstCombine/fcmp.ll

Modified: llvm/trunk/test/Transforms/InstCombine/fcmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fcmp.ll?rev=362234&r1=362233&r2=362234&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fcmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fcmp.ll Fri May 31 08:40:03 2019
@@ -68,6 +68,16 @@ define i1 @fneg_constant_swap_pred(float
   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
   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,
   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
   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:%.*]]
@@ -144,6 +240,28 @@ define <2 x i1> @fneg_fneg_swap_pred_vec
   %cmp = fcmp olt <2 x float> %neg1, %neg2
   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(




More information about the llvm-commits mailing list