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
9 ; Combine sin / cos into a single call unless they may write errno (as
10 ; captured by readnone attrbiute, controlled by clang -fmath-errno
14 define float @test1(float %x) nounwind {
16 ; SINCOS-LABEL: test1:
17 ; SINCOS: bl ___sincosf_stret
19 ; SINCOS-GNU-LABEL: test1:
20 ; SINCOS-GNU: bl sincosf
26 ; NOOPT-ANDROID-LABEL: test1:
27 ; NOOPT-ANDROID: bl sinf
28 ; NOOPT-ANDROID: bl cosf
30 %call = tail call float @sinf(float %x) readnone
31 %call1 = tail call float @cosf(float %x) readnone
32 %add = fadd float %call, %call1
36 define float @test1_errno(float %x) nounwind {
38 ; SINCOS-LABEL: test1_errno:
42 ; SINCOS-GNU-LABEL: test1_errno:
46 ; NOOPT-LABEL: test1_errno:
50 ; NOOPT-ANDROID-LABEL: test1_errno:
51 ; NOOPT-ANDROID: bl sinf
52 ; NOOPT-ANDROID: bl cosf
54 %call = tail call float @sinf(float %x)
55 %call1 = tail call float @cosf(float %x)
56 %add = fadd float %call, %call1
60 define double @test2(double %x) nounwind {
62 ; SINCOS-LABEL: test2:
63 ; SINCOS: bl ___sincos_stret
65 ; SINCOS-GNU-LABEL: test2:
66 ; SINCOS-GNU: bl sincos
72 ; NOOPT-ANDROID-LABEL: test2:
73 ; NOOPT-ANDROID: bl sin
74 ; NOOPT-ANDROID: bl cos
76 %call = tail call double @sin(double %x) readnone
77 %call1 = tail call double @cos(double %x) readnone
78 %add = fadd double %call, %call1
82 define double @test2_errno(double %x) nounwind {
84 ; SINCOS-LABEL: test2_errno:
88 ; SINCOS-GNU-LABEL: test2_errno:
92 ; NOOPT-LABEL: test2_errno:
96 ; NOOPT-ANDROID-LABEL: test2_errno:
97 ; NOOPT-ANDROID: bl sin
98 ; NOOPT-ANDROID: bl cos
100 %call = tail call double @sin(double %x)
101 %call1 = tail call double @cos(double %x)
102 %add = fadd double %call, %call1
106 declare float @sinf(float)
107 declare double @sin(double)
108 declare float @cosf(float)
109 declare double @cos(double)