summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorYi Jiang <yjiang@apple.com>2013-12-12 01:55:04 +0000
committerYi Jiang <yjiang@apple.com>2013-12-12 01:55:04 +0000
commitf92a574246b391e905847e74b5e0283589c8741f (patch)
treef1617a8e57fa85330f1d62026e2183a7c6a87c2b /llvm/test
parent4705f8d842662050a88e9c0ac91ff337a5922fb6 (diff)
downloadbcm5719-llvm-f92a574246b391e905847e74b5e0283589c8741f.tar.gz
bcm5719-llvm-f92a574246b391e905847e74b5e0283589c8741f.zip
Resubmit r196544: Apply transformation on OS X 10.9+ and iOS 7.0+: pow(10, x) ―> __exp10(x)
llvm-svn: 197109
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/LTO/triple-init.ll3
-rw-r--r--llvm/test/Transforms/InstCombine/pow-1.ll24
2 files changed, 24 insertions, 3 deletions
diff --git a/llvm/test/LTO/triple-init.ll b/llvm/test/LTO/triple-init.ll
index b2c6dd89b5f..e0ad87967ba 100644
--- a/llvm/test/LTO/triple-init.ll
+++ b/llvm/test/LTO/triple-init.ll
@@ -2,9 +2,6 @@
; RUN: llvm-lto -exported-symbol=_main -o %t2 %t1
; RUN: llvm-nm %t2 | FileCheck %s
-; Will remove XFAIL if r196544 is resubmitted.
-; XFAIL: *
-
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9"
diff --git a/llvm/test/Transforms/InstCombine/pow-1.ll b/llvm/test/Transforms/InstCombine/pow-1.ll
index 9f1d073fe76..08dfa7a1013 100644
--- a/llvm/test/Transforms/InstCombine/pow-1.ll
+++ b/llvm/test/Transforms/InstCombine/pow-1.ll
@@ -1,6 +1,10 @@
; Test that the pow library call simplifier works correctly.
;
; RUN: opt < %s -instcombine -S | FileCheck %s
+; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.9 | FileCheck %s --check-prefix=CHECK-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios7.0 | FileCheck %s --check-prefix=CHECK-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=x86_64-apple-macosx10.8 | FileCheck %s --check-prefix=CHECK-NO-EXP10
+; RUN: opt -instcombine -S < %s -mtriple=arm-apple-ios6.0 | FileCheck %s --check-prefix=CHECK-NO-EXP10
; rdar://7251832
; NOTE: The readonly attribute on the pow call should be preserved
@@ -163,5 +167,25 @@ define double @test_simplify17(double %x) {
; CHECK-NEXT: ret double [[SELECT]]
}
+; Check pow(10.0, x) -> __exp10(x) on OS X 10.9+ and iOS 7.0+.
+
+define float @test_simplify18(float %x) {
+; CHECK-LABEL: @test_simplify18(
+ %retval = call float @powf(float 10.0, float %x)
+; CHECK-EXP10: [[EXP10F:%[_a-z0-9]+]] = call float @__exp10f(float %x) [[NUW_RO:#[0-9]+]]
+ ret float %retval
+; CHECK-EXP10: ret float [[EXP10F]]
+; CHECK-NO-EXP10: call float @powf
+}
+
+define double @test_simplify19(double %x) {
+; CHECK-LABEL: @test_simplify19(
+ %retval = call double @pow(double 10.0, double %x)
+; CHECK-EXP10: [[EXP10:%[_a-z0-9]+]] = call double @__exp10(double %x) [[NUW_RO]]
+ ret double %retval
+; CHECK-EXP10: ret double [[EXP10]]
+; CHECK-NO-EXP10: call double @pow
+}
+
; CHECK: attributes [[NUW_RO]] = { nounwind readonly }
OpenPOWER on IntegriCloud