[llvm] r360808 - Pre-commit unary fneg tests to InstSimplify
Cameron McInally via llvm-commits
llvm-commits at lists.llvm.org
Wed May 15 13:27:37 PDT 2019
Author: mcinally
Date: Wed May 15 13:27:37 2019
New Revision: 360808
URL: http://llvm.org/viewvc/llvm-project?rev=360808&view=rev
Log:
Pre-commit unary fneg tests to InstSimplify
Modified:
llvm/trunk/test/Transforms/InstSimplify/fast-math.ll
Modified: llvm/trunk/test/Transforms/InstSimplify/fast-math.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstSimplify/fast-math.ll?rev=360808&r1=360807&r2=360808&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/fast-math.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/fast-math.ll Wed May 15 13:27:37 2019
@@ -106,8 +106,8 @@ define <2 x float> @fadd_fnegx_commute_v
; https://bugs.llvm.org/show_bug.cgi?id=26958
; https://bugs.llvm.org/show_bug.cgi?id=27151
-define float @fadd_fneg_nan(float %x) {
-; CHECK-LABEL: @fadd_fneg_nan(
+define float @fadd_binary_fneg_nan(float %x) {
+; CHECK-LABEL: @fadd_binary_fneg_nan(
; CHECK-NEXT: [[T:%.*]] = fsub nnan float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[COULD_BE_NAN:%.*]] = fadd ninf float [[T]], [[X]]
; CHECK-NEXT: ret float [[COULD_BE_NAN]]
@@ -117,8 +117,19 @@ define float @fadd_fneg_nan(float %x) {
ret float %could_be_nan
}
-define float @fadd_fneg_nan_commute(float %x) {
-; CHECK-LABEL: @fadd_fneg_nan_commute(
+define float @fadd_unary_fneg_nan(float %x) {
+; CHECK-LABEL: @fadd_unary_fneg_nan(
+; CHECK-NEXT: [[T:%.*]] = fneg nnan float [[X:%.*]]
+; CHECK-NEXT: [[COULD_BE_NAN:%.*]] = fadd ninf float [[T]], [[X]]
+; CHECK-NEXT: ret float [[COULD_BE_NAN]]
+;
+ %t = fneg nnan float %x
+ %could_be_nan = fadd ninf float %t, %x
+ ret float %could_be_nan
+}
+
+define float @fadd_binary_fneg_nan_commute(float %x) {
+; CHECK-LABEL: @fadd_binary_fneg_nan_commute(
; CHECK-NEXT: [[T:%.*]] = fsub nnan ninf float -0.000000e+00, [[X:%.*]]
; CHECK-NEXT: [[COULD_BE_NAN:%.*]] = fadd float [[X]], [[T]]
; CHECK-NEXT: ret float [[COULD_BE_NAN]]
@@ -128,6 +139,17 @@ define float @fadd_fneg_nan_commute(floa
ret float %could_be_nan
}
+define float @fadd_unary_fneg_nan_commute(float %x) {
+; CHECK-LABEL: @fadd_unary_fneg_nan_commute(
+; CHECK-NEXT: [[T:%.*]] = fneg nnan ninf float [[X:%.*]]
+; CHECK-NEXT: [[COULD_BE_NAN:%.*]] = fadd float [[X]], [[T]]
+; CHECK-NEXT: ret float [[COULD_BE_NAN]]
+;
+ %t = fneg nnan ninf float %x
+ %could_be_nan = fadd float %x, %t
+ ret float %could_be_nan
+}
+
; X + (0.0 - X) --> 0.0 (with nnan on the fadd)
define float @fadd_fsub_nnan_ninf(float %x) {
@@ -194,6 +216,18 @@ define float @fsub_0_0_x(float %a) {
ret float %ret
}
+; fsub nsz 0.0, (fneg X) ==> X
+define float @fneg_x(float %a) {
+; CHECK-LABEL: @fneg_x(
+; CHECK-NEXT: [[T1:%.*]] = fsub float 0.000000e+00, [[A:%.*]]
+; CHECK-NEXT: [[RET:%.*]] = fneg nsz float [[T1]]
+; CHECK-NEXT: ret float [[RET]]
+;
+ %t1 = fsub float 0.0, %a
+ %ret = fneg nsz float %t1
+ ret float %ret
+}
+
define <2 x float> @fsub_0_0_x_vec_undef1(<2 x float> %a) {
; CHECK-LABEL: @fsub_0_0_x_vec_undef1(
; CHECK-NEXT: ret <2 x float> [[A:%.*]]
@@ -203,6 +237,17 @@ define <2 x float> @fsub_0_0_x_vec_undef
ret <2 x float> %ret
}
+define <2 x float> @fneg_x_vec_undef1(<2 x float> %a) {
+; CHECK-LABEL: @fneg_x_vec_undef1(
+; CHECK-NEXT: [[T1:%.*]] = fsub <2 x float> <float 0.000000e+00, float undef>, [[A:%.*]]
+; CHECK-NEXT: [[RET:%.*]] = fneg nsz <2 x float> [[T1]]
+; CHECK-NEXT: ret <2 x float> [[RET]]
+;
+ %t1 = fsub <2 x float> <float 0.0, float undef>, %a
+ %ret = fneg nsz <2 x float> %t1
+ ret <2 x float> %ret
+}
+
define <2 x float> @fsub_0_0_x_vec_undef2(<2 x float> %a) {
; CHECK-LABEL: @fsub_0_0_x_vec_undef2(
; CHECK-NEXT: ret <2 x float> [[A:%.*]]
More information about the llvm-commits
mailing list