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 ; RUN: llc < %s -mtriple=arm64-linux-android | FileCheck %s --check-prefix CHECK-LINUX
5 ; Combine sin / cos into a single call unless they may write errno (as
6 ; captured by readnone attrbiute, controlled by clang -fmath-errno
10 define float @test1(float %x) nounwind {
12 ; CHECK-IOS-LABEL: test1:
13 ; CHECK-IOS: bl ___sincosf_stret
14 ; CHECK-IOS: fadd s0, s0, s1
16 ; CHECK-LINUX-LABEL: test1:
17 ; CHECK-LINUX: bl sincosf
19 %call = tail call float @sinf(float %x) readnone
20 %call1 = tail call float @cosf(float %x) readnone
21 %add = fadd float %call, %call1
25 define float @test1_errno(float %x) nounwind {
27 ; CHECK-IOS-LABEL: test1_errno:
31 ; CHECK-LINUX-LABEL: test1_errno:
32 ; CHECK-LINUX: bl sinf
33 ; CHECK-LINUX: bl cosf
35 %call = tail call float @sinf(float %x)
36 %call1 = tail call float @cosf(float %x)
37 %add = fadd float %call, %call1
41 define double @test2(double %x) nounwind {
43 ; CHECK-IOS-LABEL: test2:
44 ; CHECK-IOS: bl ___sincos_stret
45 ; CHECK-IOS: fadd d0, d0, d1
47 ; CHECK-LINUX-LABEL: test2:
48 ; CHECK-LINUX: bl sincos
50 %call = tail call double @sin(double %x) readnone
51 %call1 = tail call double @cos(double %x) readnone
52 %add = fadd double %call, %call1
56 define double @test2_errno(double %x) nounwind {
58 ; CHECK-IOS-LABEL: test2_errno:
62 ; CHECK-LINUX-LABEL: test2_errno:
66 %call = tail call double @sin(double %x)
67 %call1 = tail call double @cos(double %x)
68 %add = fadd double %call, %call1
72 declare float @sinf(float)
73 declare double @sin(double)
74 declare float @cosf(float)
75 declare double @cos(double)