diff options
-rw-r--r-- | llvm/test/Transforms/InstCombine/fdiv.ll | 33 | ||||
-rw-r--r-- | llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll | 29 |
2 files changed, 62 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fdiv.ll b/llvm/test/Transforms/InstCombine/fdiv.ll index 8073371c16b..9e265d2135f 100644 --- a/llvm/test/Transforms/InstCombine/fdiv.ll +++ b/llvm/test/Transforms/InstCombine/fdiv.ll @@ -122,6 +122,15 @@ define <2 x float> @not_exact_inverse_vec_arcp(<2 x float> %x) { ret <2 x float> %div } +define <2 x float> @not_exact_inverse_vec_arcp_with_undef_elt(<2 x float> %x) { +; CHECK-LABEL: @not_exact_inverse_vec_arcp_with_undef_elt( +; CHECK-NEXT: [[DIV:%.*]] = fdiv arcp <2 x float> [[X:%.*]], <float undef, float 3.000000e+00> +; CHECK-NEXT: ret <2 x float> [[DIV]] +; + %div = fdiv arcp <2 x float> %x, <float undef, float 3.0> + ret <2 x float> %div +} + ; (X / Y) / Z --> X / (Y * Z) define float @div_with_div_numerator(float %x, float %y, float %z) { @@ -213,6 +222,19 @@ define <2 x float> @fneg_fneg_vec(<2 x float> %x, <2 x float> %y) { ret <2 x float> %div } +define <2 x float> @fneg_fneg_vec_undef_elts(<2 x float> %x, <2 x float> %y) { +; CHECK-LABEL: @fneg_fneg_vec_undef_elts( +; CHECK-NEXT: [[XNEG:%.*]] = fsub <2 x float> <float undef, float -0.000000e+00>, [[X:%.*]] +; CHECK-NEXT: [[YNEG:%.*]] = fsub <2 x float> <float -0.000000e+00, float undef>, [[Y:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv <2 x float> [[XNEG]], [[YNEG]] +; CHECK-NEXT: ret <2 x float> [[DIV]] +; + %xneg = fsub <2 x float> <float undef, float -0.0>, %x + %yneg = fsub <2 x float> <float -0.0, float undef>, %y + %div = fdiv <2 x float> %xneg, %yneg + ret <2 x float> %div +} + define float @fneg_dividend_constant_divisor(float %x) { ; CHECK-LABEL: @fneg_dividend_constant_divisor( ; CHECK-NEXT: [[DIV:%.*]] = fdiv nsz float [[X:%.*]], -3.000000e+00 @@ -243,6 +265,17 @@ define <2 x float> @fneg_dividend_constant_divisor_vec(<2 x float> %x) { ret <2 x float> %div } +define <2 x float> @fneg_dividend_constant_divisor_vec_undef_elt(<2 x float> %x) { +; CHECK-LABEL: @fneg_dividend_constant_divisor_vec_undef_elt( +; CHECK-NEXT: [[NEG:%.*]] = fsub <2 x float> <float undef, float -0.000000e+00>, [[X:%.*]] +; CHECK-NEXT: [[DIV:%.*]] = fdiv ninf <2 x float> [[NEG]], <float 3.000000e+00, float -8.000000e+00> +; CHECK-NEXT: ret <2 x float> [[DIV]] +; + %neg = fsub <2 x float> <float undef, float -0.0>, %x + %div = fdiv ninf <2 x float> %neg, <float 3.0, float -8.0> + ret <2 x float> %div +} + define <2 x float> @fneg_divisor_constant_dividend_vec(<2 x float> %x) { ; CHECK-LABEL: @fneg_divisor_constant_dividend_vec( ; CHECK-NEXT: [[DIV:%.*]] = fdiv afn <2 x float> <float 3.000000e+00, float -5.000000e+00>, [[X:%.*]] diff --git a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll index ba177ead718..d564992e2d8 100644 --- a/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll +++ b/llvm/test/Transforms/InstSimplify/floating-point-arithmetic.ll @@ -11,6 +11,26 @@ define float @fsub_-0_-0_x(float %a) { 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:%.*]] +; + %t1 = fsub <2 x float> <float -0.0, float -0.0>, %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: [[T1:%.*]] = fsub <2 x float> <float undef, float -0.000000e+00>, [[A:%.*]] +; CHECK-NEXT: [[RET:%.*]] = fsub <2 x float> <float -0.000000e+00, float undef>, [[T1]] +; CHECK-NEXT: ret <2 x float> [[RET]] +; + %t1 = fsub <2 x float> <float undef, float -0.0>, %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( @@ -53,6 +73,15 @@ define float @fadd_x_n0(float %a) { ret float %ret } +define <2 x float> @fadd_x_n0_vec_undef_elt(<2 x float> %a) { +; CHECK-LABEL: @fadd_x_n0_vec_undef_elt( +; CHECK-NEXT: [[RET:%.*]] = fadd <2 x float> [[A:%.*]], <float -0.000000e+00, float undef> +; CHECK-NEXT: ret <2 x float> [[RET]] +; + %ret = fadd <2 x float> %a, <float -0.0, float undef> + ret <2 x float> %ret +} + ; fmul X, 1.0 ==> X define double @fmul_X_1(double %a) { ; CHECK-LABEL: @fmul_X_1( |