xref: /aosp_15_r20/external/llvm/test/CodeGen/ARM/aapcs-hfa-code.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=armv7-linux-gnueabihf -o - | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=thumbv7em-none-eabi -mcpu=cortex-m4 | FileCheck %s --check-prefix=CHECK-M4F
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine arm_aapcs_vfpcc void @test_1float({ float } %a) {
7*9880d681SAndroid Build Coastguard Worker  call arm_aapcs_vfpcc void @test_1float({ float } { float 1.0 })
8*9880d681SAndroid Build Coastguard Worker  ret void
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_1float:
11*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: vmov.f32 s0, #1.{{0+}}e+00
12*9880d681SAndroid Build Coastguard Worker; CHECK: bl test_1float
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-LABEL: test_1float:
15*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-DAG: vmov.f32 s0, #1.{{0+}}e+00
16*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: bl test_1float
17*9880d681SAndroid Build Coastguard Worker}
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerdefine arm_aapcs_vfpcc void @test_2float({ float, float } %a) {
20*9880d681SAndroid Build Coastguard Worker  call arm_aapcs_vfpcc void @test_2float({ float, float } { float 1.0, float 2.0 })
21*9880d681SAndroid Build Coastguard Worker  ret void
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_2float:
24*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: vmov.f32 s0, #1.{{0+}}e+00
25*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: vmov.f32 s1, #2.{{0+}}e+00
26*9880d681SAndroid Build Coastguard Worker; CHECK: bl test_2float
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-LABEL: test_2float:
29*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-DAG: vmov.f32 s0, #1.{{0+}}e+00
30*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-DAG: vmov.f32 s1, #2.{{0+}}e+00
31*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: bl test_2float
32*9880d681SAndroid Build Coastguard Worker}
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Workerdefine arm_aapcs_vfpcc void @test_3float({ float, float, float } %a) {
35*9880d681SAndroid Build Coastguard Worker  call arm_aapcs_vfpcc void @test_3float({ float, float, float } { float 1.0, float 2.0, float 3.0 })
36*9880d681SAndroid Build Coastguard Worker  ret void
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_3float:
39*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: vmov.f32 s0, #1.{{0+}}e+00
40*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: vmov.f32 s1, #2.{{0+}}e+00
41*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: vmov.f32 s2, #3.{{0+}}e+00
42*9880d681SAndroid Build Coastguard Worker; CHECK: bl test_3float
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-LABEL: test_3float:
45*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-DAG: vmov.f32 s0, #1.{{0+}}e+00
46*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-DAG: vmov.f32 s1, #2.{{0+}}e+00
47*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-DAG: vmov.f32 s2, #3.{{0+}}e+00
48*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: bl test_3float
49*9880d681SAndroid Build Coastguard Worker}
50*9880d681SAndroid Build Coastguard Worker
51*9880d681SAndroid Build Coastguard Workerdefine arm_aapcs_vfpcc void @test_1double({ double } %a) {
52*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_1double:
53*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: vmov.f64 d0, #1.{{0+}}e+00
54*9880d681SAndroid Build Coastguard Worker; CHECK: bl test_1double
55*9880d681SAndroid Build Coastguard Worker
56*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-LABEL: test_1double:
57*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: vldr d0, [[CP_LABEL:.*]]
58*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: bl test_1double
59*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: [[CP_LABEL]]
60*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-NEXT: .long 0
61*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-NEXT: .long 1072693248
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard Worker  call arm_aapcs_vfpcc void @test_1double({ double } { double 1.0 })
64*9880d681SAndroid Build Coastguard Worker  ret void
65*9880d681SAndroid Build Coastguard Worker}
66*9880d681SAndroid Build Coastguard Worker
67*9880d681SAndroid Build Coastguard Worker; Final double argument might be put in s15 & [sp] if we're careless. It should
68*9880d681SAndroid Build Coastguard Worker; go all on the stack.
69*9880d681SAndroid Build Coastguard Workerdefine arm_aapcs_vfpcc void @test_1double_nosplit([4 x float], [4 x double], [3 x float], double %a) {
70*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_1double_nosplit:
71*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: mov [[ONELO:r[0-9]+]], #0
72*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: movw [[ONEHI:r[0-9]+]], #0
73*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: movt [[ONEHI]], #16368
74*9880d681SAndroid Build Coastguard Worker; CHECK: strd [[ONELO]], [[ONEHI]], [sp]
75*9880d681SAndroid Build Coastguard Worker; CHECK: bl test_1double_nosplit
76*9880d681SAndroid Build Coastguard Worker
77*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-LABEL: test_1double_nosplit:
78*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: movs [[ONEHI:r[0-9]+]], #0
79*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: movs [[ONELO:r[0-9]+]], #0
80*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: movt [[ONEHI]], #16368
81*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: strd [[ONELO]], [[ONEHI]], [sp]
82*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: bl test_1double_nosplit
83*9880d681SAndroid Build Coastguard Worker  call arm_aapcs_vfpcc void @test_1double_nosplit([4 x float] undef, [4 x double] undef, [3 x float] undef, double 1.0)
84*9880d681SAndroid Build Coastguard Worker  ret void
85*9880d681SAndroid Build Coastguard Worker}
86*9880d681SAndroid Build Coastguard Worker
87*9880d681SAndroid Build Coastguard Worker; Final double argument might go at [sp, #4] if we're careless. Should go at
88*9880d681SAndroid Build Coastguard Worker; [sp, #8] to preserve alignment.
89*9880d681SAndroid Build Coastguard Workerdefine arm_aapcs_vfpcc void @test_1double_misaligned([4 x double], [4 x double], float, double) {
90*9880d681SAndroid Build Coastguard Worker  call arm_aapcs_vfpcc void @test_1double_misaligned([4 x double] undef, [4 x double] undef, float undef, double 1.0)
91*9880d681SAndroid Build Coastguard Worker
92*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_1double_misaligned:
93*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: movw [[ONEHI:r[0-9]+]], #0
94*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: mov [[ONELO:r[0-9]+]], #0
95*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: movt [[ONEHI]], #16368
96*9880d681SAndroid Build Coastguard Worker; CHECK-DAG: strd [[ONELO]], [[ONEHI]], [sp, #8]
97*9880d681SAndroid Build Coastguard Worker
98*9880d681SAndroid Build Coastguard Worker; CHECK-M4F-LABEL: test_1double_misaligned:
99*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: movs [[ONEHI:r[0-9]+]], #0
100*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: movs [[ONELO:r[0-9]+]], #0
101*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: movt [[ONEHI]], #16368
102*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: strd [[ONELO]], [[ONEHI]], [sp, #8]
103*9880d681SAndroid Build Coastguard Worker; CHECK-M4F: bl test_1double_misaligned
104*9880d681SAndroid Build Coastguard Worker
105*9880d681SAndroid Build Coastguard Worker  ret void
106*9880d681SAndroid Build Coastguard Worker}
107