[llvm] r367233 - [NFC][FPEnv] Pre-commit tests for canonicalize negated operand of fdiv.

Cameron McInally via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 09:09:56 PDT 2019


Author: mcinally
Date: Mon Jul 29 09:09:56 2019
New Revision: 367233

URL: http://llvm.org/viewvc/llvm-project?rev=367233&view=rev
Log:
[NFC][FPEnv] Pre-commit tests for canonicalize negated operand of fdiv.

Modified:
    llvm/trunk/test/Transforms/InstCombine/fdiv.ll

Modified: llvm/trunk/test/Transforms/InstCombine/fdiv.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fdiv.ll?rev=367233&r1=367232&r2=367233&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fdiv.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fdiv.ll Mon Jul 29 09:09:56 2019
@@ -510,6 +510,17 @@ define double @fdiv_fneg1(double %x, dou
   ret double %div
 }
 
+define double @fdiv_unary_fneg1(double %x, double %y) {
+; CHECK-LABEL: @fdiv_unary_fneg1(
+; CHECK-NEXT:    [[TMP1:%.*]] = fdiv double [[X:%.*]], [[Y:%.*]]
+; CHECK-NEXT:    [[DIV:%.*]] = fsub double -0.000000e+00, [[TMP1]]
+; CHECK-NEXT:    ret double [[DIV]]
+;
+  %neg = fneg double %x
+  %div = fdiv double %neg, %y
+  ret double %div
+}
+
 define <2 x float> @fdiv_fneg2(<2 x float> %x, <2 x float> %y) {
 ; CHECK-LABEL: @fdiv_fneg2(
 ; CHECK-NEXT:    [[TMP1:%.*]] = fdiv <2 x float> [[Y:%.*]], [[X:%.*]]
@@ -520,6 +531,17 @@ define <2 x float> @fdiv_fneg2(<2 x floa
   %div = fdiv <2 x float> %y, %neg
   ret <2 x float> %div
 }
+
+define <2 x float> @fdiv_unary_fneg2(<2 x float> %x, <2 x float> %y) {
+; CHECK-LABEL: @fdiv_unary_fneg2(
+; CHECK-NEXT:    [[TMP1:%.*]] = fdiv <2 x float> [[Y:%.*]], [[X:%.*]]
+; CHECK-NEXT:    [[DIV:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[TMP1]]
+; CHECK-NEXT:    ret <2 x float> [[DIV]]
+;
+  %neg = fneg <2 x float> %x
+  %div = fdiv <2 x float> %y, %neg
+  ret <2 x float> %div
+}
 
 define float @fdiv_fneg1_extra_use(float %x, float %y) {
 ; CHECK-LABEL: @fdiv_fneg1_extra_use(




More information about the llvm-commits mailing list