1 ; RUN: llc -march=mips -mattr=+msa,+fp64,+mips32r2 < %s \
2 ; RUN: | FileCheck -check-prefixes=MIPS32-AE,MIPS32-BE %s
3 ; RUN: llc -march=mipsel -mattr=+msa,+fp64,+mips32r2 < %s \
4 ; RUN: | FileCheck -check-prefixes=MIPS32-AE,MIPS32-LE %s
6 define void @loadstore_v16i8_near() nounwind {
7 ; MIPS32-AE: loadstore_v16i8_near:
10 %2 = load volatile <16 x i8>, <16 x i8>* %1
11 ; MIPS32-AE: ld.b [[R1:\$w[0-9]+]], 0($sp)
12 store volatile <16 x i8> %2, <16 x i8>* %1
13 ; MIPS32-AE: st.b [[R1]], 0($sp)
16 ; MIPS32-AE: .size loadstore_v16i8_near
19 define void @loadstore_v16i8_just_under_simm10() nounwind {
20 ; MIPS32-AE: loadstore_v16i8_just_under_simm10:
23 %2 = alloca [492 x i8] ; Push the frame--acounting for the emergency spill
24 ; slot--right up to 512 bytes
26 %3 = load volatile <16 x i8>, <16 x i8>* %1
27 ; MIPS32-AE: ld.b [[R1:\$w[0-9]+]], 496($sp)
28 store volatile <16 x i8> %3, <16 x i8>* %1
29 ; MIPS32-AE: st.b [[R1]], 496($sp)
32 ; MIPS32-AE: .size loadstore_v16i8_just_under_simm10
35 define void @loadstore_v16i8_just_over_simm10() nounwind {
36 ; MIPS32-AE: loadstore_v16i8_just_over_simm10:
39 %2 = alloca [497 x i8] ; Push the frame--acounting for the emergency spill
40 ; slot--right up to 512 bytes
42 %3 = load volatile <16 x i8>, <16 x i8>* %1
43 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 512
44 ; MIPS32-AE: ld.b [[R1:\$w[0-9]+]], 0([[BASE]])
45 store volatile <16 x i8> %3, <16 x i8>* %1
46 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 512
47 ; MIPS32-AE: st.b [[R1]], 0([[BASE]])
50 ; MIPS32-AE: .size loadstore_v16i8_just_over_simm10
53 define void @loadstore_v16i8_just_under_simm16() nounwind {
54 ; MIPS32-AE: loadstore_v16i8_just_under_simm16:
57 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
58 ; slot--right up to 32768 bytes
60 %3 = load volatile <16 x i8>, <16 x i8>* %1
61 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
62 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
63 ; MIPS32-AE: ld.b [[R1:\$w[0-9]+]], 0([[BASE]])
64 store volatile <16 x i8> %3, <16 x i8>* %1
65 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
66 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
67 ; MIPS32-AE: st.b [[R1]], 0([[BASE]])
70 ; MIPS32-AE: .size loadstore_v16i8_just_under_simm16
73 define void @loadstore_v16i8_just_over_simm16() nounwind {
74 ; MIPS32-AE: loadstore_v16i8_just_over_simm16:
77 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
78 ; slot--just over 32768 bytes
80 %3 = load volatile <16 x i8>, <16 x i8>* %1
81 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
82 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
83 ; MIPS32-AE: ld.b [[R1:\$w[0-9]+]], 0([[BASE]])
84 store volatile <16 x i8> %3, <16 x i8>* %1
85 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
86 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
87 ; MIPS32-AE: st.b [[R1]], 0([[BASE]])
90 ; MIPS32-AE: .size loadstore_v16i8_just_over_simm16
93 define void @loadstore_v8i16_near() nounwind {
94 ; MIPS32-AE: loadstore_v8i16_near:
97 %2 = load volatile <8 x i16>, <8 x i16>* %1
98 ; MIPS32-AE: ld.h [[R1:\$w[0-9]+]], 0($sp)
99 store volatile <8 x i16> %2, <8 x i16>* %1
100 ; MIPS32-AE: st.h [[R1]], 0($sp)
103 ; MIPS32-AE: .size loadstore_v8i16_near
106 define void @loadstore_v8i16_unaligned() nounwind {
107 ; MIPS32-AE: loadstore_v8i16_unaligned:
109 %1 = alloca [2 x <8 x i16>]
110 %2 = bitcast [2 x <8 x i16>]* %1 to i8*
111 %3 = getelementptr i8, i8* %2, i32 1
112 %4 = bitcast i8* %3 to [2 x <8 x i16>]*
113 %5 = getelementptr [2 x <8 x i16>], [2 x <8 x i16>]* %4, i32 0, i32 0
115 %6 = load volatile <8 x i16>, <8 x i16>* %5
116 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
117 ; MIPS32-AE: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
118 store volatile <8 x i16> %6, <8 x i16>* %5
119 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
120 ; MIPS32-AE: st.h [[R1]], 0([[BASE]])
123 ; MIPS32-AE: .size loadstore_v8i16_unaligned
126 define void @loadstore_v8i16_just_under_simm10() nounwind {
127 ; MIPS32-AE: loadstore_v8i16_just_under_simm10:
129 %1 = alloca <8 x i16>
130 %2 = alloca [1004 x i8] ; Push the frame--acounting for the emergency spill
131 ; slot--right up to 1024 bytes
133 %3 = load volatile <8 x i16>, <8 x i16>* %1
134 ; MIPS32-AE: ld.h [[R1:\$w[0-9]+]], 1008($sp)
135 store volatile <8 x i16> %3, <8 x i16>* %1
136 ; MIPS32-AE: st.h [[R1]], 1008($sp)
139 ; MIPS32-AE: .size loadstore_v8i16_just_under_simm10
142 define void @loadstore_v8i16_just_over_simm10() nounwind {
143 ; MIPS32-AE: loadstore_v8i16_just_over_simm10:
145 %1 = alloca <8 x i16>
146 %2 = alloca [1009 x i8] ; Push the frame--acounting for the emergency spill
147 ; slot--just over 1024 bytes
149 %3 = load volatile <8 x i16>, <8 x i16>* %1
150 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1024
151 ; MIPS32-AE: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
152 store volatile <8 x i16> %3, <8 x i16>* %1
153 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1024
154 ; MIPS32-AE: st.h [[R1]], 0([[BASE]])
157 ; MIPS32-AE: .size loadstore_v8i16_just_over_simm10
160 define void @loadstore_v8i16_just_under_simm16() nounwind {
161 ; MIPS32-AE: loadstore_v8i16_just_under_simm16:
163 %1 = alloca <8 x i16>
164 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
165 ; slot--right up to 32768 bytes
167 %3 = load volatile <8 x i16>, <8 x i16>* %1
168 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
169 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
170 ; MIPS32-AE: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
171 store volatile <8 x i16> %3, <8 x i16>* %1
172 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
173 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
174 ; MIPS32-AE: st.h [[R1]], 0([[BASE]])
177 ; MIPS32-AE: .size loadstore_v8i16_just_under_simm16
180 define void @loadstore_v8i16_just_over_simm16() nounwind {
181 ; MIPS32-AE: loadstore_v8i16_just_over_simm16:
183 %1 = alloca <8 x i16>
184 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
185 ; slot--just over 32768 bytes
187 %3 = load volatile <8 x i16>, <8 x i16>* %1
188 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
189 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
190 ; MIPS32-AE: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
191 store volatile <8 x i16> %3, <8 x i16>* %1
192 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
193 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
194 ; MIPS32-AE: st.h [[R1]], 0([[BASE]])
197 ; MIPS32-AE: .size loadstore_v8i16_just_over_simm16
200 define void @loadstore_v4i32_near() nounwind {
201 ; MIPS32-AE: loadstore_v4i32_near:
203 %1 = alloca <4 x i32>
204 %2 = load volatile <4 x i32>, <4 x i32>* %1
205 ; MIPS32-AE: ld.w [[R1:\$w[0-9]+]], 0($sp)
206 store volatile <4 x i32> %2, <4 x i32>* %1
207 ; MIPS32-AE: st.w [[R1]], 0($sp)
210 ; MIPS32-AE: .size loadstore_v4i32_near
213 define void @loadstore_v4i32_unaligned() nounwind {
214 ; MIPS32-AE: loadstore_v4i32_unaligned:
216 %1 = alloca [2 x <4 x i32>]
217 %2 = bitcast [2 x <4 x i32>]* %1 to i8*
218 %3 = getelementptr i8, i8* %2, i32 1
219 %4 = bitcast i8* %3 to [2 x <4 x i32>]*
220 %5 = getelementptr [2 x <4 x i32>], [2 x <4 x i32>]* %4, i32 0, i32 0
222 %6 = load volatile <4 x i32>, <4 x i32>* %5
223 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
224 ; MIPS32-AE: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
225 store volatile <4 x i32> %6, <4 x i32>* %5
226 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
227 ; MIPS32-AE: st.w [[R1]], 0([[BASE]])
230 ; MIPS32-AE: .size loadstore_v4i32_unaligned
233 define void @loadstore_v4i32_just_under_simm10() nounwind {
234 ; MIPS32-AE: loadstore_v4i32_just_under_simm10:
236 %1 = alloca <4 x i32>
237 %2 = alloca [2028 x i8] ; Push the frame--acounting for the emergency spill
238 ; slot--right up to 2048 bytes
240 %3 = load volatile <4 x i32>, <4 x i32>* %1
241 ; MIPS32-AE: ld.w [[R1:\$w[0-9]+]], 2032($sp)
242 store volatile <4 x i32> %3, <4 x i32>* %1
243 ; MIPS32-AE: st.w [[R1]], 2032($sp)
246 ; MIPS32-AE: .size loadstore_v4i32_just_under_simm10
249 define void @loadstore_v4i32_just_over_simm10() nounwind {
250 ; MIPS32-AE: loadstore_v4i32_just_over_simm10:
252 %1 = alloca <4 x i32>
253 %2 = alloca [2033 x i8] ; Push the frame--acounting for the emergency spill
254 ; slot--just over 2048 bytes
256 %3 = load volatile <4 x i32>, <4 x i32>* %1
257 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 2048
258 ; MIPS32-AE: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
259 store volatile <4 x i32> %3, <4 x i32>* %1
260 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 2048
261 ; MIPS32-AE: st.w [[R1]], 0([[BASE]])
264 ; MIPS32-AE: .size loadstore_v4i32_just_over_simm10
267 define void @loadstore_v4i32_just_under_simm16() nounwind {
268 ; MIPS32-AE: loadstore_v4i32_just_under_simm16:
270 %1 = alloca <4 x i32>
271 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
272 ; slot-- right up to 32768 bytes
274 %3 = load volatile <4 x i32>, <4 x i32>* %1
275 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
276 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
277 ; MIPS32-AE: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
278 store volatile <4 x i32> %3, <4 x i32>* %1
279 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
280 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
281 ; MIPS32-AE: st.w [[R1]], 0([[BASE]])
284 ; MIPS32-AE: .size loadstore_v4i32_just_under_simm16
287 define void @loadstore_v4i32_just_over_simm16() nounwind {
288 ; MIPS32-AE: loadstore_v4i32_just_over_simm16:
290 %1 = alloca <4 x i32>
291 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
292 ; slot--just over 32768 bytes
294 %3 = load volatile <4 x i32>, <4 x i32>* %1
295 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
296 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
297 ; MIPS32-AE: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
298 store volatile <4 x i32> %3, <4 x i32>* %1
299 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
300 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
301 ; MIPS32-AE: st.w [[R1]], 0([[BASE]])
304 ; MIPS32-AE: .size loadstore_v4i32_just_over_simm16
307 define void @loadstore_v2i64_near() nounwind {
308 ; MIPS32-AE: loadstore_v2i64_near:
310 %1 = alloca <2 x i64>
311 %2 = load volatile <2 x i64>, <2 x i64>* %1
312 ; MIPS32-AE: ld.d [[R1:\$w[0-9]+]], 0($sp)
313 store volatile <2 x i64> %2, <2 x i64>* %1
314 ; MIPS32-AE: st.d [[R1]], 0($sp)
317 ; MIPS32-AE: .size loadstore_v2i64_near
320 define void @loadstore_v2i64_unaligned() nounwind {
321 ; MIPS32-AE: loadstore_v2i64_unaligned:
323 %1 = alloca [2 x <2 x i64>]
324 %2 = bitcast [2 x <2 x i64>]* %1 to i8*
325 %3 = getelementptr i8, i8* %2, i32 1
326 %4 = bitcast i8* %3 to [2 x <2 x i64>]*
327 %5 = getelementptr [2 x <2 x i64>], [2 x <2 x i64>]* %4, i32 0, i32 0
329 %6 = load volatile <2 x i64>, <2 x i64>* %5
330 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
331 ; MIPS32-AE: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
332 store volatile <2 x i64> %6, <2 x i64>* %5
333 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
334 ; MIPS32-AE: st.d [[R1]], 0([[BASE]])
337 ; MIPS32-AE: .size loadstore_v2i64_unaligned
340 define void @loadstore_v2i64_just_under_simm10() nounwind {
341 ; MIPS32-AE: loadstore_v2i64_just_under_simm10:
343 %1 = alloca <2 x i64>
344 %2 = alloca [4076 x i8] ; Push the frame--acounting for the emergency spill
345 ; slot--right up to 4096 bytes
346 %3 = load volatile <2 x i64>, <2 x i64>* %1
347 ; MIPS32-AE: ld.d [[R1:\$w[0-9]+]], 4080($sp)
348 store volatile <2 x i64> %3, <2 x i64>* %1
349 ; MIPS32-AE: st.d [[R1]], 4080($sp)
352 ; MIPS32-AE: .size loadstore_v2i64_just_under_simm10
355 define void @loadstore_v2i64_just_over_simm10() nounwind {
356 ; MIPS32-AE: loadstore_v2i64_just_over_simm10:
358 %1 = alloca <2 x i64>
359 %2 = alloca [4081 x i8] ; Push the frame--acounting for the emergency spill
360 ; slot--just over 4096 bytes
362 %3 = load volatile <2 x i64>, <2 x i64>* %1
363 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 4096
364 ; MIPS32-AE: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
365 store volatile <2 x i64> %3, <2 x i64>* %1
366 ; MIPS32-AE: addiu [[BASE:\$([0-9]+|gp)]], $sp, 4096
367 ; MIPS32-AE: st.d [[R1]], 0([[BASE]])
370 ; MIPS32-AE: .size loadstore_v2i64_just_over_simm10
373 define void @loadstore_v2i64_just_under_simm16() nounwind {
374 ; MIPS32-AE: loadstore_v2i64_just_under_simm16:
376 %1 = alloca <2 x i64>
377 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
378 ; slot--right up to 32768 bytes
380 %3 = load volatile <2 x i64>, <2 x i64>* %1
381 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
382 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
383 ; MIPS32-AE: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
384 store volatile <2 x i64> %3, <2 x i64>* %1
385 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
386 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
387 ; MIPS32-AE: st.d [[R1]], 0([[BASE]])
390 ; MIPS32-AE: .size loadstore_v2i64_just_under_simm16
393 define void @loadstore_v2i64_just_over_simm16() nounwind {
394 ; MIPS32-AE: loadstore_v2i64_just_over_simm16:
396 %1 = alloca <2 x i64>
397 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
398 ; slot--just over 32768 bytes
400 %3 = load volatile <2 x i64>, <2 x i64>* %1
401 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
402 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
403 ; MIPS32-AE: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
404 store volatile <2 x i64> %3, <2 x i64>* %1
405 ; MIPS32-AE: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
406 ; MIPS32-AE: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
407 ; MIPS32-AE: st.d [[R1]], 0([[BASE]])
410 ; MIPS32-AE: .size loadstore_v2i64_just_over_simm16