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
3
4; Combine sin / cos into a single call.
5; rdar://12856873
6
7define float @test1(float %x) nounwind {
8entry:
9; CHECK-IOS-LABEL: test1:
10; CHECK-IOS: bl ___sincosf_stret
11; CHECK-IOS: fadd s0, s0, s1
12
13; CHECK-LINUX-LABEL: test1:
14; CHECK-LINUX: bl sinf
15; CHECK-LINUX: bl cosf
16
17  %call = tail call float @sinf(float %x) nounwind readnone
18  %call1 = tail call float @cosf(float %x) nounwind readnone
19  %add = fadd float %call, %call1
20  ret float %add
21}
22
23define double @test2(double %x) nounwind {
24entry:
25; CHECK-IOS-LABEL: test2:
26; CHECK-IOS: bl ___sincos_stret
27; CHECK-IOS: fadd d0, d0, d1
28
29; CHECK-LINUX-LABEL: test2:
30; CHECK-LINUX: bl sin
31; CHECK-LINUX: bl cos
32
33  %call = tail call double @sin(double %x) nounwind readnone
34  %call1 = tail call double @cos(double %x) nounwind readnone
35  %add = fadd double %call, %call1
36  ret double %add
37}
38
39declare float  @sinf(float) readonly
40declare double @sin(double) readonly
41declare float @cosf(float) readonly
42declare double @cos(double) readonly
43