Recommit r310809 with a fix for the spill problem
[llvm-core.git] / test / CodeGen / AArch64 / arm64-sincos.ll
blob98876dbe87b0350e6ccddf3e218a97b693b88027
1 ; RUN: llc < %s -mtriple=arm64-apple-ios7 | FileCheck %s --check-prefix CHECK-IOS
2 ; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s --check-prefix CHECK-LINUX
4 ; Combine sin / cos into a single call unless they may write errno (as
5 ; captured by readnone attrbiute, controlled by clang -fmath-errno
6 ; setting).
7 ; rdar://12856873
9 define float @test1(float %x) nounwind {
10 entry:
11 ; CHECK-IOS-LABEL: test1:
12 ; CHECK-IOS: bl ___sincosf_stret
13 ; CHECK-IOS: fadd s0, s0, s1
15 ; CHECK-LINUX-LABEL: test1:
16 ; CHECK-LINUX: bl sincosf
18   %call = tail call float @sinf(float %x) readnone
19   %call1 = tail call float @cosf(float %x) readnone
20   %add = fadd float %call, %call1
21   ret float %add
24 define float @test1_errno(float %x) nounwind {
25 entry:
26 ; CHECK-IOS-LABEL: test1_errno:
27 ; CHECK-IOS: bl _sinf
28 ; CHECK-IOS: bl _cosf
30 ; CHECK-LINUX-LABEL: test1_errno:
31 ; CHECK-LINUX: bl sinf
32 ; CHECK-LINUX: bl cosf
34   %call = tail call float @sinf(float %x)
35   %call1 = tail call float @cosf(float %x)
36   %add = fadd float %call, %call1
37   ret float %add
40 define double @test2(double %x) nounwind {
41 entry:
42 ; CHECK-IOS-LABEL: test2:
43 ; CHECK-IOS: bl ___sincos_stret
44 ; CHECK-IOS: fadd d0, d0, d1
46 ; CHECK-LINUX-LABEL: test2:
47 ; CHECK-LINUX: bl sincos
49   %call = tail call double @sin(double %x) readnone
50   %call1 = tail call double @cos(double %x) readnone
51   %add = fadd double %call, %call1
52   ret double %add
55 define double @test2_errno(double %x) nounwind {
56 entry:
57 ; CHECK-IOS-LABEL: test2_errno:
58 ; CHECK-IOS: bl _sin
59 ; CHECK-IOS: bl _cos
61 ; CHECK-LINUX-LABEL: test2_errno:
62 ; CHECK-LINUX: bl sin
63 ; CHECK-LINUX: bl cos
65   %call = tail call double @sin(double %x)
66   %call1 = tail call double @cos(double %x)
67   %add = fadd double %call, %call1
68   ret double %add
71 declare float  @sinf(float)
72 declare double @sin(double)
73 declare float @cosf(float)
74 declare double @cos(double)