summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorKarthik Bhat <kv.bhat@samsung.com>2015-07-08 03:55:47 +0000
committerKarthik Bhat <kv.bhat@samsung.com>2015-07-08 03:55:47 +0000
commitd2bc0d8423717d212367f99868ca5808e16f2353 (patch)
treed8adf5ae8cd0581c1f3326931c020476d27d7c60 /llvm/test/Transforms
parent4c3ab458a5b8d0ce0e1065b41b4f3650d838e873 (diff)
downloadbcm5719-llvm-d2bc0d8423717d212367f99868ca5808e16f2353.tar.gz
bcm5719-llvm-d2bc0d8423717d212367f99868ca5808e16f2353.zip
Allow constfolding of llvm.sin.* and llvm.cos.* intrinsics
This patch const folds llvm.sin.* and llvm.cos.* intrinsics whenever feasible. Differential Revision: http://reviews.llvm.org/D10836 llvm-svn: 241665
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/intrinsics.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/intrinsics.ll b/llvm/test/Transforms/InstCombine/intrinsics.ll
index 9767704c85c..bea063787a7 100644
--- a/llvm/test/Transforms/InstCombine/intrinsics.ll
+++ b/llvm/test/Transforms/InstCombine/intrinsics.ll
@@ -17,6 +17,8 @@ declare i32 @llvm.cttz.i32(i32, i1) nounwind readnone
declare i32 @llvm.ctlz.i32(i32, i1) nounwind readnone
declare i32 @llvm.ctpop.i32(i32) nounwind readnone
declare i8 @llvm.ctlz.i8(i8, i1) nounwind readnone
+declare double @llvm.cos.f64(double %Val) nounwind readonly
+declare double @llvm.sin.f64(double %Val) nounwind readonly
define i8 @uaddtest1(i8 %A, i8 %B) {
%x = call %overflow.result @llvm.uadd.with.overflow.i8(i8 %A, i8 %B)
@@ -425,3 +427,23 @@ define %ov.result.32 @never_overflows_ssub_test0(i32 %a) {
; CHECK-NEXT: %[[x:.*]] = insertvalue %ov.result.32 { i32 undef, i1 false }, i32 %a, 0
; CHECK-NEXT: ret %ov.result.32 %[[x]]
}
+
+define void @cos(double *%P) {
+entry:
+ %B = tail call double @llvm.cos.f64(double 0.0) nounwind
+ store volatile double %B, double* %P
+
+ ret void
+; CHECK-LABEL: @cos(
+; CHECK: store volatile double 1.000000e+00, double* %P
+}
+
+define void @sin(double *%P) {
+entry:
+ %B = tail call double @llvm.sin.f64(double 0.0) nounwind
+ store volatile double %B, double* %P
+
+ ret void
+; CHECK-LABEL: @sin(
+; CHECK: store volatile double 0.000000e+00, double* %P
+}
OpenPOWER on IntegriCloud