aboutsummaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/log-pow.ll
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:46:15 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:46:15 +0000
commitdd58ef019b700900793a1eb48b52123db01b654e (patch)
treefcfbb4df56a744f4ddc6122c50521dd3f1c5e196 /test/Transforms/InstCombine/log-pow.ll
parent2fe5752e3a7c345cdb59e869278d36af33c13fa4 (diff)
downloadsrc-dd58ef019b700900793a1eb48b52123db01b654e.tar.gz
src-dd58ef019b700900793a1eb48b52123db01b654e.zip
Vendor import of llvm trunk r256633:
Notes
Notes: svn path=/vendor/llvm/dist/; revision=292915
Diffstat (limited to 'test/Transforms/InstCombine/log-pow.ll')
-rw-r--r--test/Transforms/InstCombine/log-pow.ll41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/log-pow.ll b/test/Transforms/InstCombine/log-pow.ll
new file mode 100644
index 000000000000..c5ca1688d34a
--- /dev/null
+++ b/test/Transforms/InstCombine/log-pow.ll
@@ -0,0 +1,41 @@
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+define double @mylog(double %x, double %y) #0 {
+entry:
+ %pow = call double @llvm.pow.f64(double %x, double %y)
+ %call = call double @log(double %pow) #0
+ ret double %call
+}
+
+; CHECK-LABEL: define double @mylog(
+; CHECK: %log = call fast double @log(double %x) #0
+; CHECK: %mul = fmul fast double %log, %y
+; CHECK: ret double %mul
+; CHECK: }
+
+define double @test2(double ()* %fptr, double %p1) #0 {
+ %call1 = call double %fptr()
+ %pow = call double @log(double %call1)
+ ret double %pow
+}
+
+; CHECK-LABEL: @test2
+; CHECK: log
+
+define double @test3(double %x) #0 {
+ %call2 = call double @exp2(double %x) #0
+ %call3 = call double @log(double %call2) #0
+ ret double %call3
+}
+
+; CHECK-LABEL: @test3
+; CHECK: %call2 = call double @exp2(double %x) #0
+; CHECK: %logmul = fmul fast double %x, 0x3FE62E42FEFA39EF
+; CHECK: ret double %logmul
+; CHECK: }
+
+declare double @log(double) #0
+declare double @exp2(double) #0
+declare double @llvm.pow.f64(double, double)
+
+attributes #0 = { "unsafe-fp-math"="true" }