1 ; RUN: llc -march=mips -mattr=+msa,+fp64,+mips32r5 < %s | FileCheck %s
2 ; RUN: llc -march=mipsel -mattr=+msa,+fp64,+mips32r5 < %s | FileCheck %s
4 define void @loadstore_v16i8_near() nounwind {
5 ; CHECK: loadstore_v16i8_near:
8 %2 = load volatile <16 x i8>, <16 x i8>* %1
9 ; CHECK: ld.b [[R1:\$w[0-9]+]], 0($sp)
10 store volatile <16 x i8> %2, <16 x i8>* %1
11 ; CHECK: st.b [[R1]], 0($sp)
14 ; CHECK: .size loadstore_v16i8_near
17 define void @loadstore_v16i8_just_under_simm10() nounwind {
18 ; CHECK: loadstore_v16i8_just_under_simm10:
21 %2 = alloca [492 x i8] ; Push the frame--acounting for the emergency spill
22 ; slot--right up to 512 bytes
24 %3 = load volatile <16 x i8>, <16 x i8>* %1
25 ; CHECK: ld.b [[R1:\$w[0-9]+]], 496($sp)
26 store volatile <16 x i8> %3, <16 x i8>* %1
27 ; CHECK: st.b [[R1]], 496($sp)
30 ; CHECK: .size loadstore_v16i8_just_under_simm10
33 define void @loadstore_v16i8_just_over_simm10() nounwind {
34 ; CHECK: loadstore_v16i8_just_over_simm10:
37 %2 = alloca [497 x i8] ; Push the frame--acounting for the emergency spill
38 ; slot--right up to 512 bytes
40 %3 = load volatile <16 x i8>, <16 x i8>* %1
41 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 512
42 ; CHECK: ld.b [[R1:\$w[0-9]+]], 0([[BASE]])
43 store volatile <16 x i8> %3, <16 x i8>* %1
44 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 512
45 ; CHECK: st.b [[R1]], 0([[BASE]])
48 ; CHECK: .size loadstore_v16i8_just_over_simm10
51 define void @loadstore_v16i8_just_under_simm16() nounwind {
52 ; CHECK: loadstore_v16i8_just_under_simm16:
55 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
56 ; slot--right up to 32768 bytes
58 %3 = load volatile <16 x i8>, <16 x i8>* %1
59 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
60 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
61 ; CHECK: ld.b [[R1:\$w[0-9]+]], 0([[BASE]])
62 store volatile <16 x i8> %3, <16 x i8>* %1
63 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
64 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
65 ; CHECK: st.b [[R1]], 0([[BASE]])
68 ; CHECK: .size loadstore_v16i8_just_under_simm16
71 define void @loadstore_v16i8_just_over_simm16() nounwind {
72 ; CHECK: loadstore_v16i8_just_over_simm16:
75 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
76 ; slot--just over 32768 bytes
78 %3 = load volatile <16 x i8>, <16 x i8>* %1
79 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
80 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
81 ; CHECK: ld.b [[R1:\$w[0-9]+]], 0([[BASE]])
82 store volatile <16 x i8> %3, <16 x i8>* %1
83 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
84 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
85 ; CHECK: st.b [[R1]], 0([[BASE]])
88 ; CHECK: .size loadstore_v16i8_just_over_simm16
91 define void @loadstore_v8i16_near() nounwind {
92 ; CHECK: loadstore_v8i16_near:
95 %2 = load volatile <8 x i16>, <8 x i16>* %1
96 ; CHECK: ld.h [[R1:\$w[0-9]+]], 0($sp)
97 store volatile <8 x i16> %2, <8 x i16>* %1
98 ; CHECK: st.h [[R1]], 0($sp)
101 ; CHECK: .size loadstore_v8i16_near
104 define void @loadstore_v8i16_unaligned() nounwind {
105 ; CHECK: loadstore_v8i16_unaligned:
107 %1 = alloca [2 x <8 x i16>]
108 %2 = bitcast [2 x <8 x i16>]* %1 to i8*
109 %3 = getelementptr i8, i8* %2, i32 1
110 %4 = bitcast i8* %3 to [2 x <8 x i16>]*
111 %5 = getelementptr [2 x <8 x i16>], [2 x <8 x i16>]* %4, i32 0, i32 0
113 %6 = load volatile <8 x i16>, <8 x i16>* %5
114 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
115 ; CHECK: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
116 store volatile <8 x i16> %6, <8 x i16>* %5
117 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
118 ; CHECK: st.h [[R1]], 0([[BASE]])
121 ; CHECK: .size loadstore_v8i16_unaligned
124 define void @loadstore_v8i16_just_under_simm10() nounwind {
125 ; CHECK: loadstore_v8i16_just_under_simm10:
127 %1 = alloca <8 x i16>
128 %2 = alloca [1004 x i8] ; Push the frame--acounting for the emergency spill
129 ; slot--right up to 1024 bytes
131 %3 = load volatile <8 x i16>, <8 x i16>* %1
132 ; CHECK: ld.h [[R1:\$w[0-9]+]], 1008($sp)
133 store volatile <8 x i16> %3, <8 x i16>* %1
134 ; CHECK: st.h [[R1]], 1008($sp)
137 ; CHECK: .size loadstore_v8i16_just_under_simm10
140 define void @loadstore_v8i16_just_over_simm10() nounwind {
141 ; CHECK: loadstore_v8i16_just_over_simm10:
143 %1 = alloca <8 x i16>
144 %2 = alloca [1009 x i8] ; Push the frame--acounting for the emergency spill
145 ; slot--just over 1024 bytes
147 %3 = load volatile <8 x i16>, <8 x i16>* %1
148 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1024
149 ; CHECK: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
150 store volatile <8 x i16> %3, <8 x i16>* %1
151 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1024
152 ; CHECK: st.h [[R1]], 0([[BASE]])
155 ; CHECK: .size loadstore_v8i16_just_over_simm10
158 define void @loadstore_v8i16_just_under_simm16() nounwind {
159 ; CHECK: loadstore_v8i16_just_under_simm16:
161 %1 = alloca <8 x i16>
162 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
163 ; slot--right up to 32768 bytes
165 %3 = load volatile <8 x i16>, <8 x i16>* %1
166 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
167 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
168 ; CHECK: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
169 store volatile <8 x i16> %3, <8 x i16>* %1
170 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
171 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
172 ; CHECK: st.h [[R1]], 0([[BASE]])
175 ; CHECK: .size loadstore_v8i16_just_under_simm16
178 define void @loadstore_v8i16_just_over_simm16() nounwind {
179 ; CHECK: loadstore_v8i16_just_over_simm16:
181 %1 = alloca <8 x i16>
182 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
183 ; slot--just over 32768 bytes
185 %3 = load volatile <8 x i16>, <8 x i16>* %1
186 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
187 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
188 ; CHECK: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
189 store volatile <8 x i16> %3, <8 x i16>* %1
190 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
191 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
192 ; CHECK: st.h [[R1]], 0([[BASE]])
195 ; CHECK: .size loadstore_v8i16_just_over_simm16
198 define void @loadstore_v4i32_near() nounwind {
199 ; CHECK: loadstore_v4i32_near:
201 %1 = alloca <4 x i32>
202 %2 = load volatile <4 x i32>, <4 x i32>* %1
203 ; CHECK: ld.w [[R1:\$w[0-9]+]], 0($sp)
204 store volatile <4 x i32> %2, <4 x i32>* %1
205 ; CHECK: st.w [[R1]], 0($sp)
208 ; CHECK: .size loadstore_v4i32_near
211 define void @loadstore_v4i32_unaligned() nounwind {
212 ; CHECK: loadstore_v4i32_unaligned:
214 %1 = alloca [2 x <4 x i32>]
215 %2 = bitcast [2 x <4 x i32>]* %1 to i8*
216 %3 = getelementptr i8, i8* %2, i32 1
217 %4 = bitcast i8* %3 to [2 x <4 x i32>]*
218 %5 = getelementptr [2 x <4 x i32>], [2 x <4 x i32>]* %4, i32 0, i32 0
220 %6 = load volatile <4 x i32>, <4 x i32>* %5
221 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
222 ; CHECK: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
223 store volatile <4 x i32> %6, <4 x i32>* %5
224 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
225 ; CHECK: st.w [[R1]], 0([[BASE]])
228 ; CHECK: .size loadstore_v4i32_unaligned
231 define void @loadstore_v4i32_just_under_simm10() nounwind {
232 ; CHECK: loadstore_v4i32_just_under_simm10:
234 %1 = alloca <4 x i32>
235 %2 = alloca [2028 x i8] ; Push the frame--acounting for the emergency spill
236 ; slot--right up to 2048 bytes
238 %3 = load volatile <4 x i32>, <4 x i32>* %1
239 ; CHECK: ld.w [[R1:\$w[0-9]+]], 2032($sp)
240 store volatile <4 x i32> %3, <4 x i32>* %1
241 ; CHECK: st.w [[R1]], 2032($sp)
244 ; CHECK: .size loadstore_v4i32_just_under_simm10
247 define void @loadstore_v4i32_just_over_simm10() nounwind {
248 ; CHECK: loadstore_v4i32_just_over_simm10:
250 %1 = alloca <4 x i32>
251 %2 = alloca [2033 x i8] ; Push the frame--acounting for the emergency spill
252 ; slot--just over 2048 bytes
254 %3 = load volatile <4 x i32>, <4 x i32>* %1
255 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 2048
256 ; CHECK: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
257 store volatile <4 x i32> %3, <4 x i32>* %1
258 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 2048
259 ; CHECK: st.w [[R1]], 0([[BASE]])
262 ; CHECK: .size loadstore_v4i32_just_over_simm10
265 define void @loadstore_v4i32_just_under_simm16() nounwind {
266 ; CHECK: loadstore_v4i32_just_under_simm16:
268 %1 = alloca <4 x i32>
269 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
270 ; slot-- right up to 32768 bytes
272 %3 = load volatile <4 x i32>, <4 x i32>* %1
273 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
274 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
275 ; CHECK: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
276 store volatile <4 x i32> %3, <4 x i32>* %1
277 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
278 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
279 ; CHECK: st.w [[R1]], 0([[BASE]])
282 ; CHECK: .size loadstore_v4i32_just_under_simm16
285 define void @loadstore_v4i32_just_over_simm16() nounwind {
286 ; CHECK: loadstore_v4i32_just_over_simm16:
288 %1 = alloca <4 x i32>
289 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
290 ; slot--just over 32768 bytes
292 %3 = load volatile <4 x i32>, <4 x i32>* %1
293 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
294 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
295 ; CHECK: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
296 store volatile <4 x i32> %3, <4 x i32>* %1
297 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
298 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
299 ; CHECK: st.w [[R1]], 0([[BASE]])
302 ; CHECK: .size loadstore_v4i32_just_over_simm16
305 define void @loadstore_v2i64_near() nounwind {
306 ; CHECK: loadstore_v2i64_near:
308 %1 = alloca <2 x i64>
309 %2 = load volatile <2 x i64>, <2 x i64>* %1
310 ; CHECK: ld.d [[R1:\$w[0-9]+]], 0($sp)
311 store volatile <2 x i64> %2, <2 x i64>* %1
312 ; CHECK: st.d [[R1]], 0($sp)
315 ; CHECK: .size loadstore_v2i64_near
318 define void @loadstore_v2i64_unaligned() nounwind {
319 ; CHECK: loadstore_v2i64_unaligned:
321 %1 = alloca [2 x <2 x i64>]
322 %2 = bitcast [2 x <2 x i64>]* %1 to i8*
323 %3 = getelementptr i8, i8* %2, i32 1
324 %4 = bitcast i8* %3 to [2 x <2 x i64>]*
325 %5 = getelementptr [2 x <2 x i64>], [2 x <2 x i64>]* %4, i32 0, i32 0
327 %6 = load volatile <2 x i64>, <2 x i64>* %5
328 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
329 ; CHECK: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
330 store volatile <2 x i64> %6, <2 x i64>* %5
331 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
332 ; CHECK: st.d [[R1]], 0([[BASE]])
335 ; CHECK: .size loadstore_v2i64_unaligned
338 define void @loadstore_v2i64_just_under_simm10() nounwind {
339 ; CHECK: loadstore_v2i64_just_under_simm10:
341 %1 = alloca <2 x i64>
342 %2 = alloca [4076 x i8] ; Push the frame--acounting for the emergency spill
343 ; slot--right up to 4096 bytes
344 %3 = load volatile <2 x i64>, <2 x i64>* %1
345 ; CHECK: ld.d [[R1:\$w[0-9]+]], 4080($sp)
346 store volatile <2 x i64> %3, <2 x i64>* %1
347 ; CHECK: st.d [[R1]], 4080($sp)
350 ; CHECK: .size loadstore_v2i64_just_under_simm10
353 define void @loadstore_v2i64_just_over_simm10() nounwind {
354 ; CHECK: loadstore_v2i64_just_over_simm10:
356 %1 = alloca <2 x i64>
357 %2 = alloca [4081 x i8] ; Push the frame--acounting for the emergency spill
358 ; slot--just over 4096 bytes
360 %3 = load volatile <2 x i64>, <2 x i64>* %1
361 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 4096
362 ; CHECK: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
363 store volatile <2 x i64> %3, <2 x i64>* %1
364 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 4096
365 ; CHECK: st.d [[R1]], 0([[BASE]])
368 ; CHECK: .size loadstore_v2i64_just_over_simm10
371 define void @loadstore_v2i64_just_under_simm16() nounwind {
372 ; CHECK: loadstore_v2i64_just_under_simm16:
374 %1 = alloca <2 x i64>
375 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
376 ; slot--right up to 32768 bytes
378 %3 = load volatile <2 x i64>, <2 x i64>* %1
379 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
380 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
381 ; CHECK: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
382 store volatile <2 x i64> %3, <2 x i64>* %1
383 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
384 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
385 ; CHECK: st.d [[R1]], 0([[BASE]])
388 ; CHECK: .size loadstore_v2i64_just_under_simm16
391 define void @loadstore_v2i64_just_over_simm16() nounwind {
392 ; CHECK: loadstore_v2i64_just_over_simm16:
394 %1 = alloca <2 x i64>
395 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
396 ; slot--just over 32768 bytes
398 %3 = load volatile <2 x i64>, <2 x i64>* %1
399 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
400 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
401 ; CHECK: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
402 store volatile <2 x i64> %3, <2 x i64>* %1
403 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
404 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
405 ; CHECK: st.d [[R1]], 0([[BASE]])
408 ; CHECK: .size loadstore_v2i64_just_over_simm16