xref: /aosp_15_r20/external/llvm/test/CodeGen/AArch64/arm64-sincos.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=arm64-apple-ios7 | FileCheck %s --check-prefix CHECK-IOS
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=arm64-linux-gnu | FileCheck %s --check-prefix CHECK-LINUX
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Combine sin / cos into a single call.
5*9880d681SAndroid Build Coastguard Worker; rdar://12856873
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdefine float @test1(float %x) nounwind {
8*9880d681SAndroid Build Coastguard Workerentry:
9*9880d681SAndroid Build Coastguard Worker; CHECK-IOS-LABEL: test1:
10*9880d681SAndroid Build Coastguard Worker; CHECK-IOS: bl ___sincosf_stret
11*9880d681SAndroid Build Coastguard Worker; CHECK-IOS: fadd s0, s0, s1
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; CHECK-LINUX-LABEL: test1:
14*9880d681SAndroid Build Coastguard Worker; CHECK-LINUX: bl sinf
15*9880d681SAndroid Build Coastguard Worker; CHECK-LINUX: bl cosf
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker  %call = tail call float @sinf(float %x) nounwind readnone
18*9880d681SAndroid Build Coastguard Worker  %call1 = tail call float @cosf(float %x) nounwind readnone
19*9880d681SAndroid Build Coastguard Worker  %add = fadd float %call, %call1
20*9880d681SAndroid Build Coastguard Worker  ret float %add
21*9880d681SAndroid Build Coastguard Worker}
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerdefine double @test2(double %x) nounwind {
24*9880d681SAndroid Build Coastguard Workerentry:
25*9880d681SAndroid Build Coastguard Worker; CHECK-IOS-LABEL: test2:
26*9880d681SAndroid Build Coastguard Worker; CHECK-IOS: bl ___sincos_stret
27*9880d681SAndroid Build Coastguard Worker; CHECK-IOS: fadd d0, d0, d1
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker; CHECK-LINUX-LABEL: test2:
30*9880d681SAndroid Build Coastguard Worker; CHECK-LINUX: bl sin
31*9880d681SAndroid Build Coastguard Worker; CHECK-LINUX: bl cos
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Worker  %call = tail call double @sin(double %x) nounwind readnone
34*9880d681SAndroid Build Coastguard Worker  %call1 = tail call double @cos(double %x) nounwind readnone
35*9880d681SAndroid Build Coastguard Worker  %add = fadd double %call, %call1
36*9880d681SAndroid Build Coastguard Worker  ret double %add
37*9880d681SAndroid Build Coastguard Worker}
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Workerdeclare float  @sinf(float) readonly
40*9880d681SAndroid Build Coastguard Workerdeclare double @sin(double) readonly
41*9880d681SAndroid Build Coastguard Workerdeclare float @cosf(float) readonly
42*9880d681SAndroid Build Coastguard Workerdeclare double @cos(double) readonly
43