1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -run-pass=prologepilog %s -o - | FileCheck %s
5 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
6 target triple = "thumbv7m-none-eabi"
8 define i32 @testpos() {
10 %a = alloca i32, align 4
11 call void @other(ptr %a)
12 %b = load i32, ptr %a, align 4
15 define i32 @testneg4() {
17 %a = alloca i32, align 4
18 call void @other(ptr %a)
19 %b = load i32, ptr %a, align 4
22 define i32 @testneg8() {
24 %a = alloca i32, align 4
25 call void @other(ptr %a)
26 %b = load i32, ptr %a, align 4
30 declare void @other(ptr)
35 tracksRegLiveness: true
37 isFrameAddressTaken: false
38 isReturnAddressTaken: false
48 cvBytesOfCalleeSavedRegisters: 0
49 hasOpaqueSPAdjustment: false
51 hasMustTailInVarArgFunc: false
57 - { id: 0, name: a, type: default, offset: 0, size: 4, alignment: 4,
58 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
59 local-offset: -4, debug-info-variable: '', debug-info-expression: '',
60 debug-info-location: '' }
63 ; CHECK-LABEL: name: testpos
64 ; CHECK: liveins: $r7, $lr
66 ; CHECK-NEXT: $sp = frame-setup t2STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r7, killed $lr
67 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
68 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
69 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $r7, -8
70 ; CHECK-NEXT: $sp = frame-setup tSUBspi $sp, 2, 14 /* CC::al */, $noreg
71 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
72 ; CHECK-NEXT: renamable $r0 = t2ADDri $sp, 4, 14 /* CC::al */, $noreg, $noreg
73 ; CHECK-NEXT: tBL 14 /* CC::al */, $noreg, @other, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp
74 ; CHECK-NEXT: renamable $r0 = t2LDRi12 $sp, 8, 14 /* CC::al */, $noreg :: (dereferenceable load (s32) from %ir.a)
75 ; CHECK-NEXT: $sp = frame-destroy tADDspi $sp, 2, 14 /* CC::al */, $noreg
76 ; CHECK-NEXT: $sp = frame-destroy t2LDMIA_RET $sp, 14 /* CC::al */, $noreg, def $r7, def $pc, implicit $r0
77 ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def dead $sp, implicit $sp
78 renamable $r0 = t2ADDri %stack.0.a, 0, 14 /* CC::al */, $noreg, $noreg
79 tBL 14 /* CC::al */, $noreg, @other, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp
80 ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def dead $sp, implicit $sp
81 renamable $r0 = t2LDRi12 %stack.0.a, 4, 14 /* CC::al */, $noreg :: (dereferenceable load (s32) from %ir.a)
82 tBX_RET 14 /* CC::al */, $noreg, implicit $r0
87 tracksRegLiveness: true
89 isFrameAddressTaken: false
90 isReturnAddressTaken: false
100 cvBytesOfCalleeSavedRegisters: 0
101 hasOpaqueSPAdjustment: false
103 hasMustTailInVarArgFunc: false
109 - { id: 0, name: a, type: default, offset: 0, size: 4, alignment: 4,
110 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
111 local-offset: -4, debug-info-variable: '', debug-info-expression: '',
112 debug-info-location: '' }
115 ; CHECK-LABEL: name: testneg4
116 ; CHECK: liveins: $r7, $lr
118 ; CHECK-NEXT: $sp = frame-setup t2STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r7, killed $lr
119 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
120 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
121 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $r7, -8
122 ; CHECK-NEXT: $sp = frame-setup tSUBspi $sp, 2, 14 /* CC::al */, $noreg
123 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
124 ; CHECK-NEXT: renamable $r0 = t2ADDri $sp, 4, 14 /* CC::al */, $noreg, $noreg
125 ; CHECK-NEXT: tBL 14 /* CC::al */, $noreg, @other, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp
126 ; CHECK-NEXT: renamable $r0 = t2LDRi12 $sp, 0, 14 /* CC::al */, $noreg :: (dereferenceable load (s32) from %ir.a)
127 ; CHECK-NEXT: $sp = frame-destroy tADDspi $sp, 2, 14 /* CC::al */, $noreg
128 ; CHECK-NEXT: $sp = frame-destroy t2LDMIA_RET $sp, 14 /* CC::al */, $noreg, def $r7, def $pc, implicit $r0
129 ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def dead $sp, implicit $sp
130 renamable $r0 = t2ADDri %stack.0.a, 0, 14 /* CC::al */, $noreg, $noreg
131 tBL 14 /* CC::al */, $noreg, @other, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp
132 ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def dead $sp, implicit $sp
133 renamable $r0 = t2LDRi8 %stack.0.a, -4, 14 /* CC::al */, $noreg :: (dereferenceable load (s32) from %ir.a)
134 tBX_RET 14 /* CC::al */, $noreg, implicit $r0
139 tracksRegLiveness: true
141 isFrameAddressTaken: false
142 isReturnAddressTaken: false
152 cvBytesOfCalleeSavedRegisters: 0
153 hasOpaqueSPAdjustment: false
155 hasMustTailInVarArgFunc: false
161 - { id: 0, name: a, type: default, offset: 0, size: 4, alignment: 4,
162 stack-id: default, callee-saved-register: '', callee-saved-restored: true,
163 local-offset: -4, debug-info-variable: '', debug-info-expression: '',
164 debug-info-location: '' }
167 ; CHECK-LABEL: name: testneg8
168 ; CHECK: liveins: $r7, $lr
170 ; CHECK-NEXT: $sp = frame-setup t2STMDB_UPD $sp, 14 /* CC::al */, $noreg, killed $r7, killed $lr
171 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 8
172 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $lr, -4
173 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION offset $r7, -8
174 ; CHECK-NEXT: $sp = frame-setup tSUBspi $sp, 2, 14 /* CC::al */, $noreg
175 ; CHECK-NEXT: frame-setup CFI_INSTRUCTION def_cfa_offset 16
176 ; CHECK-NEXT: renamable $r0 = t2ADDri $sp, 4, 14 /* CC::al */, $noreg, $noreg
177 ; CHECK-NEXT: tBL 14 /* CC::al */, $noreg, @other, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp
178 ; CHECK-NEXT: renamable $r0 = t2LDRi8 $sp, -4, 14 /* CC::al */, $noreg :: (dereferenceable load (s32) from %ir.a)
179 ; CHECK-NEXT: $sp = frame-destroy tADDspi $sp, 2, 14 /* CC::al */, $noreg
180 ; CHECK-NEXT: $sp = frame-destroy t2LDMIA_RET $sp, 14 /* CC::al */, $noreg, def $r7, def $pc, implicit $r0
181 ADJCALLSTACKDOWN 0, 0, 14 /* CC::al */, $noreg, implicit-def dead $sp, implicit $sp
182 renamable $r0 = t2ADDri %stack.0.a, 0, 14 /* CC::al */, $noreg, $noreg
183 tBL 14 /* CC::al */, $noreg, @other, csr_aapcs, implicit-def dead $lr, implicit $sp, implicit $r0, implicit-def $sp
184 ADJCALLSTACKUP 0, -1, 14 /* CC::al */, $noreg, implicit-def dead $sp, implicit $sp
185 renamable $r0 = t2LDRi8 %stack.0.a, -8, 14 /* CC::al */, $noreg :: (dereferenceable load (s32) from %ir.a)
186 tBX_RET 14 /* CC::al */, $noreg, implicit $r0