1 ; RUN: llc -mtriple=aarch64-linux-gnu -mattr=+sve -stop-after=finalize-isel < %s | FileCheck %s --check-prefixes=CHECK,LINUX
2 ; RUN: llc -mtriple=aarch64-apple-darwin -mattr=+sve -stop-after=finalize-isel < %s | FileCheck %s --check-prefixes=CHECK,DARWIN
4 ; Test that z8 and z9, passed in by reference, are correctly loaded from x0 and x1.
10 define aarch64_sve_vector_pcs <vscale x 4 x i32> @callee_with_many_sve_arg(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3, <vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5, <vscale x 4 x i32> %z6, <vscale x 4 x i32> %z7, <vscale x 4 x i32> %z8, <vscale x 4 x i32> %z9) {
11 ; CHECK: name: callee_with_many_sve_arg
12 ; CHECK-DAG: [[BASE:%[0-9]+]]:gpr64common = COPY $x1
13 ; CHECK-DAG: [[PTRUE:%[0-9]+]]:ppr_3b = PTRUE_S 31
14 ; CHECK-DAG: [[RES:%[0-9]+]]:zpr = LD1W_IMM killed [[PTRUE]], [[BASE]]
15 ; CHECK-DAG: $z0 = COPY [[RES]]
16 ; CHECK: RET_ReallyLR implicit $z0
17 ret <vscale x 4 x i32> %z9
20 ; Test that z8 and z9 are passed by reference.
21 define aarch64_sve_vector_pcs <vscale x 4 x i32> @caller_with_many_sve_arg(<vscale x 4 x i32> %z) {
22 ; CHECK: name: caller_with_many_sve_arg
24 ; CHECK: - { id: 0, name: '', type: default, offset: 0, size: 16, alignment: 16,
25 ; CHECK-NEXT: stack-id: scalable-vector
26 ; CHECK: - { id: 1, name: '', type: default, offset: 0, size: 16, alignment: 16,
27 ; CHECK-NEXT: stack-id: scalable-vector
28 ; CHECK-DAG: [[PTRUE:%[0-9]+]]:ppr_3b = PTRUE_S 31
29 ; CHECK-DAG: ST1W_IMM %{{[0-9]+}}, [[PTRUE]], %stack.1, 0
30 ; CHECK-DAG: ST1W_IMM %{{[0-9]+}}, [[PTRUE]], %stack.0, 0
31 ; CHECK-DAG: [[BASE2:%[0-9]+]]:gpr64sp = ADDXri %stack.1, 0
32 ; CHECK-DAG: [[BASE1:%[0-9]+]]:gpr64sp = ADDXri %stack.0, 0
33 ; CHECK-DAG: $x0 = COPY [[BASE1]]
34 ; CHECK-DAG: $x1 = COPY [[BASE2]]
35 ; CHECK-NEXT: BL @callee_with_many_sve_arg
36 ; CHECK: RET_ReallyLR implicit $z0
37 %ret = call aarch64_sve_vector_pcs <vscale x 4 x i32> @callee_with_many_sve_arg(<vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z)
38 ret <vscale x 4 x i32> %ret
41 ; Test that p4 and p5, passed in by reference, are correctly loaded from register x0 and x1.
47 define aarch64_sve_vector_pcs <vscale x 16 x i1> @callee_with_many_svepred_arg(<vscale x 16 x i1> %p0, <vscale x 16 x i1> %p1, <vscale x 16 x i1> %p2, <vscale x 16 x i1> %p3, <vscale x 16 x i1> %p4, <vscale x 16 x i1> %p5) {
48 ; CHECK: name: callee_with_many_svepred_arg
49 ; CHECK-DAG: [[BASE:%[0-9]+]]:gpr64common = COPY $x1
50 ; CHECK-DAG: [[RES:%[0-9]+]]:ppr = LDR_PXI [[BASE]], 0
51 ; CHECK-DAG: $p0 = COPY [[RES]]
52 ; CHECK: RET_ReallyLR implicit $p0
53 ret <vscale x 16 x i1> %p5
56 ; Test that p4 and p5 are passed by reference.
57 define aarch64_sve_vector_pcs <vscale x 16 x i1> @caller_with_many_svepred_arg(<vscale x 16 x i1> %p) {
58 ; CHECK: name: caller_with_many_svepred_arg
60 ; CHECK: - { id: 0, name: '', type: default, offset: 0, size: 2, alignment: 2,
61 ; CHECK-NEXT: stack-id: scalable-vector
62 ; CHECK: - { id: 1, name: '', type: default, offset: 0, size: 2, alignment: 2,
63 ; CHECK-NEXT: stack-id: scalable-vector
64 ; CHECK-DAG: STR_PXI %{{[0-9]+}}, %stack.0, 0
65 ; CHECK-DAG: STR_PXI %{{[0-9]+}}, %stack.1, 0
66 ; CHECK-DAG: [[BASE1:%[0-9]+]]:gpr64sp = ADDXri %stack.0, 0
67 ; CHECK-DAG: [[BASE2:%[0-9]+]]:gpr64sp = ADDXri %stack.1, 0
68 ; CHECK-DAG: $x0 = COPY [[BASE1]]
69 ; CHECK-DAG: $x1 = COPY [[BASE2]]
70 ; CHECK-NEXT: BL @callee_with_many_svepred_arg
71 ; CHECK: RET_ReallyLR implicit $p0
72 %ret = call aarch64_sve_vector_pcs <vscale x 16 x i1> @callee_with_many_svepred_arg(<vscale x 16 x i1> %p, <vscale x 16 x i1> %p, <vscale x 16 x i1> %p, <vscale x 16 x i1> %p, <vscale x 16 x i1> %p, <vscale x 16 x i1> %p)
73 ret <vscale x 16 x i1> %ret
76 ; Test that arg2 is passed through x0, i.e., x0 = &%arg2; and return values are loaded from x0:
78 define aarch64_sve_vector_pcs <vscale x 16 x i1> @callee_with_svepred_arg_4xv16i1_1xv16i1([4 x <vscale x 16 x i1>] %arg1, [1 x <vscale x 16 x i1>] %arg2) {
79 ; CHECK: name: callee_with_svepred_arg_4xv16i1_1xv16i1
80 ; CHECK: [[BASE:%[0-9]+]]:gpr64common = COPY $x0
81 ; CHECK: [[PRED0:%[0-9]+]]:ppr = LDR_PXI [[BASE]], 0 :: (load (<vscale x 1 x s16>))
82 ; CHECK: $p0 = COPY [[PRED0]]
83 ; CHECK: RET_ReallyLR implicit $p0
84 %res = extractvalue [1 x <vscale x 16 x i1>] %arg2, 0
85 ret <vscale x 16 x i1> %res
88 ; Test that arg1 is stored to the stack from p0; and the stack location is passed throuch x0 to setup the call:
89 ; str P0, [stack_loc_for_args]
90 ; x0 = stack_loc_for_args
91 define aarch64_sve_vector_pcs <vscale x 16 x i1> @caller_with_svepred_arg_1xv16i1_4xv16i1([1 x <vscale x 16 x i1>] %arg1, [4 x <vscale x 16 x i1>] %arg2) {
92 ; CHECK: name: caller_with_svepred_arg_1xv16i1_4xv16i1
94 ; CHECK: - { id: 0, name: '', type: default, offset: 0, size: 2, alignment: 2,
95 ; CHECK-NEXT: stack-id: scalable-vector,
96 ; CHECK: [[PRED0:%[0-9]+]]:ppr = COPY $p0
97 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
98 ; CHECK: STR_PXI [[PRED0]], %stack.0, 0 :: (store (<vscale x 1 x s16>) into %stack.0)
99 ; CHECK: [[STACK:%[0-9]+]]:gpr64sp = ADDXri %stack.0, 0, 0
100 ; CHECK: $x0 = COPY [[STACK]]
101 ; LINUX: BL @callee_with_svepred_arg_4xv16i1_1xv16i1, csr_aarch64_sve_aapcs, implicit-def dead $lr, implicit $sp, implicit $p0, implicit $p1, implicit $p2, implicit $p3, implicit $x0, implicit-def $sp, implicit-def $p0
102 ; DARWIN: BL @callee_with_svepred_arg_4xv16i1_1xv16i1, csr_darwin_aarch64_sve_aapcs, implicit-def dead $lr, implicit $sp, implicit $p0, implicit $p1, implicit $p2, implicit $p3, implicit $x0, implicit-def $sp, implicit-def $p0
103 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
104 %res = call <vscale x 16 x i1> @callee_with_svepred_arg_4xv16i1_1xv16i1([4 x <vscale x 16 x i1>] %arg2, [1 x <vscale x 16 x i1>] %arg1)
105 ret <vscale x 16 x i1> %res
108 ; Test that arg2 is passed through x0, i.e., x0 = &%arg2; and return values are loaded from x0:
110 ; P1 = ldr [x0 + sizeof(Px)]
111 ; P2 = ldr [x0 + 2*sizeof(Px)]
112 ; P3 = ldr [x0 + 3*sizeof(Px)]
113 define aarch64_sve_vector_pcs [4 x <vscale x 16 x i1>] @callee_with_svepred_arg_4xv16i1_4xv16i1([4 x <vscale x 16 x i1>] %arg1, [4 x <vscale x 16 x i1>] %arg2) {
114 ; CHECK: name: callee_with_svepred_arg_4xv16i1_4xv16i1
115 ; CHECK: [[BASE:%[0-9]+]]:gpr64common = COPY $x0
116 ; CHECK: [[OFFSET1:%[0-9]+]]:gpr64 = CNTD_XPiI 31, 1, implicit $vg
117 ; CHECK: [[ADDR1:%[0-9]+]]:gpr64common = nuw ADDXrr [[BASE]], killed [[OFFSET1]]
118 ; CHECK: [[PRED1:%[0-9]+]]:ppr = LDR_PXI killed [[ADDR1]], 0 :: (load (<vscale x 1 x s16>))
119 ; CHECK: [[OFFSET2:%[0-9]+]]:gpr64 = CNTW_XPiI 31, 1, implicit $vg
120 ; CHECK: [[ADDR2:%[0-9]+]]:gpr64common = ADDXrr [[BASE]], killed [[OFFSET2]]
121 ; CHECK: [[PRED2:%[0-9]+]]:ppr = LDR_PXI killed [[ADDR2]], 0 :: (load (<vscale x 1 x s16>))
122 ; CHECK: [[OFFSET3:%[0-9]+]]:gpr64 = CNTD_XPiI 31, 3, implicit $vg
123 ; CHECK: [[ADDR3:%[0-9]+]]:gpr64common = ADDXrr [[BASE]], killed [[OFFSET3]]
124 ; CHECK: [[PRED3:%[0-9]+]]:ppr = LDR_PXI killed [[ADDR3]], 0 :: (load (<vscale x 1 x s16>))
125 ; CHECK: [[PRED0:%[0-9]+]]:ppr = LDR_PXI [[BASE]], 0 :: (load (<vscale x 1 x s16>))
126 ; CHECK: $p0 = COPY [[PRED0]]
127 ; CHECK: $p1 = COPY [[PRED1]]
128 ; CHECK: $p2 = COPY [[PRED2]]
129 ; CHECK: $p3 = COPY [[PRED3]]
130 ; CHECK: RET_ReallyLR implicit $p0, implicit $p1, implicit $p2, implicit $p3
131 ret [4 x <vscale x 16 x i1>] %arg2
134 ; Test that arg1 is stored to the stack from p0~p3; and the stack location is passed throuch x0 to setup the call:
135 ; str P0, [stack_loc_for_args]
136 ; str P1, [stack_loc_for_args + sizeof(Px)]
137 ; str P2, [stack_loc_for_args + 2*sizeof(Px)]
138 ; str P3, [stack_loc_for_args + 3*sizeof(Px)]
139 ; x0 = stack_loc_for_args
140 define [4 x <vscale x 16 x i1>] @caller_with_svepred_arg_4xv16i1_4xv16i1([4 x <vscale x 16 x i1>] %arg1, [4 x <vscale x 16 x i1>] %arg2) {
141 ; CHECK: name: caller_with_svepred_arg_4xv16i1_4xv16i1
143 ; CHECK: - { id: 0, name: '', type: default, offset: 0, size: 8, alignment: 2,
144 ; CHECK-NEXT: stack-id: scalable-vector,
145 ; CHECK: [[PRED3:%[0-9]+]]:ppr = COPY $p3
146 ; CHECK: [[PRED2:%[0-9]+]]:ppr = COPY $p2
147 ; CHECK: [[PRED1:%[0-9]+]]:ppr = COPY $p1
148 ; CHECK: [[PRED0:%[0-9]+]]:ppr = COPY $p0
149 ; CHECK: [[OFFSET1:%[0-9]+]]:gpr64 = CNTD_XPiI 31, 1, implicit $vg
150 ; CHECK: [[OFFSET2:%[0-9]+]]:gpr64 = CNTW_XPiI 31, 1, implicit $vg
151 ; CHECK: [[OFFSET3:%[0-9]+]]:gpr64 = CNTD_XPiI 31, 3, implicit $vg
152 ; CHECK: [[STACK:%[0-9]+]]:gpr64common = ADDXri %stack.0, 0, 0
153 ; CHECK: [[ADDR3:%[0-9]+]]:gpr64common = ADDXrr [[STACK]], [[OFFSET3]]
154 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
155 ; CHECK: STR_PXI [[PRED3]], killed [[ADDR3]], 0 :: (store (<vscale x 1 x s16>))
156 ; CHECK: [[ADDR2:%[0-9]+]]:gpr64common = ADDXrr [[STACK]], [[OFFSET2]]
157 ; CHECK: STR_PXI [[PRED2]], killed [[ADDR2]], 0 :: (store (<vscale x 1 x s16>))
158 ; CHECK: [[ADDR1:%[0-9]+]]:gpr64common = nuw ADDXrr [[STACK]], [[OFFSET1]]
159 ; CHECK: STR_PXI [[PRED1]], killed [[ADDR1]], 0 :: (store (<vscale x 1 x s16>))
160 ; CHECK: STR_PXI [[PRED0]], %stack.0, 0 :: (store (<vscale x 1 x s16>) into %stack.0)
161 ; CHECK: $x0 = COPY [[STACK]]
162 ; LINUX: BL @callee_with_svepred_arg_4xv16i1_4xv16i1, csr_aarch64_sve_aapcs, implicit-def dead $lr, implicit $sp, implicit $p0, implicit $p1, implicit $p2, implicit $p3, implicit $x0, implicit-def $sp, implicit-def $p0, implicit-def $p1, implicit-def $p2, implicit-def $p3
163 ; DARWIN: BL @callee_with_svepred_arg_4xv16i1_4xv16i1, csr_darwin_aarch64_sve_aapcs, implicit-def dead $lr, implicit $sp, implicit $p0, implicit $p1, implicit $p2, implicit $p3, implicit $x0, implicit-def $sp, implicit-def $p0, implicit-def $p1, implicit-def $p2, implicit-def $p3
164 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
165 %res = call [4 x <vscale x 16 x i1>] @callee_with_svepred_arg_4xv16i1_4xv16i1([4 x <vscale x 16 x i1>] %arg2, [4 x <vscale x 16 x i1>] %arg1)
166 ret [4 x <vscale x 16 x i1>] %res
169 ; Test that arg2 is passed through x0, i.e., x0 = &%arg2; and return values are loaded from x0:
171 ; P1 = ldr [x0 + sizeof(Px)]
172 ; P2 = ldr [x0 + 2*sizeof(Px)]
173 ; P3 = ldr [x0 + 3*sizeof(Px)]
174 define aarch64_sve_vector_pcs [2 x <vscale x 32 x i1>] @callee_with_svepred_arg_1xv16i1_2xv32i1([1 x <vscale x 16 x i1>] %arg1, [2 x <vscale x 32 x i1>] %arg2) {
175 ; CHECK: name: callee_with_svepred_arg_1xv16i1_2xv32i1
176 ; CHECK: [[BASE:%[0-9]+]]:gpr64common = COPY $x0
177 ; CHECK: [[OFFSET1:%[0-9]+]]:gpr64 = CNTD_XPiI 31, 1, implicit $vg
178 ; CHECK: [[ADDR1:%[0-9]+]]:gpr64common = nuw ADDXrr [[BASE]], killed [[OFFSET1]]
179 ; CHECK: [[PRED1:%[0-9]+]]:ppr = LDR_PXI killed [[ADDR1]], 0 :: (load (<vscale x 1 x s16>))
180 ; CHECK: [[OFFSET2:%[0-9]+]]:gpr64 = CNTW_XPiI 31, 1, implicit $vg
181 ; CHECK: [[ADDR2:%[0-9]+]]:gpr64common = ADDXrr [[BASE]], killed [[OFFSET2]]
182 ; CHECK: [[PRED2:%[0-9]+]]:ppr = LDR_PXI killed [[ADDR2]], 0 :: (load (<vscale x 1 x s16>))
183 ; CHECK: [[OFFSET3:%[0-9]+]]:gpr64 = CNTD_XPiI 31, 3, implicit $vg
184 ; CHECK: [[ADDR3:%[0-9]+]]:gpr64common = ADDXrr [[BASE]], killed [[OFFSET3]]
185 ; CHECK: [[PRED3:%[0-9]+]]:ppr = LDR_PXI killed [[ADDR3]], 0 :: (load (<vscale x 1 x s16>))
186 ; CHECK: [[PRED0:%[0-9]+]]:ppr = LDR_PXI [[BASE]], 0 :: (load (<vscale x 1 x s16>))
187 ; CHECK: $p0 = COPY [[PRED0]]
188 ; CHECK: $p1 = COPY [[PRED1]]
189 ; CHECK: $p2 = COPY [[PRED2]]
190 ; CHECK: $p3 = COPY [[PRED3]]
191 ; CHECK: RET_ReallyLR implicit $p0, implicit $p1, implicit $p2, implicit $p3
192 ret [2 x <vscale x 32 x i1>] %arg2
195 ; Test that arg1 is stored to the stack from p0~p3; and the stack location is passed throuch x0 to setup the call:
196 ; str P0, [stack_loc_for_args]
197 ; str P1, [stack_loc_for_args + sizeof(Px)]
198 ; str P2, [stack_loc_for_args + 2*sizeof(Px)]
199 ; str P3, [stack_loc_for_args + 3*sizeof(Px)]
200 ; x0 = stack_loc_for_args
201 define [2 x <vscale x 32 x i1>] @caller_with_svepred_arg_2xv32i1_1xv16i1([2 x <vscale x 32 x i1>] %arg1, [1 x <vscale x 16 x i1>] %arg2) {
202 ; CHECK: name: caller_with_svepred_arg_2xv32i1_1xv16i1
204 ; CHECK: - { id: 0, name: '', type: default, offset: 0, size: 8, alignment: 2,
205 ; CHECK-NEXT: stack-id: scalable-vector,
206 ; CHECK: [[PRED3:%[0-9]+]]:ppr = COPY $p3
207 ; CHECK: [[PRED2:%[0-9]+]]:ppr = COPY $p2
208 ; CHECK: [[PRED1:%[0-9]+]]:ppr = COPY $p1
209 ; CHECK: [[PRED0:%[0-9]+]]:ppr = COPY $p0
210 ; CHECK: [[OFFSET3:%[0-9]+]]:gpr64 = CNTD_XPiI 31, 3, implicit $vg
211 ; CHECK: [[STACK:%[0-9]+]]:gpr64common = ADDXri %stack.0, 0, 0
212 ; CHECK: [[ADDR3:%[0-9]+]]:gpr64common = ADDXrr [[STACK]], killed [[OFFSET3]]
213 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp
214 ; CHECK: STR_PXI [[PRED3]], killed [[ADDR3]], 0 :: (store (<vscale x 1 x s16>))
215 ; CHECK: [[OFFSET2:%[0-9]+]]:gpr64 = CNTW_XPiI 31, 1, implicit $vg
216 ; CHECK: [[ADDR2:%[0-9]+]]:gpr64common = ADDXrr [[STACK]], killed [[OFFSET2]]
217 ; CHECK: STR_PXI [[PRED2]], killed [[ADDR2]], 0 :: (store (<vscale x 1 x s16>))
218 ; CHECK: [[OFFSET1:%[0-9]+]]:gpr64 = CNTD_XPiI 31, 1, implicit $vg
219 ; CHECK: [[ADDR1:%[0-9]+]]:gpr64common = nuw ADDXrr [[STACK]], killed [[OFFSET1]]
220 ; CHECK: STR_PXI [[PRED1]], killed [[ADDR1]], 0 :: (store (<vscale x 1 x s16>))
221 ; CHECK: STR_PXI [[PRED0]], %stack.0, 0 :: (store (<vscale x 1 x s16>) into %stack.0)
222 ; CHECK: $x0 = COPY [[STACK]]
223 ; LINUX: BL @callee_with_svepred_arg_1xv16i1_2xv32i1, csr_aarch64_sve_aapcs, implicit-def dead $lr, implicit $sp, implicit $p0, implicit $x0, implicit-def $sp, implicit-def $p0, implicit-def $p1, implicit-def $p2, implicit-def $p3
224 ; DARWIN: BL @callee_with_svepred_arg_1xv16i1_2xv32i1, csr_darwin_aarch64_sve_aapcs, implicit-def dead $lr, implicit $sp, implicit $p0, implicit $x0, implicit-def $sp, implicit-def $p0, implicit-def $p1, implicit-def $p2, implicit-def $p3
225 ; CHECK: ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp
226 %res = call [2 x <vscale x 32 x i1>] @callee_with_svepred_arg_1xv16i1_2xv32i1([1 x <vscale x 16 x i1>] %arg2, [2 x <vscale x 32 x i1>] %arg1)
227 ret [2 x <vscale x 32 x i1>] %res
230 ; Test that arg1 and arg3 are passed via P0~P3, arg1 is passed indirectly through address on stack in x0
231 define aarch64_sve_vector_pcs [4 x <vscale x 16 x i1>] @callee_with_svepred_arg_2xv16i1_4xv16i1_2xv16i1([2 x <vscale x 16 x i1>] %arg1, [4 x <vscale x 16 x i1>] %arg2, [2 x <vscale x 16 x i1>] %arg3) nounwind {
232 ; CHECK: name: callee_with_svepred_arg_2xv16i1_4xv16i1_2xv16i1
233 ; CHECK: [[P3:%[0-9]+]]:ppr = COPY $p3
234 ; CHECK: [[P2:%[0-9]+]]:ppr = COPY $p2
235 ; CHECK: [[X0:%[0-9]+]]:gpr64common = COPY $x0
236 ; CHECK: [[P1:%[0-9]+]]:ppr = COPY $p1
237 ; CHECK: [[P0:%[0-9]+]]:ppr = COPY $p0
238 ; CHECK: [[OFFSET3:%[0-9]+]]:gpr64 = CNTD_XPiI 31, 3, implicit $vg
239 ; CHECK: [[ADDR3:%[0-9]+]]:gpr64common = ADDXrr [[X0]], killed [[OFFSET3]]
240 ; CHECK: [[P7:%[0-9]+]]:ppr = LDR_PXI killed [[ADDR3]], 0 :: (load (<vscale x 1 x s16>))
241 ; CHECK: [[OFFSET2:%[0-9]+]]:gpr64 = CNTW_XPiI 31, 1, implicit $vg
242 ; CHECK: [[ADDR2:%[0-9]+]]:gpr64common = ADDXrr [[X0]], killed [[OFFSET2]]
243 ; CHECK: [[P6:%[0-9]+]]:ppr = LDR_PXI killed [[ADDR2]], 0 :: (load (<vscale x 1 x s16>))
244 ; CHECK: [[OFFSET1:%[0-9]+]]:gpr64 = CNTD_XPiI 31, 1, implicit $vg
245 ; CHECK: [[ADDR1:%[0-9]+]]:gpr64common = nuw ADDXrr [[X0]], killed [[OFFSET1]]
246 ; CHECK: [[P5:%[0-9]+]]:ppr = LDR_PXI killed [[ADDR1]], 0 :: (load (<vscale x 1 x s16>))
247 ; CHECK: [[P4:%[0-9]+]]:ppr = LDR_PXI [[X0]], 0 :: (load (<vscale x 1 x s16>))
248 ; CHECK: [[RES0:%[0-9]+]]:ppr = AND_PPzPP [[P0]], [[P0]], killed [[P4]]
249 ; CHECK: [[RES1:%[0-9]+]]:ppr = AND_PPzPP [[P1]], [[P1]], killed [[P5]]
250 ; CHECK: [[RES2:%[0-9]+]]:ppr = AND_PPzPP [[P2]], [[P2]], killed [[P6]]
251 ; CHECK: [[RES3:%[0-9]+]]:ppr = AND_PPzPP [[P3]], [[P3]], killed [[P7]]
252 ; CHECK: $p0 = COPY [[RES0]]
253 ; CHECK: $p1 = COPY [[RES1]]
254 ; CHECK: $p2 = COPY [[RES2]]
255 ; CHECK: $p3 = COPY [[RES3]]
256 ; CHECK: RET_ReallyLR implicit $p0, implicit $p1, implicit $p2, implicit $p3
257 %p0 = extractvalue [2 x <vscale x 16 x i1>] %arg1, 0
258 %p1 = extractvalue [2 x <vscale x 16 x i1>] %arg1, 1
259 %p2 = extractvalue [2 x <vscale x 16 x i1>] %arg3, 0
260 %p3 = extractvalue [2 x <vscale x 16 x i1>] %arg3, 1
261 %p4 = extractvalue [4 x <vscale x 16 x i1>] %arg2, 0
262 %p5 = extractvalue [4 x <vscale x 16 x i1>] %arg2, 1
263 %p6 = extractvalue [4 x <vscale x 16 x i1>] %arg2, 2
264 %p7 = extractvalue [4 x <vscale x 16 x i1>] %arg2, 3
265 %r0 = and <vscale x 16 x i1> %p0, %p4
266 %r1 = and <vscale x 16 x i1> %p1, %p5
267 %r2 = and <vscale x 16 x i1> %p2, %p6
268 %r3 = and <vscale x 16 x i1> %p3, %p7
269 %1 = insertvalue [4 x <vscale x 16 x i1>] undef, <vscale x 16 x i1> %r0, 0
270 %2 = insertvalue [4 x <vscale x 16 x i1>] %1, <vscale x 16 x i1> %r1, 1
271 %3 = insertvalue [4 x <vscale x 16 x i1>] %2, <vscale x 16 x i1> %r2, 2
272 %4 = insertvalue [4 x <vscale x 16 x i1>] %3, <vscale x 16 x i1> %r3, 3
273 ret [4 x <vscale x 16 x i1>] %4
276 ; Test that z8 and z9, passed by reference, are loaded from a location that is passed on the stack.
286 define aarch64_sve_vector_pcs <vscale x 4 x i32> @callee_with_many_gpr_sve_arg(i64 %x0, i64 %x1, i64 %x2, i64 %x3, i64 %x4, i64 %x5, i64 %x6, i64 %x7, <vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, <vscale x 4 x i32> %z2, <vscale x 4 x i32> %z3, <vscale x 4 x i32> %z4, <vscale x 4 x i32> %z5, <vscale x 4 x i32> %z6, <vscale x 4 x i32> %z7, <vscale x 2 x i64> %z8, <vscale x 4 x i32> %z9) {
287 ; CHECK: name: callee_with_many_gpr_sve_arg
289 ; CHECK: - { id: 0, type: default, offset: 8, size: 8, alignment: 8, stack-id: default,
290 ; CHECK-DAG: [[BASE:%[0-9]+]]:gpr64common = LDRXui %fixed-stack.0, 0
291 ; CHECK-DAG: [[PTRUE:%[0-9]+]]:ppr_3b = PTRUE_S 31
292 ; CHECK-DAG: [[RES:%[0-9]+]]:zpr = LD1W_IMM killed [[PTRUE]], killed [[BASE]]
293 ; CHECK-DAG: $z0 = COPY [[RES]]
294 ; CHECK: RET_ReallyLR implicit $z0
295 ret <vscale x 4 x i32> %z9
298 ; Test that z8 and z9 are passed by reference, where reference is passed on the stack.
299 define aarch64_sve_vector_pcs <vscale x 4 x i32> @caller_with_many_gpr_sve_arg(i64 %x, <vscale x 4 x i32> %z, <vscale x 2 x i64> %z2) {
300 ; CHECK: name: caller_with_many_gpr_sve_arg
302 ; CHECK: - { id: 0, name: '', type: default, offset: 0, size: 16, alignment: 16,
303 ; CHECK-NEXT: stack-id: scalable-vector
304 ; CHECK: - { id: 1, name: '', type: default, offset: 0, size: 16, alignment: 16,
305 ; CHECK-NEXT: stack-id: scalable-vector
306 ; CHECK-DAG: [[PTRUE_S:%[0-9]+]]:ppr_3b = PTRUE_S 31
307 ; CHECK-DAG: [[PTRUE_D:%[0-9]+]]:ppr_3b = PTRUE_D 31
308 ; CHECK-DAG: ST1D_IMM %{{[0-9]+}}, killed [[PTRUE_D]], %stack.0, 0
309 ; CHECK-DAG: ST1W_IMM %{{[0-9]+}}, killed [[PTRUE_S]], %stack.1, 0
310 ; CHECK-DAG: [[BASE1:%[0-9]+]]:gpr64common = ADDXri %stack.0, 0
311 ; CHECK-DAG: [[BASE2:%[0-9]+]]:gpr64common = ADDXri %stack.1, 0
312 ; CHECK-DAG: [[SP:%[0-9]+]]:gpr64sp = COPY $sp
313 ; CHECK-DAG: STRXui killed [[BASE1]], [[SP]], 0
314 ; CHECK-DAG: STRXui killed [[BASE2]], [[SP]], 1
315 ; CHECK: BL @callee_with_many_gpr_sve_arg
316 ; CHECK: RET_ReallyLR implicit $z0
317 %ret = call aarch64_sve_vector_pcs <vscale x 4 x i32> @callee_with_many_gpr_sve_arg(i64 %x, i64 %x, i64 %x, i64 %x, i64 %x, i64 %x, i64 %x, i64 %x, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 4 x i32> %z, <vscale x 2 x i64> %z2, <vscale x 4 x i32> %z)
318 ret <vscale x 4 x i32> %ret