1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc --mtriple=loongarch64 --mattr=+f < %s | FileCheck %s
4 ;; This should not crash the code generator, but the indexed loads/stores
5 ;; should still be present (the important part is that [f]{ld,st}x shouldn't
6 ;; take an $sp argument).
8 define i8 @test_load_i(i64 %i) {
9 ; CHECK-LABEL: test_load_i:
11 ; CHECK-NEXT: addi.d $sp, $sp, -16
12 ; CHECK-NEXT: .cfi_def_cfa_offset 16
13 ; CHECK-NEXT: addi.d $a1, $sp, 8
14 ; CHECK-NEXT: ldx.b $a0, $a0, $a1
15 ; CHECK-NEXT: addi.d $sp, $sp, 16
18 %2 = getelementptr inbounds i8, ptr %1, i64 %i
23 define float @test_load_f(i64 %i) {
24 ; CHECK-LABEL: test_load_f:
26 ; CHECK-NEXT: addi.d $sp, $sp, -16
27 ; CHECK-NEXT: .cfi_def_cfa_offset 16
28 ; CHECK-NEXT: slli.d $a0, $a0, 2
29 ; CHECK-NEXT: addi.d $a1, $sp, 8
30 ; CHECK-NEXT: fldx.s $fa0, $a0, $a1
31 ; CHECK-NEXT: addi.d $sp, $sp, 16
34 %2 = getelementptr inbounds float, ptr %1, i64 %i
35 %3 = load float, ptr %2
39 define void @test_store_i(i64 %i, i8 %v) {
40 ; CHECK-LABEL: test_store_i:
42 ; CHECK-NEXT: addi.d $sp, $sp, -16
43 ; CHECK-NEXT: .cfi_def_cfa_offset 16
44 ; CHECK-NEXT: addi.d $a2, $sp, 8
45 ; CHECK-NEXT: stx.b $a1, $a0, $a2
46 ; CHECK-NEXT: addi.d $sp, $sp, 16
49 %2 = getelementptr inbounds i8, ptr %1, i64 %i
50 store i8 %v, ptr %2, align 1
54 define void @test_store_f(i64 %i, float %v) {
55 ; CHECK-LABEL: test_store_f:
57 ; CHECK-NEXT: addi.d $sp, $sp, -16
58 ; CHECK-NEXT: .cfi_def_cfa_offset 16
59 ; CHECK-NEXT: slli.d $a0, $a0, 2
60 ; CHECK-NEXT: addi.d $a1, $sp, 8
61 ; CHECK-NEXT: fstx.s $fa0, $a0, $a1
62 ; CHECK-NEXT: addi.d $sp, $sp, 16
65 %2 = getelementptr inbounds float, ptr %1, i64 %i
66 store float %v, ptr %2, align 4