summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2013-01-30 22:57:00 +0000
committerEvan Cheng <evan.cheng@apple.com>2013-01-30 22:57:00 +0000
commitb25a645830b49beb1c5dbc326953ed16f77a19ed (patch)
treeda3c0b5b816533029f339f69e15da0c0bef9b8c6 /test
parenta66f40a8cc685b2869e7f8d988f9a17439875ece (diff)
downloadllvm-b25a645830b49beb1c5dbc326953ed16f77a19ed.tar.gz
llvm-b25a645830b49beb1c5dbc326953ed16f77a19ed.tar.bz2
llvm-b25a645830b49beb1c5dbc326953ed16f77a19ed.tar.xz
Forgot the test case before.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173988 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/X86/sincos-opt.ll40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/CodeGen/X86/sincos-opt.ll b/test/CodeGen/X86/sincos-opt.ll
new file mode 100644
index 0000000000..65c8417745
--- /dev/null
+++ b/test/CodeGen/X86/sincos-opt.ll
@@ -0,0 +1,40 @@
+; RUN: llc < %s -mtriple=x86_64-apple-macosx10.9.0 -mcpu=core2 | FileCheck %s --check-prefix=SINCOS
+; RUN: llc < %s -mtriple=x86_64-apple-macosx10.8.0 -mcpu=core2 | FileCheck %s --check-prefix=NOOPT
+
+; Combine sin / cos into a single call.
+; rdar://13087969
+
+define float @test1(float %x) nounwind {
+entry:
+; SINCOS: test1:
+; SINCOS: callq ___sincosf_stret
+; SINCOS: addss %xmm1, %xmm0
+
+; NOOPT: test1
+; NOOPT: callq _cosf
+; NOOPT: callq _sinf
+ %call = tail call float @sinf(float %x) nounwind readnone
+ %call1 = tail call float @cosf(float %x) nounwind readnone
+ %add = fadd float %call, %call1
+ ret float %add
+}
+
+define double @test2(double %x) nounwind {
+entry:
+; SINCOS: test2:
+; SINCOS: callq ___sincos_stret
+; SINCOS: addsd %xmm1, %xmm0
+
+; NOOPT: test2
+; NOOPT: callq _cos
+; NOOPT: callq _sin
+ %call = tail call double @sin(double %x) nounwind readnone
+ %call1 = tail call double @cos(double %x) nounwind readnone
+ %add = fadd double %call, %call1
+ ret double %add
+}
+
+declare float @sinf(float) readonly
+declare double @sin(double) readonly
+declare float @cosf(float) readonly
+declare double @cos(double) readonly