summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2018-02-23 22:20:13 +0000
committerSanjay Patel <spatel@rotateright.com>2018-02-23 22:20:13 +0000
commitdb53d1847bcc7900ca351144806c93375f4bd3e1 (patch)
tree7d4dc1e302fe19629fe7710897033305859a802c /llvm/test
parentebc6bc8188c06cb89f01d338004bb4ef55a692f9 (diff)
downloadbcm5719-llvm-db53d1847bcc7900ca351144806c93375f4bd3e1.tar.gz
bcm5719-llvm-db53d1847bcc7900ca351144806c93375f4bd3e1.zip
[InstSimplify] sqrt(X) * sqrt(X) --> X
This was misplaced in InstCombine. We can loosen the FMF as a follow-up step. llvm-svn: 325965
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/fmul.ll11
-rw-r--r--llvm/test/Transforms/InstSimplify/fast-math.ll15
2 files changed, 15 insertions, 11 deletions
diff --git a/llvm/test/Transforms/InstCombine/fmul.ll b/llvm/test/Transforms/InstCombine/fmul.ll
index 1c05475ba07..2eaa7c3e761 100644
--- a/llvm/test/Transforms/InstCombine/fmul.ll
+++ b/llvm/test/Transforms/InstCombine/fmul.ll
@@ -172,19 +172,8 @@ define float @test11(float %x, float %y) {
ret float %c
}
-; PR21126: http://llvm.org/bugs/show_bug.cgi?id=21126
-; With unsafe/fast math, sqrt(X) * sqrt(X) is just X.
declare double @llvm.sqrt.f64(double)
-define double @sqrt_squared1(double %f) {
-; CHECK-LABEL: @sqrt_squared1(
-; CHECK-NEXT: ret double [[F:%.*]]
-;
- %sqrt = call double @llvm.sqrt.f64(double %f)
- %mul = fmul fast double %sqrt, %sqrt
- ret double %mul
-}
-
; With unsafe/fast math, sqrt(X) * sqrt(X) is just X,
; but make sure another use of the sqrt is intact.
; Note that the remaining fmul is altered but is not 'fast'
diff --git a/llvm/test/Transforms/InstSimplify/fast-math.ll b/llvm/test/Transforms/InstSimplify/fast-math.ll
index f4f31236e5c..dbf17a2fcee 100644
--- a/llvm/test/Transforms/InstSimplify/fast-math.ll
+++ b/llvm/test/Transforms/InstSimplify/fast-math.ll
@@ -203,3 +203,18 @@ define float @fdiv_neg_swapped2(float %f) {
%div = fdiv nnan float %f, %neg
ret float %div
}
+
+; PR21126: http://llvm.org/bugs/show_bug.cgi?id=21126
+; With unsafe/fast math, sqrt(X) * sqrt(X) is just X.
+
+declare double @llvm.sqrt.f64(double)
+
+define double @sqrt_squared(double %f) {
+; CHECK-LABEL: @sqrt_squared(
+; CHECK-NEXT: ret double [[F:%.*]]
+;
+ %sqrt = call double @llvm.sqrt.f64(double %f)
+ %mul = fmul fast double %sqrt, %sqrt
+ ret double %mul
+}
+
OpenPOWER on IntegriCloud