• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -mtriple=armv7-apple-ios6 -mcpu=cortex-a8 | FileCheck %s --check-prefix=NOOPT
2; RUN: llc < %s -mtriple=armv7-apple-ios7 -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS
3; RUN: llc < %s -mtriple=armv7-linux-gnu -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS-GNU
4; RUN: llc < %s -mtriple=armv7-linux-gnueabi -mcpu=cortex-a8 \
5; RUN:   --enable-unsafe-fp-math | FileCheck %s --check-prefix=SINCOS-GNU
6; RUN: llc < %s -mtriple=armv7-linux-android -mcpu=cortex-a8 | FileCheck %s --check-prefix=NOOPT-ANDROID
7; RUN: llc < %s -mtriple=armv7-linux-android9 -mcpu=cortex-a8 | FileCheck %s --check-prefix=SINCOS-GNU
8
9; Combine sin / cos into a single call unless they may write errno (as
10; captured by readnone attrbiute, controlled by clang -fmath-errno
11; setting).
12; rdar://12856873
13
14define float @test1(float %x) nounwind {
15entry:
16; SINCOS-LABEL: test1:
17; SINCOS: bl ___sincosf_stret
18
19; SINCOS-GNU-LABEL: test1:
20; SINCOS-GNU: bl sincosf
21
22; NOOPT-LABEL: test1:
23; NOOPT: bl _sinf
24; NOOPT: bl _cosf
25
26; NOOPT-ANDROID-LABEL: test1:
27; NOOPT-ANDROID: bl sinf
28; NOOPT-ANDROID: bl cosf
29
30  %call = tail call float @sinf(float %x) readnone
31  %call1 = tail call float @cosf(float %x) readnone
32  %add = fadd float %call, %call1
33  ret float %add
34}
35
36define float @test1_errno(float %x) nounwind {
37entry:
38; SINCOS-LABEL: test1_errno:
39; SINCOS: bl _sinf
40; SINCOS: bl _cosf
41
42; SINCOS-GNU-LABEL: test1_errno:
43; SINCOS-GNU: bl sinf
44; SINCOS-GNU: bl cosf
45
46; NOOPT-LABEL: test1_errno:
47; NOOPT: bl _sinf
48; NOOPT: bl _cosf
49
50; NOOPT-ANDROID-LABEL: test1_errno:
51; NOOPT-ANDROID: bl sinf
52; NOOPT-ANDROID: bl cosf
53
54  %call = tail call float @sinf(float %x)
55  %call1 = tail call float @cosf(float %x)
56  %add = fadd float %call, %call1
57  ret float %add
58}
59
60define double @test2(double %x) nounwind {
61entry:
62; SINCOS-LABEL: test2:
63; SINCOS: bl ___sincos_stret
64
65; SINCOS-GNU-LABEL: test2:
66; SINCOS-GNU: bl sincos
67
68; NOOPT-LABEL: test2:
69; NOOPT: bl _sin
70; NOOPT: bl _cos
71
72; NOOPT-ANDROID-LABEL: test2:
73; NOOPT-ANDROID: bl sin
74; NOOPT-ANDROID: bl cos
75
76  %call = tail call double @sin(double %x) readnone
77  %call1 = tail call double @cos(double %x) readnone
78  %add = fadd double %call, %call1
79  ret double %add
80}
81
82define double @test2_errno(double %x) nounwind {
83entry:
84; SINCOS-LABEL: test2_errno:
85; SINCOS: bl _sin
86; SINCOS: bl _cos
87
88; SINCOS-GNU-LABEL: test2_errno:
89; SINCOS-GNU: bl sin
90; SINCOS-GNU: bl cos
91
92; NOOPT-LABEL: test2_errno:
93; NOOPT: bl _sin
94; NOOPT: bl _cos
95
96; NOOPT-ANDROID-LABEL: test2_errno:
97; NOOPT-ANDROID: bl sin
98; NOOPT-ANDROID: bl cos
99
100  %call = tail call double @sin(double %x)
101  %call1 = tail call double @cos(double %x)
102  %add = fadd double %call, %call1
103  ret double %add
104}
105
106declare float  @sinf(float)
107declare double @sin(double)
108declare float @cosf(float)
109declare double @cos(double)
110