[llvm] r326148 - [InstCombine, InstSimplify] add tests with undef elements in constant FP vectors; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 26 15:23:02 PST 2018


Author: spatel
Date: Mon Feb 26 15:23:02 2018
New Revision: 326148

URL: http://llvm.org/viewvc/llvm-project?rev=326148&view=rev
Log:
[InstCombine, InstSimplify] add tests with undef elements in constant FP vectors; NFC

Modified:
    llvm/trunk/test/Transforms/InstCombine/fdiv.ll
    llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll

Modified: llvm/trunk/test/Transforms/InstCombine/fdiv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fdiv.ll?rev=326148&r1=326147&r2=326148&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fdiv.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fdiv.ll Mon Feb 26 15:23:02 2018
@@ -122,6 +122,15 @@ define <2 x float> @not_exact_inverse_ve
   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 f
   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
@@ -242,6 +264,17 @@ define <2 x float> @fneg_dividend_consta
   %div = fdiv ninf <2 x float> %neg, <float 3.0, float -8.0>
   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(

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=326148&r1=326147&r2=326148&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll (original)
+++ llvm/trunk/test/Transforms/InstSimplify/floating-point-arithmetic.ll Mon Feb 26 15:23:02 2018
@@ -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(




More information about the llvm-commits mailing list