xref: /llvm-project/llvm/test/CodeGen/AArch64/fast-isel-runtime-libcall.ll (revision 2f0308ed02ea622b8228d271d9aebe4bd4deacdd)
1; RUN: llc -mtriple=aarch64-apple-darwin -fast-isel -fast-isel-abort=1 -code-model=small -verify-machineinstrs < %s | FileCheck %s --check-prefix=SMALL
2; RUN: llc -mtriple=aarch64-apple-darwin -fast-isel -fast-isel-abort=1 -code-model=large -verify-machineinstrs < %s | FileCheck %s --check-prefix=LARGE
3
4define float @frem_f32(float %a, float %b) {
5; SMALL-LABEL: frem_f32
6; SMALL:       bl _fmodf
7; LARGE-LABEL: frem_f32
8; LARGE:       adrp  [[REG:x[0-9]+]], _fmodf@GOTPAGE
9; LARGE:       ldr [[REG]], [[[REG]], _fmodf@GOTPAGEOFF]
10; LARGE-NEXT:  blr [[REG]]
11  %1 = frem float %a, %b
12  ret float %1
13}
14
15define double @frem_f64(double %a, double %b) {
16; SMALL-LABEL: frem_f64
17; SMALL:       bl _fmod
18; LARGE-LABEL: frem_f64
19; LARGE:       adrp  [[REG:x[0-9]+]], _fmod@GOTPAGE
20; LARGE:       ldr [[REG]], [[[REG]], _fmod@GOTPAGEOFF]
21; LARGE-NEXT:  blr [[REG]]
22  %1 = frem double %a, %b
23  ret double %1
24}
25
26define float @sin_f32(float %a) {
27; SMALL-LABEL: sin_f32
28; SMALL:       bl _sinf
29; LARGE-LABEL: sin_f32
30; LARGE:       adrp  [[REG:x[0-9]+]], _sinf@GOTPAGE
31; LARGE:       ldr [[REG]], [[[REG]], _sinf@GOTPAGEOFF]
32; LARGE-NEXT:  blr [[REG]]
33  %1 = call float @llvm.sin.f32(float %a)
34  ret float %1
35}
36
37define double @sin_f64(double %a) {
38; SMALL-LABEL: sin_f64
39; SMALL:       bl _sin
40; LARGE-LABEL: sin_f64
41; LARGE:       adrp  [[REG:x[0-9]+]], _sin@GOTPAGE
42; LARGE:       ldr [[REG]], [[[REG]], _sin@GOTPAGEOFF]
43; LARGE-NEXT:  blr [[REG]]
44  %1 = call double @llvm.sin.f64(double %a)
45  ret double %1
46}
47
48define float @cos_f32(float %a) {
49; SMALL-LABEL: cos_f32
50; SMALL:       bl _cosf
51; LARGE-LABEL: cos_f32
52; LARGE:       adrp  [[REG:x[0-9]+]], _cosf@GOTPAGE
53; LARGE:       ldr [[REG]], [[[REG]], _cosf@GOTPAGEOFF]
54; LARGE-NEXT:  blr [[REG]]
55  %1 = call float @llvm.cos.f32(float %a)
56  ret float %1
57}
58
59define double @cos_f64(double %a) {
60; SMALL-LABEL: cos_f64
61; SMALL:       bl _cos
62; LARGE-LABEL: cos_f64
63; LARGE:       adrp  [[REG:x[0-9]+]], _cos@GOTPAGE
64; LARGE:       ldr [[REG]], [[[REG]], _cos@GOTPAGEOFF]
65; LARGE-NEXT:  blr [[REG]]
66  %1 = call double @llvm.cos.f64(double %a)
67  ret double %1
68}
69
70define float @tan_f32(float %a) {
71; SMALL-LABEL: tan_f32
72; SMALL:       bl _tanf
73; LARGE-LABEL: tan_f32
74; LARGE:       adrp  [[REG:x[0-9]+]], _tanf@GOTPAGE
75; LARGE:       ldr [[REG]], [[[REG]], _tanf@GOTPAGEOFF]
76; LARGE-NEXT:  blr [[REG]]
77  %1 = call float @llvm.tan.f32(float %a)
78  ret float %1
79}
80
81define double @tan_f64(double %a) {
82; SMALL-LABEL: tan_f64
83; SMALL:       bl _tan
84; LARGE-LABEL: tan_f64
85; LARGE:       adrp  [[REG:x[0-9]+]], _tan@GOTPAGE
86; LARGE:       ldr [[REG]], [[[REG]], _tan@GOTPAGEOFF]
87; LARGE-NEXT:  blr [[REG]]
88  %1 = call double @llvm.tan.f64(double %a)
89  ret double %1
90}
91
92define float @pow_f32(float %a, float %b) {
93; SMALL-LABEL: pow_f32
94; SMALL:       bl _powf
95; LARGE-LABEL: pow_f32
96; LARGE:       adrp  [[REG:x[0-9]+]], _powf@GOTPAGE
97; LARGE:       ldr [[REG]], [[[REG]], _powf@GOTPAGEOFF]
98; LARGE-NEXT:  blr [[REG]]
99  %1 = call float @llvm.pow.f32(float %a, float %b)
100  ret float %1
101}
102
103define double @pow_f64(double %a, double %b) {
104; SMALL-LABEL: pow_f64
105; SMALL:       bl _pow
106; LARGE-LABEL: pow_f64
107; LARGE:       adrp  [[REG:x[0-9]+]], _pow@GOTPAGE
108; LARGE:       ldr [[REG]], [[[REG]], _pow@GOTPAGEOFF]
109; LARGE-NEXT:  blr [[REG]]
110  %1 = call double @llvm.pow.f64(double %a, double %b)
111  ret double %1
112}
113declare float @llvm.sin.f32(float)
114declare double @llvm.sin.f64(double)
115declare float @llvm.cos.f32(float)
116declare double @llvm.cos.f64(double)
117declare float @llvm.tan.f32(float)
118declare double @llvm.tan.f64(double)
119declare float @llvm.pow.f32(float, float)
120declare double @llvm.pow.f64(double, double)
121