1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -global-isel -mtriple=mipsel-linux-gnu -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=MIPS32
4 ; --------------------------------------------------------------------
6 ; --------------------------------------------------------------------
8 define i8 @atomic_load_unordered_i8(ptr %ptr) {
9 ; MIPS32-LABEL: atomic_load_unordered_i8:
11 ; MIPS32-NEXT: lbu $2, 0($4)
14 %load = load atomic i8, ptr %ptr unordered, align 1
18 define i32 @atomic_load_unordered_i8_sext_i32(ptr %ptr) {
19 ; MIPS32-LABEL: atomic_load_unordered_i8_sext_i32:
21 ; MIPS32-NEXT: lbu $1, 0($4)
22 ; MIPS32-NEXT: sll $1, $1, 24
24 ; MIPS32-NEXT: sra $2, $1, 24
25 %load = load atomic i8, ptr %ptr unordered, align 1
26 %sext = sext i8 %load to i32
30 define i16 @atomic_load_unordered_i8_sext_i16(ptr %ptr) {
31 ; MIPS32-LABEL: atomic_load_unordered_i8_sext_i16:
33 ; MIPS32-NEXT: lbu $1, 0($4)
34 ; MIPS32-NEXT: sll $1, $1, 24
36 ; MIPS32-NEXT: sra $2, $1, 24
37 %load = load atomic i8, ptr %ptr unordered, align 1
38 %sext = sext i8 %load to i16
42 define i64 @atomic_load_unordered_i8_sext_i64(ptr %ptr) {
43 ; MIPS32-LABEL: atomic_load_unordered_i8_sext_i64:
45 ; MIPS32-NEXT: lbu $1, 0($4)
46 ; MIPS32-NEXT: sll $1, $1, 24
47 ; MIPS32-NEXT: sra $2, $1, 24
49 ; MIPS32-NEXT: sra $3, $1, 31
50 %load = load atomic i8, ptr %ptr unordered, align 1
51 %sext = sext i8 %load to i64
55 define i32 @atomic_load_unordered_i8_zext_i32(ptr %ptr) {
56 ; MIPS32-LABEL: atomic_load_unordered_i8_zext_i32:
58 ; MIPS32-NEXT: lbu $1, 0($4)
60 ; MIPS32-NEXT: andi $2, $1, 255
61 %load = load atomic i8, ptr %ptr unordered, align 1
62 %zext = zext i8 %load to i32
66 define i16 @atomic_load_unordered_i8_zext_i16(ptr %ptr) {
67 ; MIPS32-LABEL: atomic_load_unordered_i8_zext_i16:
69 ; MIPS32-NEXT: lbu $1, 0($4)
71 ; MIPS32-NEXT: andi $2, $1, 255
72 %load = load atomic i8, ptr %ptr unordered, align 1
73 %zext = zext i8 %load to i16
77 define i64 @atomic_load_unordered_i8_zext_i64(ptr %ptr) {
78 ; MIPS32-LABEL: atomic_load_unordered_i8_zext_i64:
80 ; MIPS32-NEXT: lbu $1, 0($4)
81 ; MIPS32-NEXT: andi $2, $1, 255
83 ; MIPS32-NEXT: andi $3, $1, 0
84 %load = load atomic i8, ptr %ptr unordered, align 1
85 %zext = zext i8 %load to i64
89 define i16 @atomic_load_unordered_i16(ptr %ptr) {
90 ; MIPS32-LABEL: atomic_load_unordered_i16:
92 ; MIPS32-NEXT: lhu $2, 0($4)
95 %load = load atomic i16, ptr %ptr unordered, align 2
99 define i32 @atomic_load_unordered_i16_sext_i32(ptr %ptr) {
100 ; MIPS32-LABEL: atomic_load_unordered_i16_sext_i32:
102 ; MIPS32-NEXT: lhu $1, 0($4)
103 ; MIPS32-NEXT: sll $1, $1, 16
104 ; MIPS32-NEXT: jr $ra
105 ; MIPS32-NEXT: sra $2, $1, 16
106 %load = load atomic i16, ptr %ptr unordered, align 2
107 %sext = sext i16 %load to i32
111 define i64 @atomic_load_unordered_i16_sext_i64(ptr %ptr) {
112 ; MIPS32-LABEL: atomic_load_unordered_i16_sext_i64:
114 ; MIPS32-NEXT: lhu $1, 0($4)
115 ; MIPS32-NEXT: sll $1, $1, 16
116 ; MIPS32-NEXT: sra $2, $1, 16
117 ; MIPS32-NEXT: jr $ra
118 ; MIPS32-NEXT: sra $3, $1, 31
119 %load = load atomic i16, ptr %ptr unordered, align 2
120 %sext = sext i16 %load to i64
124 define i32 @atomic_load_unordered_i16_zext_i32(ptr %ptr) {
125 ; MIPS32-LABEL: atomic_load_unordered_i16_zext_i32:
127 ; MIPS32-NEXT: lhu $1, 0($4)
128 ; MIPS32-NEXT: jr $ra
129 ; MIPS32-NEXT: andi $2, $1, 65535
130 %load = load atomic i16, ptr %ptr unordered, align 2
131 %zext = zext i16 %load to i32
135 define i64 @atomic_load_unordered_i16_zext_i64(ptr %ptr) {
136 ; MIPS32-LABEL: atomic_load_unordered_i16_zext_i64:
138 ; MIPS32-NEXT: lhu $1, 0($4)
139 ; MIPS32-NEXT: andi $2, $1, 65535
140 ; MIPS32-NEXT: jr $ra
141 ; MIPS32-NEXT: andi $3, $1, 0
142 %load = load atomic i16, ptr %ptr unordered, align 2
143 %zext = zext i16 %load to i64
147 define i32 @atomic_load_unordered_i32(ptr %ptr) {
148 ; MIPS32-LABEL: atomic_load_unordered_i32:
150 ; MIPS32-NEXT: lw $2, 0($4)
151 ; MIPS32-NEXT: jr $ra
153 %load = load atomic i32, ptr %ptr unordered, align 4
157 define i64 @atomic_load_unordered_i64(ptr %ptr) {
158 ; MIPS32-LABEL: atomic_load_unordered_i64:
160 ; MIPS32-NEXT: addiu $sp, $sp, -24
161 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
162 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
163 ; MIPS32-NEXT: .cfi_offset 31, -4
164 ; MIPS32-NEXT: jal __atomic_load_8
165 ; MIPS32-NEXT: ori $5, $zero, 0
166 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
167 ; MIPS32-NEXT: jr $ra
168 ; MIPS32-NEXT: addiu $sp, $sp, 24
169 %load = load atomic i64, ptr %ptr unordered, align 8
173 define float @atomic_load_unordered_f32(ptr %ptr) {
174 ; MIPS32-LABEL: atomic_load_unordered_f32:
176 ; MIPS32-NEXT: lwc1 $f0, 64($4)
177 ; MIPS32-NEXT: jr $ra
179 %gep = getelementptr inbounds float, ptr %ptr, i32 16
180 %load = load atomic float, ptr %gep unordered, align 4
184 define double @atomic_load_unordered_f64(ptr %ptr) {
185 ; MIPS32-LABEL: atomic_load_unordered_f64:
187 ; MIPS32-NEXT: addiu $sp, $sp, -24
188 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
189 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
190 ; MIPS32-NEXT: .cfi_offset 31, -4
191 ; MIPS32-NEXT: ori $5, $zero, 0
192 ; MIPS32-NEXT: ori $1, $zero, 128
193 ; MIPS32-NEXT: jal __atomic_load_8
194 ; MIPS32-NEXT: addu $4, $4, $1
195 ; MIPS32-NEXT: mtc1 $2, $f0
196 ; MIPS32-NEXT: mtc1 $3, $f1
197 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
198 ; MIPS32-NEXT: jr $ra
199 ; MIPS32-NEXT: addiu $sp, $sp, 24
200 %gep = getelementptr inbounds double, ptr %ptr, i32 16
201 %load = load atomic double, ptr %gep unordered, align 8
205 define ptr @atomic_load_unordered_p0i8(ptr %ptr) {
206 ; MIPS32-LABEL: atomic_load_unordered_p0i8:
208 ; MIPS32-NEXT: lw $2, 64($4)
209 ; MIPS32-NEXT: jr $ra
211 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16
212 %load = load atomic ptr, ptr %gep unordered, align 4
216 ; --------------------------------------------------------------------
218 ; --------------------------------------------------------------------
220 define i8 @atomic_load_monotonic_i8(ptr %ptr) {
221 ; MIPS32-LABEL: atomic_load_monotonic_i8:
223 ; MIPS32-NEXT: lbu $2, 0($4)
224 ; MIPS32-NEXT: jr $ra
226 %load = load atomic i8, ptr %ptr monotonic, align 1
230 define i32 @atomic_load_monotonic_i8_sext_i32(ptr %ptr) {
231 ; MIPS32-LABEL: atomic_load_monotonic_i8_sext_i32:
233 ; MIPS32-NEXT: lbu $1, 0($4)
234 ; MIPS32-NEXT: sll $1, $1, 24
235 ; MIPS32-NEXT: jr $ra
236 ; MIPS32-NEXT: sra $2, $1, 24
237 %load = load atomic i8, ptr %ptr monotonic, align 1
238 %sext = sext i8 %load to i32
242 define i16 @atomic_load_monotonic_i8_sext_i16(ptr %ptr) {
243 ; MIPS32-LABEL: atomic_load_monotonic_i8_sext_i16:
245 ; MIPS32-NEXT: lbu $1, 0($4)
246 ; MIPS32-NEXT: sll $1, $1, 24
247 ; MIPS32-NEXT: jr $ra
248 ; MIPS32-NEXT: sra $2, $1, 24
249 %load = load atomic i8, ptr %ptr monotonic, align 1
250 %sext = sext i8 %load to i16
254 define i64 @atomic_load_monotonic_i8_sext_i64(ptr %ptr) {
255 ; MIPS32-LABEL: atomic_load_monotonic_i8_sext_i64:
257 ; MIPS32-NEXT: lbu $1, 0($4)
258 ; MIPS32-NEXT: sll $1, $1, 24
259 ; MIPS32-NEXT: sra $2, $1, 24
260 ; MIPS32-NEXT: jr $ra
261 ; MIPS32-NEXT: sra $3, $1, 31
262 %load = load atomic i8, ptr %ptr monotonic, align 1
263 %sext = sext i8 %load to i64
267 define i32 @atomic_load_monotonic_i8_zext_i32(ptr %ptr) {
268 ; MIPS32-LABEL: atomic_load_monotonic_i8_zext_i32:
270 ; MIPS32-NEXT: lbu $1, 0($4)
271 ; MIPS32-NEXT: jr $ra
272 ; MIPS32-NEXT: andi $2, $1, 255
273 %load = load atomic i8, ptr %ptr monotonic, align 1
274 %zext = zext i8 %load to i32
278 define i16 @atomic_load_monotonic_i8_zext_i16(ptr %ptr) {
279 ; MIPS32-LABEL: atomic_load_monotonic_i8_zext_i16:
281 ; MIPS32-NEXT: lbu $1, 0($4)
282 ; MIPS32-NEXT: jr $ra
283 ; MIPS32-NEXT: andi $2, $1, 255
284 %load = load atomic i8, ptr %ptr monotonic, align 1
285 %zext = zext i8 %load to i16
289 define i64 @atomic_load_monotonic_i8_zext_i64(ptr %ptr) {
290 ; MIPS32-LABEL: atomic_load_monotonic_i8_zext_i64:
292 ; MIPS32-NEXT: lbu $1, 0($4)
293 ; MIPS32-NEXT: andi $2, $1, 255
294 ; MIPS32-NEXT: jr $ra
295 ; MIPS32-NEXT: andi $3, $1, 0
296 %load = load atomic i8, ptr %ptr monotonic, align 1
297 %zext = zext i8 %load to i64
301 define i16 @atomic_load_monotonic_i16(ptr %ptr) {
302 ; MIPS32-LABEL: atomic_load_monotonic_i16:
304 ; MIPS32-NEXT: lhu $2, 0($4)
305 ; MIPS32-NEXT: jr $ra
307 %load = load atomic i16, ptr %ptr monotonic, align 2
311 define i32 @atomic_load_monotonic_i16_sext_i32(ptr %ptr) {
312 ; MIPS32-LABEL: atomic_load_monotonic_i16_sext_i32:
314 ; MIPS32-NEXT: lhu $1, 0($4)
315 ; MIPS32-NEXT: sll $1, $1, 16
316 ; MIPS32-NEXT: jr $ra
317 ; MIPS32-NEXT: sra $2, $1, 16
318 %load = load atomic i16, ptr %ptr monotonic, align 2
319 %sext = sext i16 %load to i32
323 define i64 @atomic_load_monotonic_i16_sext_i64(ptr %ptr) {
324 ; MIPS32-LABEL: atomic_load_monotonic_i16_sext_i64:
326 ; MIPS32-NEXT: lhu $1, 0($4)
327 ; MIPS32-NEXT: sll $1, $1, 16
328 ; MIPS32-NEXT: sra $2, $1, 16
329 ; MIPS32-NEXT: jr $ra
330 ; MIPS32-NEXT: sra $3, $1, 31
331 %load = load atomic i16, ptr %ptr monotonic, align 2
332 %sext = sext i16 %load to i64
336 define i32 @atomic_load_monotonic_i16_zext_i32(ptr %ptr) {
337 ; MIPS32-LABEL: atomic_load_monotonic_i16_zext_i32:
339 ; MIPS32-NEXT: lhu $1, 0($4)
340 ; MIPS32-NEXT: jr $ra
341 ; MIPS32-NEXT: andi $2, $1, 65535
342 %load = load atomic i16, ptr %ptr monotonic, align 2
343 %zext = zext i16 %load to i32
347 define i64 @atomic_load_monotonic_i16_zext_i64(ptr %ptr) {
348 ; MIPS32-LABEL: atomic_load_monotonic_i16_zext_i64:
350 ; MIPS32-NEXT: lhu $1, 0($4)
351 ; MIPS32-NEXT: andi $2, $1, 65535
352 ; MIPS32-NEXT: jr $ra
353 ; MIPS32-NEXT: andi $3, $1, 0
354 %load = load atomic i16, ptr %ptr monotonic, align 2
355 %zext = zext i16 %load to i64
359 define i32 @atomic_load_monotonic_i32(ptr %ptr) {
360 ; MIPS32-LABEL: atomic_load_monotonic_i32:
362 ; MIPS32-NEXT: lw $2, 0($4)
363 ; MIPS32-NEXT: jr $ra
365 %load = load atomic i32, ptr %ptr monotonic, align 4
369 define i64 @atomic_load_monotonic_i64(ptr %ptr) {
370 ; MIPS32-LABEL: atomic_load_monotonic_i64:
372 ; MIPS32-NEXT: addiu $sp, $sp, -24
373 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
374 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
375 ; MIPS32-NEXT: .cfi_offset 31, -4
376 ; MIPS32-NEXT: jal __atomic_load_8
377 ; MIPS32-NEXT: ori $5, $zero, 0
378 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
379 ; MIPS32-NEXT: jr $ra
380 ; MIPS32-NEXT: addiu $sp, $sp, 24
381 %load = load atomic i64, ptr %ptr monotonic, align 8
385 define float @atomic_load_monotonic_f32(ptr %ptr) {
386 ; MIPS32-LABEL: atomic_load_monotonic_f32:
388 ; MIPS32-NEXT: lwc1 $f0, 64($4)
389 ; MIPS32-NEXT: jr $ra
391 %gep = getelementptr inbounds float, ptr %ptr, i32 16
392 %load = load atomic float, ptr %gep monotonic, align 4
396 define double @atomic_load_monotonic_f64(ptr %ptr) {
397 ; MIPS32-LABEL: atomic_load_monotonic_f64:
399 ; MIPS32-NEXT: addiu $sp, $sp, -24
400 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
401 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
402 ; MIPS32-NEXT: .cfi_offset 31, -4
403 ; MIPS32-NEXT: ori $5, $zero, 0
404 ; MIPS32-NEXT: ori $1, $zero, 128
405 ; MIPS32-NEXT: jal __atomic_load_8
406 ; MIPS32-NEXT: addu $4, $4, $1
407 ; MIPS32-NEXT: mtc1 $2, $f0
408 ; MIPS32-NEXT: mtc1 $3, $f1
409 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
410 ; MIPS32-NEXT: jr $ra
411 ; MIPS32-NEXT: addiu $sp, $sp, 24
412 %gep = getelementptr inbounds double, ptr %ptr, i32 16
413 %load = load atomic double, ptr %gep monotonic, align 8
417 define ptr @atomic_load_monotonic_p0i8(ptr %ptr) {
418 ; MIPS32-LABEL: atomic_load_monotonic_p0i8:
420 ; MIPS32-NEXT: lw $2, 64($4)
421 ; MIPS32-NEXT: jr $ra
423 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16
424 %load = load atomic ptr, ptr %gep monotonic, align 4
428 ; --------------------------------------------------------------------
430 ; --------------------------------------------------------------------
432 define i8 @atomic_load_acquire_i8(ptr %ptr) {
433 ; MIPS32-LABEL: atomic_load_acquire_i8:
435 ; MIPS32-NEXT: lbu $2, 0($4)
437 ; MIPS32-NEXT: jr $ra
439 %load = load atomic i8, ptr %ptr acquire, align 1
443 define i32 @atomic_load_acquire_i8_sext_i32(ptr %ptr) {
444 ; MIPS32-LABEL: atomic_load_acquire_i8_sext_i32:
446 ; MIPS32-NEXT: lbu $1, 0($4)
448 ; MIPS32-NEXT: sll $1, $1, 24
449 ; MIPS32-NEXT: jr $ra
450 ; MIPS32-NEXT: sra $2, $1, 24
451 %load = load atomic i8, ptr %ptr acquire, align 1
452 %sext = sext i8 %load to i32
456 define i16 @atomic_load_acquire_i8_sext_i16(ptr %ptr) {
457 ; MIPS32-LABEL: atomic_load_acquire_i8_sext_i16:
459 ; MIPS32-NEXT: lbu $1, 0($4)
461 ; MIPS32-NEXT: sll $1, $1, 24
462 ; MIPS32-NEXT: jr $ra
463 ; MIPS32-NEXT: sra $2, $1, 24
464 %load = load atomic i8, ptr %ptr acquire, align 1
465 %sext = sext i8 %load to i16
469 define i64 @atomic_load_acquire_i8_sext_i64(ptr %ptr) {
470 ; MIPS32-LABEL: atomic_load_acquire_i8_sext_i64:
472 ; MIPS32-NEXT: lbu $1, 0($4)
474 ; MIPS32-NEXT: sll $1, $1, 24
475 ; MIPS32-NEXT: sra $2, $1, 24
476 ; MIPS32-NEXT: jr $ra
477 ; MIPS32-NEXT: sra $3, $1, 31
478 %load = load atomic i8, ptr %ptr acquire, align 1
479 %sext = sext i8 %load to i64
483 define i32 @atomic_load_acquire_i8_zext_i32(ptr %ptr) {
484 ; MIPS32-LABEL: atomic_load_acquire_i8_zext_i32:
486 ; MIPS32-NEXT: lbu $1, 0($4)
488 ; MIPS32-NEXT: jr $ra
489 ; MIPS32-NEXT: andi $2, $1, 255
490 %load = load atomic i8, ptr %ptr acquire, align 1
491 %zext = zext i8 %load to i32
495 define i16 @atomic_load_acquire_i8_zext_i16(ptr %ptr) {
496 ; MIPS32-LABEL: atomic_load_acquire_i8_zext_i16:
498 ; MIPS32-NEXT: lbu $1, 0($4)
500 ; MIPS32-NEXT: jr $ra
501 ; MIPS32-NEXT: andi $2, $1, 255
502 %load = load atomic i8, ptr %ptr acquire, align 1
503 %zext = zext i8 %load to i16
507 define i64 @atomic_load_acquire_i8_zext_i64(ptr %ptr) {
508 ; MIPS32-LABEL: atomic_load_acquire_i8_zext_i64:
510 ; MIPS32-NEXT: lbu $1, 0($4)
512 ; MIPS32-NEXT: andi $2, $1, 255
513 ; MIPS32-NEXT: jr $ra
514 ; MIPS32-NEXT: andi $3, $1, 0
515 %load = load atomic i8, ptr %ptr acquire, align 1
516 %zext = zext i8 %load to i64
520 define i16 @atomic_load_acquire_i16(ptr %ptr) {
521 ; MIPS32-LABEL: atomic_load_acquire_i16:
523 ; MIPS32-NEXT: lhu $2, 0($4)
525 ; MIPS32-NEXT: jr $ra
527 %load = load atomic i16, ptr %ptr acquire, align 2
531 define i32 @atomic_load_acquire_i16_sext_i32(ptr %ptr) {
532 ; MIPS32-LABEL: atomic_load_acquire_i16_sext_i32:
534 ; MIPS32-NEXT: lhu $1, 0($4)
536 ; MIPS32-NEXT: sll $1, $1, 16
537 ; MIPS32-NEXT: jr $ra
538 ; MIPS32-NEXT: sra $2, $1, 16
539 %load = load atomic i16, ptr %ptr acquire, align 2
540 %sext = sext i16 %load to i32
544 define i64 @atomic_load_acquire_i16_sext_i64(ptr %ptr) {
545 ; MIPS32-LABEL: atomic_load_acquire_i16_sext_i64:
547 ; MIPS32-NEXT: lhu $1, 0($4)
549 ; MIPS32-NEXT: sll $1, $1, 16
550 ; MIPS32-NEXT: sra $2, $1, 16
551 ; MIPS32-NEXT: jr $ra
552 ; MIPS32-NEXT: sra $3, $1, 31
553 %load = load atomic i16, ptr %ptr acquire, align 2
554 %sext = sext i16 %load to i64
558 define i32 @atomic_load_acquire_i16_zext_i32(ptr %ptr) {
559 ; MIPS32-LABEL: atomic_load_acquire_i16_zext_i32:
561 ; MIPS32-NEXT: lhu $1, 0($4)
563 ; MIPS32-NEXT: jr $ra
564 ; MIPS32-NEXT: andi $2, $1, 65535
565 %load = load atomic i16, ptr %ptr acquire, align 2
566 %zext = zext i16 %load to i32
570 define i64 @atomic_load_acquire_i16_zext_i64(ptr %ptr) {
571 ; MIPS32-LABEL: atomic_load_acquire_i16_zext_i64:
573 ; MIPS32-NEXT: lhu $1, 0($4)
575 ; MIPS32-NEXT: andi $2, $1, 65535
576 ; MIPS32-NEXT: jr $ra
577 ; MIPS32-NEXT: andi $3, $1, 0
578 %load = load atomic i16, ptr %ptr acquire, align 2
579 %zext = zext i16 %load to i64
583 define i32 @atomic_load_acquire_i32(ptr %ptr) {
584 ; MIPS32-LABEL: atomic_load_acquire_i32:
586 ; MIPS32-NEXT: lw $2, 0($4)
588 ; MIPS32-NEXT: jr $ra
590 %load = load atomic i32, ptr %ptr acquire, align 4
594 define i64 @atomic_load_acquire_i64(ptr %ptr) {
595 ; MIPS32-LABEL: atomic_load_acquire_i64:
597 ; MIPS32-NEXT: addiu $sp, $sp, -24
598 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
599 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
600 ; MIPS32-NEXT: .cfi_offset 31, -4
601 ; MIPS32-NEXT: jal __atomic_load_8
602 ; MIPS32-NEXT: ori $5, $zero, 2
603 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
604 ; MIPS32-NEXT: jr $ra
605 ; MIPS32-NEXT: addiu $sp, $sp, 24
606 %load = load atomic i64, ptr %ptr acquire, align 8
610 define float @atomic_load_acquire_f32(ptr %ptr) {
611 ; MIPS32-LABEL: atomic_load_acquire_f32:
613 ; MIPS32-NEXT: lwc1 $f0, 64($4)
615 ; MIPS32-NEXT: jr $ra
617 %gep = getelementptr inbounds float, ptr %ptr, i32 16
618 %load = load atomic float, ptr %gep acquire, align 4
622 define double @atomic_load_acquire_f64(ptr %ptr) {
623 ; MIPS32-LABEL: atomic_load_acquire_f64:
625 ; MIPS32-NEXT: addiu $sp, $sp, -24
626 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
627 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
628 ; MIPS32-NEXT: .cfi_offset 31, -4
629 ; MIPS32-NEXT: ori $5, $zero, 2
630 ; MIPS32-NEXT: ori $1, $zero, 128
631 ; MIPS32-NEXT: jal __atomic_load_8
632 ; MIPS32-NEXT: addu $4, $4, $1
633 ; MIPS32-NEXT: mtc1 $2, $f0
634 ; MIPS32-NEXT: mtc1 $3, $f1
635 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
636 ; MIPS32-NEXT: jr $ra
637 ; MIPS32-NEXT: addiu $sp, $sp, 24
638 %gep = getelementptr inbounds double, ptr %ptr, i32 16
639 %load = load atomic double, ptr %gep acquire, align 8
643 define ptr @atomic_load_acquire_p0i8(ptr %ptr) {
644 ; MIPS32-LABEL: atomic_load_acquire_p0i8:
646 ; MIPS32-NEXT: lw $2, 64($4)
648 ; MIPS32-NEXT: jr $ra
650 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16
651 %load = load atomic ptr, ptr %gep acquire, align 4
655 ; --------------------------------------------------------------------
657 ; --------------------------------------------------------------------
659 define i8 @atomic_load_seq_cst_i8(ptr %ptr) {
660 ; MIPS32-LABEL: atomic_load_seq_cst_i8:
662 ; MIPS32-NEXT: lbu $2, 0($4)
664 ; MIPS32-NEXT: jr $ra
666 %load = load atomic i8, ptr %ptr seq_cst, align 1
670 define i32 @atomic_load_seq_cst_i8_sext_i32(ptr %ptr) {
671 ; MIPS32-LABEL: atomic_load_seq_cst_i8_sext_i32:
673 ; MIPS32-NEXT: lbu $1, 0($4)
675 ; MIPS32-NEXT: sll $1, $1, 24
676 ; MIPS32-NEXT: jr $ra
677 ; MIPS32-NEXT: sra $2, $1, 24
678 %load = load atomic i8, ptr %ptr seq_cst, align 1
679 %sext = sext i8 %load to i32
683 define i16 @atomic_load_seq_cst_i8_sext_i16(ptr %ptr) {
684 ; MIPS32-LABEL: atomic_load_seq_cst_i8_sext_i16:
686 ; MIPS32-NEXT: lbu $1, 0($4)
688 ; MIPS32-NEXT: sll $1, $1, 24
689 ; MIPS32-NEXT: jr $ra
690 ; MIPS32-NEXT: sra $2, $1, 24
691 %load = load atomic i8, ptr %ptr seq_cst, align 1
692 %sext = sext i8 %load to i16
696 define i64 @atomic_load_seq_cst_i8_sext_i64(ptr %ptr) {
697 ; MIPS32-LABEL: atomic_load_seq_cst_i8_sext_i64:
699 ; MIPS32-NEXT: lbu $1, 0($4)
701 ; MIPS32-NEXT: sll $1, $1, 24
702 ; MIPS32-NEXT: sra $2, $1, 24
703 ; MIPS32-NEXT: jr $ra
704 ; MIPS32-NEXT: sra $3, $1, 31
705 %load = load atomic i8, ptr %ptr seq_cst, align 1
706 %sext = sext i8 %load to i64
710 define i32 @atomic_load_seq_cst_i8_zext_i32(ptr %ptr) {
711 ; MIPS32-LABEL: atomic_load_seq_cst_i8_zext_i32:
713 ; MIPS32-NEXT: lbu $1, 0($4)
715 ; MIPS32-NEXT: jr $ra
716 ; MIPS32-NEXT: andi $2, $1, 255
717 %load = load atomic i8, ptr %ptr seq_cst, align 1
718 %zext = zext i8 %load to i32
722 define i16 @atomic_load_seq_cst_i8_zext_i16(ptr %ptr) {
723 ; MIPS32-LABEL: atomic_load_seq_cst_i8_zext_i16:
725 ; MIPS32-NEXT: lbu $1, 0($4)
727 ; MIPS32-NEXT: jr $ra
728 ; MIPS32-NEXT: andi $2, $1, 255
729 %load = load atomic i8, ptr %ptr seq_cst, align 1
730 %zext = zext i8 %load to i16
734 define i64 @atomic_load_seq_cst_i8_zext_i64(ptr %ptr) {
735 ; MIPS32-LABEL: atomic_load_seq_cst_i8_zext_i64:
737 ; MIPS32-NEXT: lbu $1, 0($4)
739 ; MIPS32-NEXT: andi $2, $1, 255
740 ; MIPS32-NEXT: jr $ra
741 ; MIPS32-NEXT: andi $3, $1, 0
742 %load = load atomic i8, ptr %ptr seq_cst, align 1
743 %zext = zext i8 %load to i64
747 define i16 @atomic_load_seq_cst_i16(ptr %ptr) {
748 ; MIPS32-LABEL: atomic_load_seq_cst_i16:
750 ; MIPS32-NEXT: lhu $2, 0($4)
752 ; MIPS32-NEXT: jr $ra
754 %load = load atomic i16, ptr %ptr seq_cst, align 2
758 define i32 @atomic_load_seq_cst_i16_sext_i32(ptr %ptr) {
759 ; MIPS32-LABEL: atomic_load_seq_cst_i16_sext_i32:
761 ; MIPS32-NEXT: lhu $1, 0($4)
763 ; MIPS32-NEXT: sll $1, $1, 16
764 ; MIPS32-NEXT: jr $ra
765 ; MIPS32-NEXT: sra $2, $1, 16
766 %load = load atomic i16, ptr %ptr seq_cst, align 2
767 %sext = sext i16 %load to i32
771 define i64 @atomic_load_seq_cst_i16_sext_i64(ptr %ptr) {
772 ; MIPS32-LABEL: atomic_load_seq_cst_i16_sext_i64:
774 ; MIPS32-NEXT: lhu $1, 0($4)
776 ; MIPS32-NEXT: sll $1, $1, 16
777 ; MIPS32-NEXT: sra $2, $1, 16
778 ; MIPS32-NEXT: jr $ra
779 ; MIPS32-NEXT: sra $3, $1, 31
780 %load = load atomic i16, ptr %ptr seq_cst, align 2
781 %sext = sext i16 %load to i64
785 define i32 @atomic_load_seq_cst_i16_zext_i32(ptr %ptr) {
786 ; MIPS32-LABEL: atomic_load_seq_cst_i16_zext_i32:
788 ; MIPS32-NEXT: lhu $1, 0($4)
790 ; MIPS32-NEXT: jr $ra
791 ; MIPS32-NEXT: andi $2, $1, 65535
792 %load = load atomic i16, ptr %ptr seq_cst, align 2
793 %zext = zext i16 %load to i32
797 define i64 @atomic_load_seq_cst_i16_zext_i64(ptr %ptr) {
798 ; MIPS32-LABEL: atomic_load_seq_cst_i16_zext_i64:
800 ; MIPS32-NEXT: lhu $1, 0($4)
802 ; MIPS32-NEXT: andi $2, $1, 65535
803 ; MIPS32-NEXT: jr $ra
804 ; MIPS32-NEXT: andi $3, $1, 0
805 %load = load atomic i16, ptr %ptr seq_cst, align 2
806 %zext = zext i16 %load to i64
810 define i32 @atomic_load_seq_cst_i32(ptr %ptr) {
811 ; MIPS32-LABEL: atomic_load_seq_cst_i32:
813 ; MIPS32-NEXT: lw $2, 0($4)
815 ; MIPS32-NEXT: jr $ra
817 %load = load atomic i32, ptr %ptr seq_cst, align 4
821 define i64 @atomic_load_seq_cst_i64(ptr %ptr) {
822 ; MIPS32-LABEL: atomic_load_seq_cst_i64:
824 ; MIPS32-NEXT: addiu $sp, $sp, -24
825 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
826 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
827 ; MIPS32-NEXT: .cfi_offset 31, -4
828 ; MIPS32-NEXT: jal __atomic_load_8
829 ; MIPS32-NEXT: ori $5, $zero, 5
830 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
831 ; MIPS32-NEXT: jr $ra
832 ; MIPS32-NEXT: addiu $sp, $sp, 24
833 %load = load atomic i64, ptr %ptr seq_cst, align 8
837 define float @atomic_load_seq_cst_f32(ptr %ptr) {
838 ; MIPS32-LABEL: atomic_load_seq_cst_f32:
840 ; MIPS32-NEXT: lwc1 $f0, 64($4)
842 ; MIPS32-NEXT: jr $ra
844 %gep = getelementptr inbounds float, ptr %ptr, i32 16
845 %load = load atomic float, ptr %gep seq_cst, align 4
849 define double @atomic_load_seq_cst_f64(ptr %ptr) {
850 ; MIPS32-LABEL: atomic_load_seq_cst_f64:
852 ; MIPS32-NEXT: addiu $sp, $sp, -24
853 ; MIPS32-NEXT: .cfi_def_cfa_offset 24
854 ; MIPS32-NEXT: sw $ra, 20($sp) # 4-byte Folded Spill
855 ; MIPS32-NEXT: .cfi_offset 31, -4
856 ; MIPS32-NEXT: ori $5, $zero, 5
857 ; MIPS32-NEXT: ori $1, $zero, 128
858 ; MIPS32-NEXT: jal __atomic_load_8
859 ; MIPS32-NEXT: addu $4, $4, $1
860 ; MIPS32-NEXT: mtc1 $2, $f0
861 ; MIPS32-NEXT: mtc1 $3, $f1
862 ; MIPS32-NEXT: lw $ra, 20($sp) # 4-byte Folded Reload
863 ; MIPS32-NEXT: jr $ra
864 ; MIPS32-NEXT: addiu $sp, $sp, 24
865 %gep = getelementptr inbounds double, ptr %ptr, i32 16
866 %load = load atomic double, ptr %gep seq_cst, align 8
870 define ptr @atomic_load_seq_cst_p0i8(ptr %ptr) {
871 ; MIPS32-LABEL: atomic_load_seq_cst_p0i8:
873 ; MIPS32-NEXT: lw $2, 64($4)
875 ; MIPS32-NEXT: jr $ra
877 %gep = getelementptr inbounds ptr, ptr %ptr, i32 16
878 %load = load atomic ptr, ptr %gep seq_cst, align 4