[llvm] r361060 - [NFC][InstSimplify] Precommit new unary fneg test
Cameron McInally via llvm-commits
llvm-commits at lists.llvm.org
Fri May 17 11:34:35 PDT 2019
Author: mcinally
Date: Fri May 17 11:34:35 2019
New Revision: 361060
URL: http://llvm.org/viewvc/llvm-project?rev=361060&view=rev
Log:
[NFC][InstSimplify] Precommit new unary fneg test
Modified:
llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll
llvm/trunk/test/Transforms/InstSimplify/known-never-nan.ll
Modified: llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll?rev=361060&r1=361059&r2=361060&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll Fri May 17 11:34:35 2019
@@ -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
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:%.*]]
@@ -45,6 +68,17 @@ define <2 x float> @fsub_-0_-0_x_vec_und
%ret = fsub <2 x float> <float -0.0, float undef>, %t1
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) {
Modified: llvm/trunk/test/Transforms/InstSimplify/known-never-nan.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/known-never-nan.ll?rev=361060&r1=361059&r2=361060&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/known-never-nan.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/known-never-nan.ll Fri May 17 11:34:35 2019
@@ -255,8 +255,8 @@ define i1 @nnan_fsub(double %arg0, doubl
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]]
@@ -267,6 +267,19 @@ define i1 @nnan_fneg() {
%tmp = fcmp ord double %op, %op
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(
More information about the llvm-commits
mailing list