]> granicus.if.org Git - llvm/commitdiff
[NFC][InstSimplify] Precommit new unary fneg test
authorCameron McInally <cameron.mcinally@nyu.edu>
Fri, 17 May 2019 18:34:35 +0000 (18:34 +0000)
committerCameron McInally <cameron.mcinally@nyu.edu>
Fri, 17 May 2019 18:34:35 +0000 (18:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361060 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/InstSimplify/floating-point-arithmetic.ll
test/Transforms/InstSimplify/known-never-nan.ll

index 868c4a20735138f5bdf270932a5b719466628812..b24293cead4f662c444c614180dbdb0b640f5616 100644 (file)
@@ -28,6 +28,18 @@ define float @fsub_-0_-0_x(float %a) {
   ret float %ret
 }
 
+; fsub -0.0, (fneg X) ==> X
+define float @fneg_x(float %a) {
+; CHECK-LABEL: @fneg_x(
+; CHECK-NEXT:    %t1 = fneg float %a
+; CHECK-NEXT:    %ret = fsub float -0.000000e+00, %t1
+; CHECK-NEXT:    ret float %ret
+;
+  %t1 = fneg float %a
+  %ret = fsub float -0.0, %t1
+  ret float %ret
+}
+
 define <2 x float> @fsub_-0_-0_x_vec(<2 x float> %a) {
 ; CHECK-LABEL: @fsub_-0_-0_x_vec(
 ; CHECK-NEXT:    ret <2 x float> [[A:%.*]]
@@ -37,6 +49,17 @@ define <2 x float> @fsub_-0_-0_x_vec(<2 x float> %a) {
   ret <2 x float> %ret
 }
 
+define <2 x float> @fneg_x_vec(<2 x float> %a) {
+; CHECK-LABEL: @fneg_x_vec(
+; CHECK-NEXT:    %t1 = fneg <2 x float> %a
+; CHECK-NEXT:    %ret = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, %t1
+; CHECK-NEXT:    ret <2 x float> %ret
+;
+  %t1 = fneg <2 x float> %a
+  %ret = fsub <2 x float> <float -0.0, float -0.0>, %t1
+  ret <2 x float> %ret
+}
+
 define <2 x float> @fsub_-0_-0_x_vec_undef_elts(<2 x float> %a) {
 ; CHECK-LABEL: @fsub_-0_-0_x_vec_undef_elts(
 ; CHECK-NEXT:    ret <2 x float> [[A:%.*]]
@@ -46,6 +69,17 @@ define <2 x float> @fsub_-0_-0_x_vec_undef_elts(<2 x float> %a) {
   ret <2 x float> %ret
 }
 
+define <2 x float> @fneg_x_vec_undef_elts(<2 x float> %a) {
+; CHECK-LABEL: @fneg_x_vec_undef_elts(
+; CHECK-NEXT:    %t1 = fneg <2 x float> %a
+; CHECK-NEXT:    %ret = fsub <2 x float> <float -0.000000e+00, float undef>, %t1
+; CHECK-NEXT:    ret <2 x float> %ret
+;
+  %t1 = fneg <2 x float> %a
+  %ret = fsub <2 x float> <float -0.0, float undef>, %t1
+  ret <2 x float> %ret
+}
+
 ; fsub -0.0, (fsub 0.0, X) != X
 define float @fsub_-0_0_x(float %a) {
 ; CHECK-LABEL: @fsub_-0_0_x(
index d7c2fdc1cb1ebb3f1f61c5c13ba7dc93e43c11f9..37cfc932aa43a920dca7c08da1261640f352fcc4 100644 (file)
@@ -255,8 +255,8 @@ define i1 @nnan_fsub(double %arg0, double %arg1) {
   ret i1 %tmp
 }
 
-define i1 @nnan_fneg() {
-; CHECK-LABEL: @nnan_fneg(
+define i1 @nnan_binary_fneg() {
+; CHECK-LABEL: @nnan_binary_fneg(
 ; CHECK-NEXT:    [[NNAN:%.*]] = call nnan double @func()
 ; CHECK-NEXT:    [[OP:%.*]] = fsub double -0.000000e+00, [[NNAN]]
 ; CHECK-NEXT:    [[TMP:%.*]] = fcmp ord double [[OP]], [[OP]]
@@ -268,6 +268,19 @@ define i1 @nnan_fneg() {
   ret i1 %tmp
 }
 
+define i1 @nnan_unary_fneg() {
+; CHECK-LABEL: @nnan_unary_fneg(
+; CHECK-NEXT:    [[NNAN:%.*]] = call nnan double @func()
+; CHECK-NEXT:    [[OP:%.*]] = fneg double [[NNAN]]
+; CHECK-NEXT:    [[TMP:%.*]] = fcmp ord double [[OP]], [[OP]]
+; CHECK-NEXT:    ret i1 [[TMP]]
+;
+  %nnan = call nnan double @func()
+  %op = fneg double %nnan
+  %tmp = fcmp ord double %op, %op
+  ret i1 %tmp
+}
+
 define i1 @sitofp(i32 %arg0) {
 ; CHECK-LABEL: @sitofp(
 ; CHECK-NEXT:    ret i1 false