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>, ptr %1
9 ; CHECK: ld.b [[R1:\$w[0-9]+]], 0($sp)
10 store volatile <16 x i8> %2, ptr %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>, ptr %1
25 ; CHECK: ld.b [[R1:\$w[0-9]+]], 496($sp)
26 store volatile <16 x i8> %3, ptr %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>, ptr %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, ptr %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>, ptr %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, ptr %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>, ptr %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, ptr %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>, ptr %1
96 ; CHECK: ld.h [[R1:\$w[0-9]+]], 0($sp)
97 store volatile <8 x i16> %2, ptr %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 = getelementptr i8, ptr %1, i32 1
110 %3 = load volatile <8 x i16>, ptr %2
111 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
112 ; CHECK: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
113 store volatile <8 x i16> %3, ptr %2
114 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
115 ; CHECK: st.h [[R1]], 0([[BASE]])
118 ; CHECK: .size loadstore_v8i16_unaligned
121 define void @loadstore_v8i16_just_under_simm10() nounwind {
122 ; CHECK: loadstore_v8i16_just_under_simm10:
124 %1 = alloca <8 x i16>
125 %2 = alloca [1004 x i8] ; Push the frame--acounting for the emergency spill
126 ; slot--right up to 1024 bytes
128 %3 = load volatile <8 x i16>, ptr %1
129 ; CHECK: ld.h [[R1:\$w[0-9]+]], 1008($sp)
130 store volatile <8 x i16> %3, ptr %1
131 ; CHECK: st.h [[R1]], 1008($sp)
134 ; CHECK: .size loadstore_v8i16_just_under_simm10
137 define void @loadstore_v8i16_just_over_simm10() nounwind {
138 ; CHECK: loadstore_v8i16_just_over_simm10:
140 %1 = alloca <8 x i16>
141 %2 = alloca [1009 x i8] ; Push the frame--acounting for the emergency spill
142 ; slot--just over 1024 bytes
144 %3 = load volatile <8 x i16>, ptr %1
145 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1024
146 ; CHECK: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
147 store volatile <8 x i16> %3, ptr %1
148 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1024
149 ; CHECK: st.h [[R1]], 0([[BASE]])
152 ; CHECK: .size loadstore_v8i16_just_over_simm10
155 define void @loadstore_v8i16_just_under_simm16() nounwind {
156 ; CHECK: loadstore_v8i16_just_under_simm16:
158 %1 = alloca <8 x i16>
159 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
160 ; slot--right up to 32768 bytes
162 %3 = load volatile <8 x i16>, ptr %1
163 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
164 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
165 ; CHECK: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
166 store volatile <8 x i16> %3, ptr %1
167 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
168 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
169 ; CHECK: st.h [[R1]], 0([[BASE]])
172 ; CHECK: .size loadstore_v8i16_just_under_simm16
175 define void @loadstore_v8i16_just_over_simm16() nounwind {
176 ; CHECK: loadstore_v8i16_just_over_simm16:
178 %1 = alloca <8 x i16>
179 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
180 ; slot--just over 32768 bytes
182 %3 = load volatile <8 x i16>, ptr %1
183 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
184 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
185 ; CHECK: ld.h [[R1:\$w[0-9]+]], 0([[BASE]])
186 store volatile <8 x i16> %3, ptr %1
187 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
188 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
189 ; CHECK: st.h [[R1]], 0([[BASE]])
192 ; CHECK: .size loadstore_v8i16_just_over_simm16
195 define void @loadstore_v4i32_near() nounwind {
196 ; CHECK: loadstore_v4i32_near:
198 %1 = alloca <4 x i32>
199 %2 = load volatile <4 x i32>, ptr %1
200 ; CHECK: ld.w [[R1:\$w[0-9]+]], 0($sp)
201 store volatile <4 x i32> %2, ptr %1
202 ; CHECK: st.w [[R1]], 0($sp)
205 ; CHECK: .size loadstore_v4i32_near
208 define void @loadstore_v4i32_unaligned() nounwind {
209 ; CHECK: loadstore_v4i32_unaligned:
211 %1 = alloca [2 x <4 x i32>]
212 %2 = getelementptr i8, ptr %1, i32 1
214 %3 = load volatile <4 x i32>, ptr %2
215 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
216 ; CHECK: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
217 store volatile <4 x i32> %3, ptr %2
218 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
219 ; CHECK: st.w [[R1]], 0([[BASE]])
222 ; CHECK: .size loadstore_v4i32_unaligned
225 define void @loadstore_v4i32_just_under_simm10() nounwind {
226 ; CHECK: loadstore_v4i32_just_under_simm10:
228 %1 = alloca <4 x i32>
229 %2 = alloca [2028 x i8] ; Push the frame--acounting for the emergency spill
230 ; slot--right up to 2048 bytes
232 %3 = load volatile <4 x i32>, ptr %1
233 ; CHECK: ld.w [[R1:\$w[0-9]+]], 2032($sp)
234 store volatile <4 x i32> %3, ptr %1
235 ; CHECK: st.w [[R1]], 2032($sp)
238 ; CHECK: .size loadstore_v4i32_just_under_simm10
241 define void @loadstore_v4i32_just_over_simm10() nounwind {
242 ; CHECK: loadstore_v4i32_just_over_simm10:
244 %1 = alloca <4 x i32>
245 %2 = alloca [2033 x i8] ; Push the frame--acounting for the emergency spill
246 ; slot--just over 2048 bytes
248 %3 = load volatile <4 x i32>, ptr %1
249 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 2048
250 ; CHECK: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
251 store volatile <4 x i32> %3, ptr %1
252 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 2048
253 ; CHECK: st.w [[R1]], 0([[BASE]])
256 ; CHECK: .size loadstore_v4i32_just_over_simm10
259 define void @loadstore_v4i32_just_under_simm16() nounwind {
260 ; CHECK: loadstore_v4i32_just_under_simm16:
262 %1 = alloca <4 x i32>
263 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
264 ; slot-- right up to 32768 bytes
266 %3 = load volatile <4 x i32>, ptr %1
267 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
268 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
269 ; CHECK: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
270 store volatile <4 x i32> %3, ptr %1
271 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
272 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
273 ; CHECK: st.w [[R1]], 0([[BASE]])
276 ; CHECK: .size loadstore_v4i32_just_under_simm16
279 define void @loadstore_v4i32_just_over_simm16() nounwind {
280 ; CHECK: loadstore_v4i32_just_over_simm16:
282 %1 = alloca <4 x i32>
283 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
284 ; slot--just over 32768 bytes
286 %3 = load volatile <4 x i32>, ptr %1
287 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
288 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
289 ; CHECK: ld.w [[R1:\$w[0-9]+]], 0([[BASE]])
290 store volatile <4 x i32> %3, ptr %1
291 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
292 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
293 ; CHECK: st.w [[R1]], 0([[BASE]])
296 ; CHECK: .size loadstore_v4i32_just_over_simm16
299 define void @loadstore_v2i64_near() nounwind {
300 ; CHECK: loadstore_v2i64_near:
302 %1 = alloca <2 x i64>
303 %2 = load volatile <2 x i64>, ptr %1
304 ; CHECK: ld.d [[R1:\$w[0-9]+]], 0($sp)
305 store volatile <2 x i64> %2, ptr %1
306 ; CHECK: st.d [[R1]], 0($sp)
309 ; CHECK: .size loadstore_v2i64_near
312 define void @loadstore_v2i64_unaligned() nounwind {
313 ; CHECK: loadstore_v2i64_unaligned:
315 %1 = alloca [2 x <2 x i64>]
316 %2 = getelementptr i8, ptr %1, i32 1
318 %3 = load volatile <2 x i64>, ptr %2
319 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
320 ; CHECK: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
321 store volatile <2 x i64> %3, ptr %2
322 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 1
323 ; CHECK: st.d [[R1]], 0([[BASE]])
326 ; CHECK: .size loadstore_v2i64_unaligned
329 define void @loadstore_v2i64_just_under_simm10() nounwind {
330 ; CHECK: loadstore_v2i64_just_under_simm10:
332 %1 = alloca <2 x i64>
333 %2 = alloca [4076 x i8] ; Push the frame--acounting for the emergency spill
334 ; slot--right up to 4096 bytes
335 %3 = load volatile <2 x i64>, ptr %1
336 ; CHECK: ld.d [[R1:\$w[0-9]+]], 4080($sp)
337 store volatile <2 x i64> %3, ptr %1
338 ; CHECK: st.d [[R1]], 4080($sp)
341 ; CHECK: .size loadstore_v2i64_just_under_simm10
344 define void @loadstore_v2i64_just_over_simm10() nounwind {
345 ; CHECK: loadstore_v2i64_just_over_simm10:
347 %1 = alloca <2 x i64>
348 %2 = alloca [4081 x i8] ; Push the frame--acounting for the emergency spill
349 ; slot--just over 4096 bytes
351 %3 = load volatile <2 x i64>, ptr %1
352 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 4096
353 ; CHECK: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
354 store volatile <2 x i64> %3, ptr %1
355 ; CHECK: addiu [[BASE:\$([0-9]+|gp)]], $sp, 4096
356 ; CHECK: st.d [[R1]], 0([[BASE]])
359 ; CHECK: .size loadstore_v2i64_just_over_simm10
362 define void @loadstore_v2i64_just_under_simm16() nounwind {
363 ; CHECK: loadstore_v2i64_just_under_simm16:
365 %1 = alloca <2 x i64>
366 %2 = alloca [32752 x i8] ; Push the frame--acounting for the emergency spill
367 ; slot--right up to 32768 bytes
369 %3 = load volatile <2 x i64>, ptr %1
370 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
371 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
372 ; CHECK: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
373 store volatile <2 x i64> %3, ptr %1
374 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
375 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
376 ; CHECK: st.d [[R1]], 0([[BASE]])
379 ; CHECK: .size loadstore_v2i64_just_under_simm16
382 define void @loadstore_v2i64_just_over_simm16() nounwind {
383 ; CHECK: loadstore_v2i64_just_over_simm16:
385 %1 = alloca <2 x i64>
386 %2 = alloca [32753 x i8] ; Push the frame--acounting for the emergency spill
387 ; slot--just over 32768 bytes
389 %3 = load volatile <2 x i64>, ptr %1
390 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
391 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
392 ; CHECK: ld.d [[R1:\$w[0-9]+]], 0([[BASE]])
393 store volatile <2 x i64> %3, ptr %1
394 ; CHECK: ori [[R2:\$([0-9]+|gp)]], $zero, 32768
395 ; CHECK: addu [[BASE:\$([0-9]+|gp)]], $sp, [[R2]]
396 ; CHECK: st.d [[R1]], 0([[BASE]])
399 ; CHECK: .size loadstore_v2i64_just_over_simm16