[llvm] r367145 - [InstCombine] add tests for fdiv with negated operand; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 12:44:54 PDT 2019


Author: spatel
Date: Fri Jul 26 12:44:53 2019
New Revision: 367145

URL: http://llvm.org/viewvc/llvm-project?rev=367145&view=rev
Log:
[InstCombine] add tests for fdiv with negated operand; NFC

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=367145&r1=367144&r2=367145&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/fdiv.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/fdiv.ll Fri Jul 26 12:44:53 2019
@@ -499,3 +499,38 @@ define <2 x float> @div_constant_dividen
   ret <2 x float> %t2
 }
 
+define double @fdiv_fneg1(double %x, double %y) {
+; CHECK-LABEL: @fdiv_fneg1(
+; CHECK-NEXT:    [[NEG:%.*]] = fsub double -0.000000e+00, [[X:%.*]]
+; CHECK-NEXT:    [[DIV:%.*]] = fdiv double [[NEG]], [[Y:%.*]]
+; CHECK-NEXT:    ret double [[DIV]]
+;
+  %neg = fsub double -0.0, %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:    [[NEG:%.*]] = fsub <2 x float> <float -0.000000e+00, float -0.000000e+00>, [[X:%.*]]
+; CHECK-NEXT:    [[DIV:%.*]] = fdiv <2 x float> [[Y:%.*]], [[NEG]]
+; CHECK-NEXT:    ret <2 x float> [[DIV]]
+;
+  %neg = fsub <2 x float> <float -0.0, float -0.0>, %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(
+; CHECK-NEXT:    [[NEG:%.*]] = fsub float -0.000000e+00, [[X:%.*]]
+; CHECK-NEXT:    call void @use_f32(float [[NEG]])
+; CHECK-NEXT:    [[DIV:%.*]] = fdiv float [[NEG]], [[Y:%.*]]
+; CHECK-NEXT:    ret float [[DIV]]
+;
+  %neg = fsub float -0.0, %x
+  call void @use_f32(float %neg)
+  %div = fdiv float %neg, %y
+  ret float %div
+}
+




More information about the llvm-commits mailing list