1 ; RUN: llc -O0 -mtriple arm-unknown -mattr=+vfp2,+v4t -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=ARM -check-prefix=LITTLE
2 ; RUN: llc -O0 -mtriple armeb-unknown -mattr=+vfp2,+v4t -global-isel -global-isel-abort=0 -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=ARM -check-prefix=BIG
4 ; RUN: llc -O0 -mtriple thumb-unknown -mattr=+vfp2,+v6t2 -global-isel -stop-after=irtranslator -verify-machineinstrs %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=LITTLE -check-prefix=THUMB
6 declare arm_aapcscc i32* @simple_reg_params_target(i32, i32*)
8 define arm_aapcscc i32* @test_call_simple_reg_params(i32 *%a, i32 %b) {
9 ; CHECK-LABEL: name: test_call_simple_reg_params
10 ; CHECK-DAG: [[AVREG:%[0-9]+]]:_(p0) = COPY $r0
11 ; CHECK-DAG: [[BVREG:%[0-9]+]]:_(s32) = COPY $r1
12 ; CHECK: ADJCALLSTACKDOWN 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
13 ; CHECK-DAG: $r0 = COPY [[BVREG]]
14 ; CHECK-DAG: $r1 = COPY [[AVREG]]
15 ; ARM: BL @simple_reg_params_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit-def $r0
16 ; THUMB: tBL 14, $noreg, @simple_reg_params_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit-def $r0
17 ; CHECK: [[RVREG:%[0-9]+]]:_(p0) = COPY $r0
18 ; CHECK: ADJCALLSTACKUP 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
19 ; CHECK: $r0 = COPY [[RVREG]]
20 ; ARM: BX_RET 14, $noreg, implicit $r0
21 ; THUMB: tBX_RET 14, $noreg, implicit $r0
23 %r = notail call arm_aapcscc i32 *@simple_reg_params_target(i32 %b, i32 *%a)
27 declare arm_aapcscc i32* @simple_stack_params_target(i32, i32*, i32, i32*, i32, i32*)
29 define arm_aapcscc i32* @test_call_simple_stack_params(i32 *%a, i32 %b) {
30 ; CHECK-LABEL: name: test_call_simple_stack_params
31 ; CHECK-DAG: [[AVREG:%[0-9]+]]:_(p0) = COPY $r0
32 ; CHECK-DAG: [[BVREG:%[0-9]+]]:_(s32) = COPY $r1
33 ; CHECK: ADJCALLSTACKDOWN 8, 0, 14, $noreg, implicit-def $sp, implicit $sp
34 ; CHECK-DAG: $r0 = COPY [[BVREG]]
35 ; CHECK-DAG: $r1 = COPY [[AVREG]]
36 ; CHECK-DAG: $r2 = COPY [[BVREG]]
37 ; CHECK-DAG: $r3 = COPY [[AVREG]]
38 ; CHECK: [[SP1:%[0-9]+]]:_(p0) = COPY $sp
39 ; CHECK: [[OFF1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
40 ; CHECK: [[FI1:%[0-9]+]]:_(p0) = G_GEP [[SP1]], [[OFF1]](s32)
41 ; CHECK: G_STORE [[BVREG]](s32), [[FI1]](p0){{.*}}store 4
42 ; CHECK: [[SP2:%[0-9]+]]:_(p0) = COPY $sp
43 ; CHECK: [[OFF2:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
44 ; CHECK: [[FI2:%[0-9]+]]:_(p0) = G_GEP [[SP2]], [[OFF2]](s32)
45 ; CHECK: G_STORE [[AVREG]](p0), [[FI2]](p0){{.*}}store 4
46 ; ARM: BL @simple_stack_params_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0
47 ; THUMB: tBL 14, $noreg, @simple_stack_params_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0
48 ; CHECK: [[RVREG:%[0-9]+]]:_(p0) = COPY $r0
49 ; CHECK: ADJCALLSTACKUP 8, 0, 14, $noreg, implicit-def $sp, implicit $sp
50 ; CHECK: $r0 = COPY [[RVREG]]
51 ; ARM: BX_RET 14, $noreg, implicit $r0
52 ; THUMB: tBX_RET 14, $noreg, implicit $r0
54 %r = notail call arm_aapcscc i32 *@simple_stack_params_target(i32 %b, i32 *%a, i32 %b, i32 *%a, i32 %b, i32 *%a)
58 declare arm_aapcscc signext i16 @ext_target(i8 signext, i8 zeroext, i16 signext, i16 zeroext, i8 signext, i8 zeroext, i16 signext, i16 zeroext, i1 zeroext)
60 define arm_aapcscc signext i16 @test_call_ext_params(i8 %a, i16 %b, i1 %c) {
61 ; CHECK-LABEL: name: test_call_ext_params
62 ; CHECK-DAG: [[R0VREG:%[0-9]+]]:_(s32) = COPY $r0
63 ; CHECK-DAG: [[AVREG:%[0-9]+]]:_(s8) = G_TRUNC [[R0VREG]]
64 ; CHECK-DAG: [[R1VREG:%[0-9]+]]:_(s32) = COPY $r1
65 ; CHECK-DAG: [[BVREG:%[0-9]+]]:_(s16) = G_TRUNC [[R1VREG]]
66 ; CHECK-DAG: [[R2VREG:%[0-9]+]]:_(s32) = COPY $r2
67 ; CHECK-DAG: [[CVREG:%[0-9]+]]:_(s1) = G_TRUNC [[R2VREG]]
68 ; CHECK: ADJCALLSTACKDOWN 20, 0, 14, $noreg, implicit-def $sp, implicit $sp
69 ; CHECK: [[SEXTA:%[0-9]+]]:_(s32) = G_SEXT [[AVREG]](s8)
70 ; CHECK: $r0 = COPY [[SEXTA]]
71 ; CHECK: [[ZEXTA:%[0-9]+]]:_(s32) = G_ZEXT [[AVREG]](s8)
72 ; CHECK: $r1 = COPY [[ZEXTA]]
73 ; CHECK: [[SEXTB:%[0-9]+]]:_(s32) = G_SEXT [[BVREG]](s16)
74 ; CHECK: $r2 = COPY [[SEXTB]]
75 ; CHECK: [[ZEXTB:%[0-9]+]]:_(s32) = G_ZEXT [[BVREG]](s16)
76 ; CHECK: $r3 = COPY [[ZEXTB]]
77 ; CHECK: [[SP1:%[0-9]+]]:_(p0) = COPY $sp
78 ; CHECK: [[OFF1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
79 ; CHECK: [[FI1:%[0-9]+]]:_(p0) = G_GEP [[SP1]], [[OFF1]](s32)
80 ; CHECK: [[SEXTA2:%[0-9]+]]:_(s32) = G_SEXT [[AVREG]]
81 ; CHECK: G_STORE [[SEXTA2]](s32), [[FI1]](p0){{.*}}store 4
82 ; CHECK: [[SP2:%[0-9]+]]:_(p0) = COPY $sp
83 ; CHECK: [[OFF2:%[0-9]+]]:_(s32) = G_CONSTANT i32 4
84 ; CHECK: [[FI2:%[0-9]+]]:_(p0) = G_GEP [[SP2]], [[OFF2]](s32)
85 ; CHECK: [[ZEXTA2:%[0-9]+]]:_(s32) = G_ZEXT [[AVREG]]
86 ; CHECK: G_STORE [[ZEXTA2]](s32), [[FI2]](p0){{.*}}store 4
87 ; CHECK: [[SP3:%[0-9]+]]:_(p0) = COPY $sp
88 ; CHECK: [[OFF3:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
89 ; CHECK: [[FI3:%[0-9]+]]:_(p0) = G_GEP [[SP3]], [[OFF3]](s32)
90 ; CHECK: [[SEXTB2:%[0-9]+]]:_(s32) = G_SEXT [[BVREG]]
91 ; CHECK: G_STORE [[SEXTB2]](s32), [[FI3]](p0){{.*}}store 4
92 ; CHECK: [[SP4:%[0-9]+]]:_(p0) = COPY $sp
93 ; CHECK: [[OFF4:%[0-9]+]]:_(s32) = G_CONSTANT i32 12
94 ; CHECK: [[FI4:%[0-9]+]]:_(p0) = G_GEP [[SP4]], [[OFF4]](s32)
95 ; CHECK: [[ZEXTB2:%[0-9]+]]:_(s32) = G_ZEXT [[BVREG]]
96 ; CHECK: G_STORE [[ZEXTB2]](s32), [[FI4]](p0){{.*}}store 4
97 ; CHECK: [[SP5:%[0-9]+]]:_(p0) = COPY $sp
98 ; CHECK: [[OFF5:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
99 ; CHECK: [[FI5:%[0-9]+]]:_(p0) = G_GEP [[SP5]], [[OFF5]](s32)
100 ; CHECK: [[ZEXTC:%[0-9]+]]:_(s32) = G_ZEXT [[CVREG]]
101 ; CHECK: G_STORE [[ZEXTC]](s32), [[FI5]](p0){{.*}}store 4
102 ; ARM: BL @ext_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0
103 ; THUMB: tBL 14, $noreg, @ext_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0
104 ; CHECK: [[R0VREG:%[0-9]+]]:_(s32) = COPY $r0
105 ; CHECK: [[RVREG:%[0-9]+]]:_(s16) = G_TRUNC [[R0VREG]]
106 ; CHECK: ADJCALLSTACKUP 20, 0, 14, $noreg, implicit-def $sp, implicit $sp
107 ; CHECK: [[RExtVREG:%[0-9]+]]:_(s32) = G_SEXT [[RVREG]]
108 ; CHECK: $r0 = COPY [[RExtVREG]]
109 ; ARM: BX_RET 14, $noreg, implicit $r0
110 ; THUMB: tBX_RET 14, $noreg, implicit $r0
112 %r = notail call arm_aapcscc signext i16 @ext_target(i8 signext %a, i8 zeroext %a, i16 signext %b, i16 zeroext %b, i8 signext %a, i8 zeroext %a, i16 signext %b, i16 zeroext %b, i1 zeroext %c)
116 declare arm_aapcs_vfpcc double @vfpcc_fp_target(float, double)
118 define arm_aapcs_vfpcc double @test_call_vfpcc_fp_params(double %a, float %b) {
119 ; CHECK-LABEL: name: test_call_vfpcc_fp_params
120 ; CHECK-DAG: [[AVREG:%[0-9]+]]:_(s64) = COPY $d0
121 ; CHECK-DAG: [[BVREG:%[0-9]+]]:_(s32) = COPY $s2
122 ; CHECK: ADJCALLSTACKDOWN 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
123 ; CHECK-DAG: $s0 = COPY [[BVREG]]
124 ; CHECK-DAG: $d1 = COPY [[AVREG]]
125 ; ARM: BL @vfpcc_fp_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $d1, implicit-def $d0
126 ; THUMB: tBL 14, $noreg, @vfpcc_fp_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $s0, implicit $d1, implicit-def $d0
127 ; CHECK: [[RVREG:%[0-9]+]]:_(s64) = COPY $d0
128 ; CHECK: ADJCALLSTACKUP 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
129 ; CHECK: $d0 = COPY [[RVREG]]
130 ; ARM: BX_RET 14, $noreg, implicit $d0
131 ; THUMB: tBX_RET 14, $noreg, implicit $d0
133 %r = notail call arm_aapcs_vfpcc double @vfpcc_fp_target(float %b, double %a)
137 declare arm_aapcscc double @aapcscc_fp_target(float, double, float, double)
139 define arm_aapcscc double @test_call_aapcs_fp_params(double %a, float %b) {
140 ; CHECK-LABEL: name: test_call_aapcs_fp_params
141 ; CHECK-DAG: [[A1:%[0-9]+]]:_(s32) = COPY $r0
142 ; CHECK-DAG: [[A2:%[0-9]+]]:_(s32) = COPY $r1
143 ; LITTLE-DAG: [[AVREG:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[A1]](s32), [[A2]](s32)
144 ; BIG-DAG: [[AVREG:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[A2]](s32), [[A1]](s32)
145 ; CHECK-DAG: [[BVREG:%[0-9]+]]:_(s32) = COPY $r2
146 ; CHECK: ADJCALLSTACKDOWN 16, 0, 14, $noreg, implicit-def $sp, implicit $sp
147 ; CHECK-DAG: $r0 = COPY [[BVREG]]
148 ; CHECK-DAG: [[A1:%[0-9]+]]:_(s32), [[A2:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[AVREG]](s64)
149 ; LITTLE-DAG: $r2 = COPY [[A1]]
150 ; LITTLE-DAG: $r3 = COPY [[A2]]
151 ; BIG-DAG: $r2 = COPY [[A2]]
152 ; BIG-DAG: $r3 = COPY [[A1]]
153 ; CHECK: [[SP1:%[0-9]+]]:_(p0) = COPY $sp
154 ; CHECK: [[OFF1:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
155 ; CHECK: [[FI1:%[0-9]+]]:_(p0) = G_GEP [[SP1]], [[OFF1]](s32)
156 ; CHECK: G_STORE [[BVREG]](s32), [[FI1]](p0){{.*}}store 4
157 ; CHECK: [[SP2:%[0-9]+]]:_(p0) = COPY $sp
158 ; CHECK: [[OFF2:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
159 ; CHECK: [[FI2:%[0-9]+]]:_(p0) = G_GEP [[SP2]], [[OFF2]](s32)
160 ; CHECK: G_STORE [[AVREG]](s64), [[FI2]](p0){{.*}}store 8
161 ; ARM: BL @aapcscc_fp_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r2, implicit $r3, implicit-def $r0, implicit-def $r1
162 ; THUMB: tBL 14, $noreg, @aapcscc_fp_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r2, implicit $r3, implicit-def $r0, implicit-def $r1
163 ; CHECK-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r0
164 ; CHECK-DAG: [[R2:%[0-9]+]]:_(s32) = COPY $r1
165 ; LITTLE: [[RVREG:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[R1]](s32), [[R2]](s32)
166 ; BIG: [[RVREG:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[R2]](s32), [[R1]](s32)
167 ; CHECK: ADJCALLSTACKUP 16, 0, 14, $noreg, implicit-def $sp, implicit $sp
168 ; CHECK: [[R1:%[0-9]+]]:_(s32), [[R2:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[RVREG]](s64)
169 ; LITTLE-DAG: $r0 = COPY [[R1]]
170 ; LITTLE-DAG: $r1 = COPY [[R2]]
171 ; BIG-DAG: $r0 = COPY [[R2]]
172 ; BIG-DAG: $r1 = COPY [[R1]]
173 ; ARM: BX_RET 14, $noreg, implicit $r0, implicit $r1
174 ; THUMB: tBX_RET 14, $noreg, implicit $r0, implicit $r1
176 %r = notail call arm_aapcscc double @aapcscc_fp_target(float %b, double %a, float %b, double %a)
180 declare arm_aapcscc float @different_call_conv_target(float)
182 define arm_aapcs_vfpcc float @test_call_different_call_conv(float %x) {
183 ; CHECK-LABEL: name: test_call_different_call_conv
184 ; CHECK: [[X:%[0-9]+]]:_(s32) = COPY $s0
185 ; CHECK: ADJCALLSTACKDOWN 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
186 ; CHECK: $r0 = COPY [[X]]
187 ; ARM: BL @different_call_conv_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit-def $r0
188 ; THUMB: tBL 14, $noreg, @different_call_conv_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit-def $r0
189 ; CHECK: [[R:%[0-9]+]]:_(s32) = COPY $r0
190 ; CHECK: ADJCALLSTACKUP 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
191 ; CHECK: $s0 = COPY [[R]]
192 ; ARM: BX_RET 14, $noreg, implicit $s0
193 ; THUMB: tBX_RET 14, $noreg, implicit $s0
195 %r = notail call arm_aapcscc float @different_call_conv_target(float %x)
199 declare arm_aapcscc [3 x i32] @tiny_int_arrays_target([2 x i32])
201 define arm_aapcscc [3 x i32] @test_tiny_int_arrays([2 x i32] %arr) {
202 ; CHECK-LABEL: name: test_tiny_int_arrays
203 ; CHECK: liveins: $r0, $r1
204 ; CHECK: [[R0:%[0-9]+]]:_(s32) = COPY $r0
205 ; CHECK: [[R1:%[0-9]+]]:_(s32) = COPY $r1
206 ; CHECK: [[ARG_ARR:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[R0]](s32), [[R1]](s32)
207 ; CHECK: [[EXT1:%[0-9]+]]:_(s32) = G_EXTRACT [[ARG_ARR]](s64), 0
208 ; CHECK: [[EXT2:%[0-9]+]]:_(s32) = G_EXTRACT [[ARG_ARR]](s64), 32
209 ; CHECK: [[IMPDEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
210 ; CHECK: [[INS1:%[0-9]+]]:_(s64) = G_INSERT [[IMPDEF]], [[EXT1]](s32), 0
211 ; CHECK: [[INS2:%[0-9]+]]:_(s64) = G_INSERT [[INS1]], [[EXT2]](s32), 32
212 ; CHECK: ADJCALLSTACKDOWN 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
213 ; CHECK: [[R0:%[0-9]+]]:_(s32), [[R1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[INS2]](s64)
214 ; CHECK: $r0 = COPY [[R0]]
215 ; CHECK: $r1 = COPY [[R1]]
216 ; ARM: BL @tiny_int_arrays_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit-def $r0, implicit-def $r1
217 ; THUMB: tBL 14, $noreg, @tiny_int_arrays_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit-def $r0, implicit-def $r1
218 ; CHECK: [[R0:%[0-9]+]]:_(s32) = COPY $r0
219 ; CHECK: [[R1:%[0-9]+]]:_(s32) = COPY $r1
220 ; CHECK: [[R2:%[0-9]+]]:_(s32) = COPY $r2
221 ; CHECK: [[RES_ARR:%[0-9]+]]:_(s96) = G_MERGE_VALUES [[R0]](s32), [[R1]](s32), [[R2]](s32)
222 ; CHECK: ADJCALLSTACKUP 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
223 ; CHECK: [[EXT3:%[0-9]+]]:_(s32) = G_EXTRACT [[RES_ARR]](s96), 0
224 ; CHECK: [[EXT4:%[0-9]+]]:_(s32) = G_EXTRACT [[RES_ARR]](s96), 32
225 ; CHECK: [[EXT5:%[0-9]+]]:_(s32) = G_EXTRACT [[RES_ARR]](s96), 64
226 ; FIXME: This doesn't seem correct with regard to the AAPCS docs (which say
227 ; that composite types larger than 4 bytes should be passed through memory),
228 ; but it's what DAGISel does. We should fix it in the common code for both.
229 ; CHECK: $r0 = COPY [[EXT3]]
230 ; CHECK: $r1 = COPY [[EXT4]]
231 ; CHECK: $r2 = COPY [[EXT5]]
232 ; ARM: BX_RET 14, $noreg, implicit $r0, implicit $r1, implicit $r2
233 ; THUMB: tBX_RET 14, $noreg, implicit $r0, implicit $r1, implicit $r2
235 %r = notail call arm_aapcscc [3 x i32] @tiny_int_arrays_target([2 x i32] %arr)
239 declare arm_aapcscc void @multiple_int_arrays_target([2 x i32], [2 x i32])
241 define arm_aapcscc void @test_multiple_int_arrays([2 x i32] %arr0, [2 x i32] %arr1) {
242 ; CHECK-LABEL: name: test_multiple_int_arrays
243 ; CHECK: liveins: $r0, $r1
244 ; CHECK: [[R0:%[0-9]+]]:_(s32) = COPY $r0
245 ; CHECK: [[R1:%[0-9]+]]:_(s32) = COPY $r1
246 ; CHECK: [[R2:%[0-9]+]]:_(s32) = COPY $r2
247 ; CHECK: [[R3:%[0-9]+]]:_(s32) = COPY $r3
248 ; CHECK: [[ARG_ARR0:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[R0]](s32), [[R1]](s32)
249 ; CHECK: [[ARG_ARR1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[R2]](s32), [[R3]](s32)
250 ; CHECK: [[EXT1:%[0-9]+]]:_(s32) = G_EXTRACT [[ARG_ARR0]](s64), 0
251 ; CHECK: [[EXT2:%[0-9]+]]:_(s32) = G_EXTRACT [[ARG_ARR0]](s64), 32
252 ; CHECK: [[EXT3:%[0-9]+]]:_(s32) = G_EXTRACT [[ARG_ARR1]](s64), 0
253 ; CHECK: [[EXT4:%[0-9]+]]:_(s32) = G_EXTRACT [[ARG_ARR1]](s64), 32
254 ; CHECK: [[IMPDEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
255 ; CHECK: [[INS1:%[0-9]+]]:_(s64) = G_INSERT [[IMPDEF]], [[EXT1]](s32), 0
256 ; CHECK: [[INS2:%[0-9]+]]:_(s64) = G_INSERT [[INS1]], [[EXT2]](s32), 32
257 ; CHECK: [[IMPDEF2:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
258 ; CHECK: [[INS3:%[0-9]+]]:_(s64) = G_INSERT [[IMPDEF2]], [[EXT3]](s32), 0
259 ; CHECK: [[INS4:%[0-9]+]]:_(s64) = G_INSERT [[INS3]], [[EXT4]](s32), 32
260 ; CHECK: ADJCALLSTACKDOWN 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
261 ; CHECK: [[R0:%[0-9]+]]:_(s32), [[R1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[INS2]](s64)
262 ; CHECK: [[R2:%[0-9]+]]:_(s32), [[R3:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[INS4]](s64)
263 ; CHECK: $r0 = COPY [[R0]]
264 ; CHECK: $r1 = COPY [[R1]]
265 ; CHECK: $r2 = COPY [[R2]]
266 ; CHECK: $r3 = COPY [[R3]]
267 ; ARM: BL @multiple_int_arrays_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3
268 ; THUMB: tBL 14, $noreg, @multiple_int_arrays_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3
269 ; CHECK: ADJCALLSTACKUP 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
270 ; ARM: BX_RET 14, $noreg
271 ; THUMB: tBX_RET 14, $noreg
273 notail call arm_aapcscc void @multiple_int_arrays_target([2 x i32] %arr0, [2 x i32] %arr1)
277 declare arm_aapcscc void @large_int_arrays_target([20 x i32])
279 define arm_aapcscc void @test_large_int_arrays([20 x i32] %arr) {
280 ; CHECK-LABEL: name: test_large_int_arrays
282 ; The parameters live in separate stack locations, one for each element that
283 ; doesn't fit in the registers.
284 ; CHECK-DAG: id: [[FIRST_STACK_ID:[0-9]+]], type: default, offset: 0, size: 4,
285 ; CHECK-DAG: id: [[LAST_STACK_ID:[-0]+]], type: default, offset: 60, size: 4
286 ; CHECK: liveins: $r0, $r1, $r2, $r3
287 ; CHECK-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0
288 ; CHECK-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1
289 ; CHECK-DAG: [[R2:%[0-9]+]]:_(s32) = COPY $r2
290 ; CHECK-DAG: [[R3:%[0-9]+]]:_(s32) = COPY $r3
291 ; CHECK: [[FIRST_STACK_ELEMENT_FI:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.[[FIRST_STACK_ID]]
292 ; CHECK: [[FIRST_STACK_ELEMENT:%[0-9]+]]:_(s32) = G_LOAD [[FIRST_STACK_ELEMENT_FI]]{{.*}}load 4 from %fixed-stack.[[FIRST_STACK_ID]]
293 ; CHECK: [[LAST_STACK_ELEMENT_FI:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.[[LAST_STACK_ID]]
294 ; CHECK: [[LAST_STACK_ELEMENT:%[0-9]+]]:_(s32) = G_LOAD [[LAST_STACK_ELEMENT_FI]]{{.*}}load 4 from %fixed-stack.[[LAST_STACK_ID]]
295 ; CHECK: [[ARG_ARR:%[0-9]+]]:_(s640) = G_MERGE_VALUES [[R0]](s32), [[R1]](s32), [[R2]](s32), [[R3]](s32), [[FIRST_STACK_ELEMENT]](s32), {{.*}}, [[LAST_STACK_ELEMENT]](s32)
296 ; CHECK: [[INS:%[0-9]+]]:_(s640) = G_INSERT {{.*}}, {{.*}}(s32), 608
297 ; CHECK: ADJCALLSTACKDOWN 64, 0, 14, $noreg, implicit-def $sp, implicit $sp
298 ; CHECK: [[R0:%[0-9]+]]:_(s32), [[R1:%[0-9]+]]:_(s32), [[R2:%[0-9]+]]:_(s32), [[R3:%[0-9]+]]:_(s32), [[FIRST_STACK_ELEMENT:%[0-9]+]]:_(s32), {{.*}}, [[LAST_STACK_ELEMENT:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[INS]](s640)
299 ; CHECK: $r0 = COPY [[R0]]
300 ; CHECK: $r1 = COPY [[R1]]
301 ; CHECK: $r2 = COPY [[R2]]
302 ; CHECK: $r3 = COPY [[R3]]
303 ; CHECK: [[SP:%[0-9]+]]:_(p0) = COPY $sp
304 ; CHECK: [[OFF_FIRST_ELEMENT:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
305 ; CHECK: [[FIRST_STACK_ARG_ADDR:%[0-9]+]]:_(p0) = G_GEP [[SP]], [[OFF_FIRST_ELEMENT]](s32)
306 ; CHECK: G_STORE [[FIRST_STACK_ELEMENT]](s32), [[FIRST_STACK_ARG_ADDR]]{{.*}}store 4
307 ; Match the second-to-last offset, so we can get the correct SP for the last element
308 ; CHECK: G_CONSTANT i32 56
309 ; CHECK: [[SP:%[0-9]+]]:_(p0) = COPY $sp
310 ; CHECK: [[OFF_LAST_ELEMENT:%[0-9]+]]:_(s32) = G_CONSTANT i32 60
311 ; CHECK: [[LAST_STACK_ARG_ADDR:%[0-9]+]]:_(p0) = G_GEP [[SP]], [[OFF_LAST_ELEMENT]](s32)
312 ; CHECK: G_STORE [[LAST_STACK_ELEMENT]](s32), [[LAST_STACK_ARG_ADDR]]{{.*}}store 4
313 ; ARM: BL @large_int_arrays_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3
314 ; THUMB: tBL 14, $noreg, @large_int_arrays_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3
315 ; CHECK: ADJCALLSTACKUP 64, 0, 14, $noreg, implicit-def $sp, implicit $sp
316 ; ARM: BX_RET 14, $noreg
317 ; THUMB: tBX_RET 14, $noreg
319 notail call arm_aapcscc void @large_int_arrays_target([20 x i32] %arr)
323 declare arm_aapcscc [2 x float] @fp_arrays_aapcs_target([3 x double])
325 define arm_aapcscc [2 x float] @test_fp_arrays_aapcs([3 x double] %arr) {
326 ; CHECK-LABEL: name: test_fp_arrays_aapcs
328 ; CHECK: id: [[ARR2_ID:[0-9]+]], type: default, offset: 0, size: 8,
329 ; CHECK: liveins: $r0, $r1, $r2, $r3
330 ; CHECK: [[ARR0_0:%[0-9]+]]:_(s32) = COPY $r0
331 ; CHECK: [[ARR0_1:%[0-9]+]]:_(s32) = COPY $r1
332 ; LITTLE: [[ARR0:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[ARR0_0]](s32), [[ARR0_1]](s32)
333 ; BIG: [[ARR0:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[ARR0_1]](s32), [[ARR0_0]](s32)
334 ; CHECK: [[ARR1_0:%[0-9]+]]:_(s32) = COPY $r2
335 ; CHECK: [[ARR1_1:%[0-9]+]]:_(s32) = COPY $r3
336 ; LITTLE: [[ARR1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[ARR1_0]](s32), [[ARR1_1]](s32)
337 ; BIG: [[ARR1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[ARR1_1]](s32), [[ARR1_0]](s32)
338 ; CHECK: [[ARR2_FI:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.[[ARR2_ID]]
339 ; CHECK: [[ARR2:%[0-9]+]]:_(s64) = G_LOAD [[ARR2_FI]]{{.*}}load 8 from %fixed-stack.[[ARR2_ID]]
340 ; CHECK: [[ARR_MERGED:%[0-9]+]]:_(s192) = G_MERGE_VALUES [[ARR0]](s64), [[ARR1]](s64), [[ARR2]](s64)
341 ; CHECK: [[EXT1:%[0-9]+]]:_(s64) = G_EXTRACT [[ARR_MERGED]](s192), 0
342 ; CHECK: [[EXT2:%[0-9]+]]:_(s64) = G_EXTRACT [[ARR_MERGED]](s192), 64
343 ; CHECK: [[EXT3:%[0-9]+]]:_(s64) = G_EXTRACT [[ARR_MERGED]](s192), 128
344 ; CHECK: [[IMPDEF:%[0-9]+]]:_(s192) = G_IMPLICIT_DEF
345 ; CHECK: [[INS1:%[0-9]+]]:_(s192) = G_INSERT [[IMPDEF]], [[EXT1]](s64), 0
346 ; CHECK: [[INS2:%[0-9]+]]:_(s192) = G_INSERT [[INS1]], [[EXT2]](s64), 64
347 ; CHECK: [[INS3:%[0-9]+]]:_(s192) = G_INSERT [[INS2]], [[EXT3]](s64), 128
348 ; CHECK: ADJCALLSTACKDOWN 8, 0, 14, $noreg, implicit-def $sp, implicit $sp
349 ; CHECK: [[ARR0:%[0-9]+]]:_(s64), [[ARR1:%[0-9]+]]:_(s64), [[ARR2:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[INS3]](s192)
350 ; CHECK: [[ARR0_0:%[0-9]+]]:_(s32), [[ARR0_1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[ARR0]](s64)
351 ; LITTLE: $r0 = COPY [[ARR0_0]](s32)
352 ; LITTLE: $r1 = COPY [[ARR0_1]](s32)
353 ; BIG: $r0 = COPY [[ARR0_1]](s32)
354 ; BIG: $r1 = COPY [[ARR0_0]](s32)
355 ; CHECK: [[ARR1_0:%[0-9]+]]:_(s32), [[ARR1_1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[ARR1]](s64)
356 ; LITTLE: $r2 = COPY [[ARR1_0]](s32)
357 ; LITTLE: $r3 = COPY [[ARR1_1]](s32)
358 ; BIG: $r2 = COPY [[ARR1_1]](s32)
359 ; BIG: $r3 = COPY [[ARR1_0]](s32)
360 ; CHECK: [[SP:%[0-9]+]]:_(p0) = COPY $sp
361 ; CHECK: [[ARR2_OFFSET:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
362 ; CHECK: [[ARR2_ADDR:%[0-9]+]]:_(p0) = G_GEP [[SP]], [[ARR2_OFFSET]](s32)
363 ; CHECK: G_STORE [[ARR2]](s64), [[ARR2_ADDR]](p0){{.*}}store 8
364 ; ARM: BL @fp_arrays_aapcs_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0, implicit-def $r1
365 ; THUMB: tBL 14, $noreg, @fp_arrays_aapcs_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0, implicit-def $r1
366 ; CHECK: [[R0:%[0-9]+]]:_(s32) = COPY $r0
367 ; CHECK: [[R1:%[0-9]+]]:_(s32) = COPY $r1
368 ; CHECK: [[R_MERGED:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[R0]](s32), [[R1]](s32)
369 ; CHECK: ADJCALLSTACKUP 8, 0, 14, $noreg, implicit-def $sp, implicit $sp
370 ; CHECK: [[EXT4:%[0-9]+]]:_(s32) = G_EXTRACT [[R_MERGED]](s64), 0
371 ; CHECK: [[EXT5:%[0-9]+]]:_(s32) = G_EXTRACT [[R_MERGED]](s64), 32
372 ; CHECK: $r0 = COPY [[EXT4]]
373 ; CHECK: $r1 = COPY [[EXT5]]
374 ; ARM: BX_RET 14, $noreg, implicit $r0, implicit $r1
375 ; THUMB: tBX_RET 14, $noreg, implicit $r0, implicit $r1
377 %r = notail call arm_aapcscc [2 x float] @fp_arrays_aapcs_target([3 x double] %arr)
381 declare arm_aapcs_vfpcc [4 x float] @fp_arrays_aapcs_vfp_target([3 x double], [3 x float], [4 x double])
383 define arm_aapcs_vfpcc [4 x float] @test_fp_arrays_aapcs_vfp([3 x double] %x, [3 x float] %y, [4 x double] %z) {
384 ; CHECK-LABEL: name: test_fp_arrays_aapcs_vfp
386 ; CHECK-DAG: id: [[Z0_ID:[0-9]+]], type: default, offset: 0, size: 8,
387 ; CHECK-DAG: id: [[Z1_ID:[0-9]+]], type: default, offset: 8, size: 8,
388 ; CHECK-DAG: id: [[Z2_ID:[0-9]+]], type: default, offset: 16, size: 8,
389 ; CHECK-DAG: id: [[Z3_ID:[0-9]+]], type: default, offset: 24, size: 8,
390 ; CHECK: liveins: $d0, $d1, $d2, $s6, $s7, $s8
391 ; CHECK: [[X0:%[0-9]+]]:_(s64) = COPY $d0
392 ; CHECK: [[X1:%[0-9]+]]:_(s64) = COPY $d1
393 ; CHECK: [[X2:%[0-9]+]]:_(s64) = COPY $d2
394 ; CHECK: [[Y0:%[0-9]+]]:_(s32) = COPY $s6
395 ; CHECK: [[Y1:%[0-9]+]]:_(s32) = COPY $s7
396 ; CHECK: [[Y2:%[0-9]+]]:_(s32) = COPY $s8
397 ; CHECK: [[Z0_FI:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.[[Z0_ID]]
398 ; CHECK: [[Z0:%[0-9]+]]:_(s64) = G_LOAD [[Z0_FI]]{{.*}}load 8
399 ; CHECK: [[Z1_FI:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.[[Z1_ID]]
400 ; CHECK: [[Z1:%[0-9]+]]:_(s64) = G_LOAD [[Z1_FI]]{{.*}}load 8
401 ; CHECK: [[Z2_FI:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.[[Z2_ID]]
402 ; CHECK: [[Z2:%[0-9]+]]:_(s64) = G_LOAD [[Z2_FI]]{{.*}}load 8
403 ; CHECK: [[Z3_FI:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.[[Z3_ID]]
404 ; CHECK: [[Z3:%[0-9]+]]:_(s64) = G_LOAD [[Z3_FI]]{{.*}}load 8
405 ; CHECK: [[X_ARR:%[0-9]+]]:_(s192) = G_MERGE_VALUES [[X0]](s64), [[X1]](s64), [[X2]](s64)
406 ; CHECK: [[Y_ARR:%[0-9]+]]:_(s96) = G_MERGE_VALUES [[Y0]](s32), [[Y1]](s32), [[Y2]](s32)
407 ; CHECK: [[Z_ARR:%[0-9]+]]:_(s256) = G_MERGE_VALUES [[Z0]](s64), [[Z1]](s64), [[Z2]](s64), [[Z3]](s64)
408 ; CHECK: [[EXT1:%[0-9]+]]:_(s64) = G_EXTRACT [[X_ARR]](s192), 0
409 ; CHECK: [[EXT2:%[0-9]+]]:_(s64) = G_EXTRACT [[X_ARR]](s192), 64
410 ; CHECK: [[EXT3:%[0-9]+]]:_(s64) = G_EXTRACT [[X_ARR]](s192), 128
411 ; CHECK: [[EXT4:%[0-9]+]]:_(s32) = G_EXTRACT [[Y_ARR]](s96), 0
412 ; CHECK: [[EXT5:%[0-9]+]]:_(s32) = G_EXTRACT [[Y_ARR]](s96), 32
413 ; CHECK: [[EXT6:%[0-9]+]]:_(s32) = G_EXTRACT [[Y_ARR]](s96), 64
414 ; CHECK: [[EXT7:%[0-9]+]]:_(s64) = G_EXTRACT [[Z_ARR]](s256), 0
415 ; CHECK: [[EXT8:%[0-9]+]]:_(s64) = G_EXTRACT [[Z_ARR]](s256), 64
416 ; CHECK: [[EXT9:%[0-9]+]]:_(s64) = G_EXTRACT [[Z_ARR]](s256), 128
417 ; CHECK: [[EXT10:%[0-9]+]]:_(s64) = G_EXTRACT [[Z_ARR]](s256), 192
418 ; CHECK: [[IMPDEF:%[0-9]+]]:_(s192) = G_IMPLICIT_DEF
419 ; CHECK: [[INS1:%[0-9]+]]:_(s192) = G_INSERT [[IMPDEF]], [[EXT1]](s64), 0
420 ; CHECK: [[INS2:%[0-9]+]]:_(s192) = G_INSERT [[INS1]], [[EXT2]](s64), 64
421 ; CHECK: [[INS3:%[0-9]+]]:_(s192) = G_INSERT [[INS2]], [[EXT3]](s64), 128
422 ; CHECK: [[IMPDEF2:%[0-9]+]]:_(s96) = G_IMPLICIT_DEF
423 ; CHECK: [[INS4:%[0-9]+]]:_(s96) = G_INSERT [[IMPDEF2]], [[EXT4]](s32), 0
424 ; CHECK: [[INS5:%[0-9]+]]:_(s96) = G_INSERT [[INS4]], [[EXT5]](s32), 32
425 ; CHECK: [[INS6:%[0-9]+]]:_(s96) = G_INSERT [[INS5]], [[EXT6]](s32), 64
426 ; CHECK: [[IMPDEF3:%[0-9]+]]:_(s256) = G_IMPLICIT_DEF
427 ; CHECK: [[INS7:%[0-9]+]]:_(s256) = G_INSERT [[IMPDEF3]], [[EXT7]](s64), 0
428 ; CHECK: [[INS8:%[0-9]+]]:_(s256) = G_INSERT [[INS7]], [[EXT8]](s64), 64
429 ; CHECK: [[INS9:%[0-9]+]]:_(s256) = G_INSERT [[INS8]], [[EXT9]](s64), 128
430 ; CHECK: [[INS10:%[0-9]+]]:_(s256) = G_INSERT [[INS9]], [[EXT10]](s64), 192
431 ; CHECK: ADJCALLSTACKDOWN 32, 0, 14, $noreg, implicit-def $sp, implicit $sp
432 ; CHECK: [[X0:%[0-9]+]]:_(s64), [[X1:%[0-9]+]]:_(s64), [[X2:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[INS3]](s192)
433 ; CHECK: [[Y0:%[0-9]+]]:_(s32), [[Y1:%[0-9]+]]:_(s32), [[Y2:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[INS6]](s96)
434 ; CHECK: [[Z0:%[0-9]+]]:_(s64), [[Z1:%[0-9]+]]:_(s64), [[Z2:%[0-9]+]]:_(s64), [[Z3:%[0-9]+]]:_(s64) = G_UNMERGE_VALUES [[INS10]](s256)
435 ; CHECK: $d0 = COPY [[X0]](s64)
436 ; CHECK: $d1 = COPY [[X1]](s64)
437 ; CHECK: $d2 = COPY [[X2]](s64)
438 ; CHECK: $s6 = COPY [[Y0]](s32)
439 ; CHECK: $s7 = COPY [[Y1]](s32)
440 ; CHECK: $s8 = COPY [[Y2]](s32)
441 ; CHECK: [[SP:%[0-9]+]]:_(p0) = COPY $sp
442 ; CHECK: [[Z0_OFFSET:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
443 ; CHECK: [[Z0_ADDR:%[0-9]+]]:_(p0) = G_GEP [[SP]], [[Z0_OFFSET]](s32)
444 ; CHECK: G_STORE [[Z0]](s64), [[Z0_ADDR]](p0){{.*}}store 8
445 ; CHECK: [[SP:%[0-9]+]]:_(p0) = COPY $sp
446 ; CHECK: [[Z1_OFFSET:%[0-9]+]]:_(s32) = G_CONSTANT i32 8
447 ; CHECK: [[Z1_ADDR:%[0-9]+]]:_(p0) = G_GEP [[SP]], [[Z1_OFFSET]](s32)
448 ; CHECK: G_STORE [[Z1]](s64), [[Z1_ADDR]](p0){{.*}}store 8
449 ; CHECK: [[SP:%[0-9]+]]:_(p0) = COPY $sp
450 ; CHECK: [[Z2_OFFSET:%[0-9]+]]:_(s32) = G_CONSTANT i32 16
451 ; CHECK: [[Z2_ADDR:%[0-9]+]]:_(p0) = G_GEP [[SP]], [[Z2_OFFSET]](s32)
452 ; CHECK: G_STORE [[Z2]](s64), [[Z2_ADDR]](p0){{.*}}store 8
453 ; CHECK: [[SP:%[0-9]+]]:_(p0) = COPY $sp
454 ; CHECK: [[Z3_OFFSET:%[0-9]+]]:_(s32) = G_CONSTANT i32 24
455 ; CHECK: [[Z3_ADDR:%[0-9]+]]:_(p0) = G_GEP [[SP]], [[Z3_OFFSET]](s32)
456 ; CHECK: G_STORE [[Z3]](s64), [[Z3_ADDR]](p0){{.*}}store 8
457 ; ARM: BL @fp_arrays_aapcs_vfp_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit $d2, implicit $s6, implicit $s7, implicit $s8, implicit-def $s0, implicit-def $s1, implicit-def $s2, implicit-def $s3
458 ; THUMB: tBL 14, $noreg, @fp_arrays_aapcs_vfp_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $d0, implicit $d1, implicit $d2, implicit $s6, implicit $s7, implicit $s8, implicit-def $s0, implicit-def $s1, implicit-def $s2, implicit-def $s3
459 ; CHECK: [[R0:%[0-9]+]]:_(s32) = COPY $s0
460 ; CHECK: [[R1:%[0-9]+]]:_(s32) = COPY $s1
461 ; CHECK: [[R2:%[0-9]+]]:_(s32) = COPY $s2
462 ; CHECK: [[R3:%[0-9]+]]:_(s32) = COPY $s3
463 ; CHECK: [[R_MERGED:%[0-9]+]]:_(s128) = G_MERGE_VALUES [[R0]](s32), [[R1]](s32), [[R2]](s32), [[R3]](s32)
464 ; CHECK: ADJCALLSTACKUP 32, 0, 14, $noreg, implicit-def $sp, implicit $sp
465 ; CHECK: [[EXT11:%[0-9]+]]:_(s32) = G_EXTRACT [[R_MERGED]](s128), 0
466 ; CHECK: [[EXT12:%[0-9]+]]:_(s32) = G_EXTRACT [[R_MERGED]](s128), 32
467 ; CHECK: [[EXT13:%[0-9]+]]:_(s32) = G_EXTRACT [[R_MERGED]](s128), 64
468 ; CHECK: [[EXT14:%[0-9]+]]:_(s32) = G_EXTRACT [[R_MERGED]](s128), 96
469 ; CHECK: $s0 = COPY [[EXT11]]
470 ; CHECK: $s1 = COPY [[EXT12]]
471 ; CHECK: $s2 = COPY [[EXT13]]
472 ; CHECK: $s3 = COPY [[EXT14]]
473 ; ARM: BX_RET 14, $noreg, implicit $s0, implicit $s1, implicit $s2, implicit $s3
474 ; THUMB: tBX_RET 14, $noreg, implicit $s0, implicit $s1, implicit $s2, implicit $s3
476 %r = notail call arm_aapcs_vfpcc [4 x float] @fp_arrays_aapcs_vfp_target([3 x double] %x, [3 x float] %y, [4 x double] %z)
480 declare arm_aapcscc [2 x i32*] @tough_arrays_target([6 x [4 x i32]] %arr)
482 define arm_aapcscc [2 x i32*] @test_tough_arrays([6 x [4 x i32]] %arr) {
483 ; CHECK-LABEL: name: test_tough_arrays
485 ; The parameters live in separate stack locations, one for each element that
486 ; doesn't fit in the registers.
487 ; CHECK-DAG: id: [[FIRST_STACK_ID:[0-9]+]], type: default, offset: 0, size: 4,
488 ; CHECK-DAG: id: [[LAST_STACK_ID:[-0]+]], type: default, offset: 76, size: 4
489 ; CHECK: liveins: $r0, $r1, $r2, $r3
490 ; CHECK-DAG: [[R0:%[0-9]+]]:_(s32) = COPY $r0
491 ; CHECK-DAG: [[R1:%[0-9]+]]:_(s32) = COPY $r1
492 ; CHECK-DAG: [[R2:%[0-9]+]]:_(s32) = COPY $r2
493 ; CHECK-DAG: [[R3:%[0-9]+]]:_(s32) = COPY $r3
494 ; CHECK: [[FIRST_STACK_ELEMENT_FI:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.[[FIRST_STACK_ID]]
495 ; CHECK: [[FIRST_STACK_ELEMENT:%[0-9]+]]:_(s32) = G_LOAD [[FIRST_STACK_ELEMENT_FI]]{{.*}}load 4 from %fixed-stack.[[FIRST_STACK_ID]]
496 ; CHECK: [[LAST_STACK_ELEMENT_FI:%[0-9]+]]:_(p0) = G_FRAME_INDEX %fixed-stack.[[LAST_STACK_ID]]
497 ; CHECK: [[LAST_STACK_ELEMENT:%[0-9]+]]:_(s32) = G_LOAD [[LAST_STACK_ELEMENT_FI]]{{.*}}load 4 from %fixed-stack.[[LAST_STACK_ID]]
498 ; CHECK: [[ARG_ARR:%[0-9]+]]:_(s768) = G_MERGE_VALUES [[R0]](s32), [[R1]](s32), [[R2]](s32), [[R3]](s32), [[FIRST_STACK_ELEMENT]](s32), {{.*}}, [[LAST_STACK_ELEMENT]](s32)
499 ; CHECK: [[INS:%[0-9]+]]:_(s768) = G_INSERT {{.*}}, {{.*}}(s32), 736
500 ; CHECK: ADJCALLSTACKDOWN 80, 0, 14, $noreg, implicit-def $sp, implicit $sp
501 ; CHECK: [[R0:%[0-9]+]]:_(s32), [[R1:%[0-9]+]]:_(s32), [[R2:%[0-9]+]]:_(s32), [[R3:%[0-9]+]]:_(s32), [[FIRST_STACK_ELEMENT:%[0-9]+]]:_(s32), {{.*}}, [[LAST_STACK_ELEMENT:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[INS]](s768)
502 ; CHECK: $r0 = COPY [[R0]]
503 ; CHECK: $r1 = COPY [[R1]]
504 ; CHECK: $r2 = COPY [[R2]]
505 ; CHECK: $r3 = COPY [[R3]]
506 ; CHECK: [[SP:%[0-9]+]]:_(p0) = COPY $sp
507 ; CHECK: [[OFF_FIRST_ELEMENT:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
508 ; CHECK: [[FIRST_STACK_ARG_ADDR:%[0-9]+]]:_(p0) = G_GEP [[SP]], [[OFF_FIRST_ELEMENT]](s32)
509 ; CHECK: G_STORE [[FIRST_STACK_ELEMENT]](s32), [[FIRST_STACK_ARG_ADDR]]{{.*}}store 4
510 ; Match the second-to-last offset, so we can get the correct SP for the last element
511 ; CHECK: G_CONSTANT i32 72
512 ; CHECK: [[SP:%[0-9]+]]:_(p0) = COPY $sp
513 ; CHECK: [[OFF_LAST_ELEMENT:%[0-9]+]]:_(s32) = G_CONSTANT i32 76
514 ; CHECK: [[LAST_STACK_ARG_ADDR:%[0-9]+]]:_(p0) = G_GEP [[SP]], [[OFF_LAST_ELEMENT]](s32)
515 ; CHECK: G_STORE [[LAST_STACK_ELEMENT]](s32), [[LAST_STACK_ARG_ADDR]]{{.*}}store 4
516 ; ARM: BL @tough_arrays_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0, implicit-def $r1
517 ; THUMB: tBL 14, $noreg, @tough_arrays_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit $r2, implicit $r3, implicit-def $r0, implicit-def $r1
518 ; CHECK: [[R0:%[0-9]+]]:_(s32) = COPY $r0
519 ; CHECK: [[R1:%[0-9]+]]:_(s32) = COPY $r1
520 ; CHECK: [[RES_ARR:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[R0]](s32), [[R1]](s32)
521 ; CHECK: ADJCALLSTACKUP 80, 0, 14, $noreg, implicit-def $sp, implicit $sp
522 ; CHECK: [[EXT1:%[0-9]+]]:_(p0) = G_EXTRACT [[RES_ARR]](s64), 0
523 ; CHECK: [[EXT2:%[0-9]+]]:_(p0) = G_EXTRACT [[RES_ARR]](s64), 32
524 ; CHECK: $r0 = COPY [[EXT1]]
525 ; CHECK: $r1 = COPY [[EXT2]]
526 ; ARM: BX_RET 14, $noreg, implicit $r0, implicit $r1
527 ; THUMB: tBX_RET 14, $noreg, implicit $r0, implicit $r1
529 %r = notail call arm_aapcscc [2 x i32*] @tough_arrays_target([6 x [4 x i32]] %arr)
533 declare arm_aapcscc {i32, i32} @structs_target({i32, i32})
535 define arm_aapcscc {i32, i32} @test_structs({i32, i32} %x) {
536 ; CHECK-LABEL: test_structs
537 ; CHECK: liveins: $r0, $r1
538 ; CHECK-DAG: [[X0:%[0-9]+]]:_(s32) = COPY $r0
539 ; CHECK-DAG: [[X1:%[0-9]+]]:_(s32) = COPY $r1
540 ; CHECK: [[X:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[X0]](s32), [[X1]](s32)
541 ; CHECK: [[EXT1:%[0-9]+]]:_(s32) = G_EXTRACT [[X]](s64), 0
542 ; CHECK: [[EXT2:%[0-9]+]]:_(s32) = G_EXTRACT [[X]](s64), 32
543 ; CHECK: [[IMPDEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
544 ; CHECK: [[INS1:%[0-9]+]]:_(s64) = G_INSERT [[IMPDEF]], [[EXT1]](s32), 0
545 ; CHECK: [[INS2:%[0-9]+]]:_(s64) = G_INSERT [[INS1]], [[EXT2]](s32), 32
546 ; CHECK: ADJCALLSTACKDOWN 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
547 ; CHECK: [[X0:%[0-9]+]]:_(s32), [[X1:%[0-9]+]]:_(s32) = G_UNMERGE_VALUES [[INS2]](s64)
548 ; CHECK-DAG: $r0 = COPY [[X0]](s32)
549 ; CHECK-DAG: $r1 = COPY [[X1]](s32)
550 ; ARM: BL @structs_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit-def $r0, implicit-def $r1
551 ; THUMB: tBL 14, $noreg, @structs_target, csr_aapcs, implicit-def $lr, implicit $sp, implicit $r0, implicit $r1, implicit-def $r0, implicit-def $r1
552 ; CHECK: [[R0:%[0-9]+]]:_(s32) = COPY $r0
553 ; CHECK: [[R1:%[0-9]+]]:_(s32) = COPY $r1
554 ; CHECK: [[R:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[R0]](s32), [[R1]](s32)
555 ; CHECK: ADJCALLSTACKUP 0, 0, 14, $noreg, implicit-def $sp, implicit $sp
556 ; CHECK: [[EXT3:%[0-9]+]]:_(s32) = G_EXTRACT [[R]](s64), 0
557 ; CHECK: [[EXT4:%[0-9]+]]:_(s32) = G_EXTRACT [[R]](s64), 32
558 ; CHECK: $r0 = COPY [[EXT3]](s32)
559 ; CHECK: $r1 = COPY [[EXT4]](s32)
560 ; ARM: BX_RET 14, $noreg, implicit $r0, implicit $r1
561 ; THUMB: tBX_RET 14, $noreg, implicit $r0, implicit $r1
562 %r = notail call arm_aapcscc {i32, i32} @structs_target({i32, i32} %x)