summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-01-11 22:50:36 +0000
committerSanjay Patel <spatel@rotateright.com>2016-01-11 22:50:36 +0000
commit6c1ddbb7b6ee3788419878fc7ab49fd30124b57b (patch)
treede4bdf3219a55ccf2614a6e7072d029604369368 /llvm/test
parent38c202e97e51de7d4f2b523e15fa56c8c1a494cd (diff)
downloadbcm5719-llvm-6c1ddbb7b6ee3788419878fc7ab49fd30124b57b.tar.gz
bcm5719-llvm-6c1ddbb7b6ee3788419878fc7ab49fd30124b57b.zip
[LibCallSimplifier] don't allow sqrt transform unless all ops are unsafe
Fix the FIXME added with: http://reviews.llvm.org/rL257400 llvm-svn: 257404
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/fast-math.ll15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/fast-math.ll b/llvm/test/Transforms/InstCombine/fast-math.ll
index b24ce278ca8..6ccf6e9fa77 100644
--- a/llvm/test/Transforms/InstCombine/fast-math.ll
+++ b/llvm/test/Transforms/InstCombine/fast-math.ll
@@ -649,6 +649,21 @@ define double @sqrt_intrinsic_three_args6(double %x, double %y) {
; CHECK-NEXT: ret double %1
}
+; If any operation is not 'fast', we can't simplify.
+
+define double @sqrt_intrinsic_not_so_fast(double %x, double %y) {
+ %mul = fmul double %x, %x
+ %mul2 = fmul fast double %mul, %y
+ %sqrt = call fast double @llvm.sqrt.f64(double %mul2)
+ ret double %sqrt
+
+; CHECK-LABEL: sqrt_intrinsic_not_so_fast(
+; CHECK-NEXT: %mul = fmul double %x, %x
+; CHECK-NEXT: %mul2 = fmul fast double %mul, %y
+; CHECK-NEXT: %sqrt = call fast double @llvm.sqrt.f64(double %mul2)
+; CHECK-NEXT: ret double %sqrt
+}
+
define double @sqrt_intrinsic_arg_4th(double %x) {
%mul = fmul fast double %x, %x
%mul2 = fmul fast double %mul, %mul
OpenPOWER on IntegriCloud