1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=thumbv7m-none-eabi -run-pass=arm-cp-islands -o - %s | FileCheck %s
5 define ptr @test_simple(ptr %x, i32 %y) { ret ptr %x }
6 define ptr @test_notfirst(ptr %x, i32 %y) { ret ptr %x }
7 define ptr @test_redefined(ptr %x, i32 %y) { ret ptr %x }
8 define ptr @test_notredefined(ptr %x, i32 %y) { ret ptr %x }
9 define ptr @test_notcmp(ptr %x, i32 %y) { ret ptr %x }
10 define ptr @test_killflag_1(ptr %x, i32 %y) { ret ptr %x }
11 define ptr @test_killflag_2(ptr %x, i32 %y) { ret ptr %x }
12 define ptr @test_cpsr(ptr %x, i32 %y) { ret ptr %x }
14 declare dso_local i32 @c(i32 %x)
18 tracksRegLiveness: true
20 - { reg: '$r0', virtual-reg: '' }
21 - { reg: '$r1', virtual-reg: '' }
23 ; CHECK-LABEL: name: test_simple
25 ; CHECK: successors: %bb.2(0x30000000), %bb.1(0x50000000)
26 ; CHECK: liveins: $r0, $r1
27 ; CHECK: tCBZ renamable $r0, %bb.2
30 ; CHECK: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.x)
31 ; CHECK: tTAILJMPdND @c, 14 /* CC::al */, $noreg, implicit $sp, implicit $sp, implicit killed $r0
33 ; CHECK: $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
34 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
36 successors: %bb.1(0x30000000), %bb.2(0x50000000)
39 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
40 t2Bcc %bb.1, 0, killed $cpsr
45 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.x)
46 tTAILJMPdND @c, 14, $noreg, implicit $sp, implicit $sp, implicit killed $r0
49 $r0, dead $cpsr = tMOVi8 0, 14, $noreg
50 tBX_RET 14, $noreg, implicit killed $r0
55 tracksRegLiveness: true
57 - { reg: '$r0', virtual-reg: '' }
58 - { reg: '$r1', virtual-reg: '' }
60 ; CHECK-LABEL: name: test_notfirst
62 ; CHECK: successors: %bb.2(0x30000000), %bb.1(0x50000000)
63 ; CHECK: liveins: $r0, $r1
64 ; CHECK: renamable $r0, $cpsr = tADDrr killed renamable $r0, renamable $r1, 14 /* CC::al */, $noreg
65 ; CHECK: renamable $r1 = t2ADDrs renamable $r0, killed renamable $r1, 18, 14 /* CC::al */, $noreg, $noreg
66 ; CHECK: tCBZ renamable $r0, %bb.2
69 ; CHECK: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.x)
70 ; CHECK: tTAILJMPdND @c, 14 /* CC::al */, $noreg, implicit $sp, implicit $sp, implicit killed $r0
72 ; CHECK: $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
73 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
75 successors: %bb.1(0x30000000), %bb.2(0x50000000)
78 renamable $r0, $cpsr = tADDrr killed renamable $r0, renamable $r1, 14, $noreg
79 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
80 renamable $r1 = t2ADDrs renamable $r0, killed renamable $r1, 18, 14, $noreg, $noreg
81 t2Bcc %bb.1, 0, killed $cpsr
86 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.x)
87 tTAILJMPdND @c, 14, $noreg, implicit $sp, implicit $sp, implicit killed $r0
90 $r0, dead $cpsr = tMOVi8 0, 14, $noreg
91 tBX_RET 14, $noreg, implicit killed $r0
96 tracksRegLiveness: true
98 - { reg: '$r0', virtual-reg: '' }
99 - { reg: '$r1', virtual-reg: '' }
101 ; CHECK-LABEL: name: test_redefined
103 ; CHECK: successors: %bb.2(0x30000000), %bb.1(0x50000000)
104 ; CHECK: liveins: $r0, $r1
105 ; CHECK: tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
106 ; CHECK: renamable $r0 = t2ADDrs killed renamable $r0, killed renamable $r1, 18, 14 /* CC::al */, $noreg, $noreg
107 ; CHECK: tBcc %bb.2, 0 /* CC::eq */, killed $cpsr
109 ; CHECK: liveins: $r0
110 ; CHECK: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.x)
111 ; CHECK: tTAILJMPdND @c, 14 /* CC::al */, $noreg, implicit $sp, implicit $sp, implicit killed $r0
113 ; CHECK: $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
114 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
116 successors: %bb.1(0x30000000), %bb.2(0x50000000)
119 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
120 renamable $r0 = t2ADDrs killed renamable $r0, killed renamable $r1, 18, 14, $noreg, $noreg
121 t2Bcc %bb.1, 0, killed $cpsr
126 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.x)
127 tTAILJMPdND @c, 14, $noreg, implicit $sp, implicit $sp, implicit killed $r0
130 $r0, dead $cpsr = tMOVi8 0, 14, $noreg
131 tBX_RET 14, $noreg, implicit killed $r0
135 name: test_notredefined
136 tracksRegLiveness: true
138 - { reg: '$r0', virtual-reg: '' }
139 - { reg: '$r1', virtual-reg: '' }
141 ; CHECK-LABEL: name: test_notredefined
143 ; CHECK: successors: %bb.2(0x30000000), %bb.1(0x50000000)
144 ; CHECK: liveins: $r0, $r1
145 ; CHECK: renamable $r1 = t2ADDrs renamable $r0, killed renamable $r1, 18, 14 /* CC::al */, $noreg, $noreg
146 ; CHECK: tCBZ renamable $r0, %bb.2
148 ; CHECK: liveins: $r0
149 ; CHECK: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.x)
150 ; CHECK: tTAILJMPdND @c, 14 /* CC::al */, $noreg, implicit $sp, implicit $sp, implicit killed $r0
152 ; CHECK: $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
153 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
155 successors: %bb.1(0x30000000), %bb.2(0x50000000)
158 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
159 renamable $r1 = t2ADDrs renamable $r0, killed renamable $r1, 18, 14, $noreg, $noreg
160 t2Bcc %bb.1, 0, killed $cpsr
165 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.x)
166 tTAILJMPdND @c, 14, $noreg, implicit $sp, implicit $sp, implicit killed $r0
169 $r0, dead $cpsr = tMOVi8 0, 14, $noreg
170 tBX_RET 14, $noreg, implicit killed $r0
175 tracksRegLiveness: true
177 - { reg: '$r0', virtual-reg: '' }
178 - { reg: '$r1', virtual-reg: '' }
180 ; CHECK-LABEL: name: test_notcmp
182 ; CHECK: successors: %bb.2(0x30000000), %bb.1(0x50000000)
183 ; CHECK: liveins: $r0, $r1
184 ; CHECK: tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
185 ; CHECK: renamable $r1, $cpsr = tADDrr renamable $r0, killed renamable $r1, 14 /* CC::al */, $noreg
186 ; CHECK: tBcc %bb.2, 0 /* CC::eq */, killed $cpsr
188 ; CHECK: liveins: $r0
189 ; CHECK: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.x)
190 ; CHECK: tTAILJMPdND @c, 14 /* CC::al */, $noreg, implicit $sp, implicit $sp, implicit killed $r0
192 ; CHECK: $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
193 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
195 successors: %bb.1(0x30000000), %bb.2(0x50000000)
198 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
199 renamable $r1, $cpsr = tADDrr renamable $r0, killed renamable $r1, 14, $noreg
200 t2Bcc %bb.1, 0, killed $cpsr
205 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.x)
206 tTAILJMPdND @c, 14, $noreg, implicit $sp, implicit $sp, implicit killed $r0
209 $r0, dead $cpsr = tMOVi8 0, 14, $noreg
210 tBX_RET 14, $noreg, implicit killed $r0
214 name: test_killflag_1
215 tracksRegLiveness: true
217 - { reg: '$r0', virtual-reg: '' }
218 - { reg: '$r1', virtual-reg: '' }
220 ; CHECK-LABEL: name: test_killflag_1
222 ; CHECK: successors: %bb.2(0x30000000), %bb.1(0x50000000)
223 ; CHECK: liveins: $r0, $r1
224 ; CHECK: renamable $r0 = t2ADDrs killed renamable $r0, killed renamable $r0, 18, 14 /* CC::al */, $noreg, $noreg
225 ; CHECK: tCBZ killed renamable $r1, %bb.2
227 ; CHECK: liveins: $r0
228 ; CHECK: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.x)
229 ; CHECK: tTAILJMPdND @c, 14 /* CC::al */, $noreg, implicit $sp, implicit $sp, implicit killed $r0
231 ; CHECK: $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
232 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
234 successors: %bb.1(0x30000000), %bb.2(0x50000000)
237 tCMPi8 killed renamable $r1, 0, 14, $noreg, implicit-def $cpsr
238 renamable $r0 = t2ADDrs killed renamable $r0, killed renamable $r0, 18, 14, $noreg, $noreg
239 t2Bcc %bb.1, 0, killed $cpsr
244 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.x)
245 tTAILJMPdND @c, 14, $noreg, implicit $sp, implicit $sp, implicit killed $r0
248 $r0, dead $cpsr = tMOVi8 0, 14, $noreg
249 tBX_RET 14, $noreg, implicit killed $r0
253 name: test_killflag_2
254 tracksRegLiveness: true
256 - { reg: '$r0', virtual-reg: '' }
257 - { reg: '$r1', virtual-reg: '' }
259 ; CHECK-LABEL: name: test_killflag_2
261 ; CHECK: successors: %bb.2(0x30000000), %bb.1(0x50000000)
262 ; CHECK: liveins: $r0, $r1
263 ; CHECK: renamable $r0 = t2ADDrs renamable $r1, killed renamable $r0, 18, 14 /* CC::al */, $noreg, $noreg
264 ; CHECK: tCBZ killed renamable $r1, %bb.2
266 ; CHECK: liveins: $r0
267 ; CHECK: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.x)
268 ; CHECK: tTAILJMPdND @c, 14 /* CC::al */, $noreg, implicit $sp, implicit $sp, implicit killed $r0
270 ; CHECK: $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
271 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
273 successors: %bb.1(0x30000000), %bb.2(0x50000000)
276 tCMPi8 renamable $r1, 0, 14, $noreg, implicit-def $cpsr
277 renamable $r0 = t2ADDrs killed renamable $r1, killed renamable $r0, 18, 14, $noreg, $noreg
278 t2Bcc %bb.1, 0, killed $cpsr
283 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.x)
284 tTAILJMPdND @c, 14, $noreg, implicit $sp, implicit $sp, implicit killed $r0
287 $r0, dead $cpsr = tMOVi8 0, 14, $noreg
288 tBX_RET 14, $noreg, implicit killed $r0
293 tracksRegLiveness: true
295 - { reg: '$r0', virtual-reg: '' }
296 - { reg: '$r1', virtual-reg: '' }
298 ; CHECK-LABEL: name: test_cpsr
300 ; CHECK: successors: %bb.2(0x30000000), %bb.1(0x50000000)
301 ; CHECK: liveins: $r0, $r1
302 ; CHECK: tCMPi8 renamable $r0, 0, 14 /* CC::al */, $noreg, implicit-def $cpsr
303 ; CHECK: t2IT 0, 8, implicit-def $itstate
304 ; CHECK: renamable $r1 = t2ADDri killed renamable $r1, 1, 1 /* CC::ne */, $cpsr, $noreg, implicit killed $itstate
305 ; CHECK: tBcc %bb.2, 0 /* CC::eq */, killed $cpsr
307 ; CHECK: liveins: $r0
308 ; CHECK: renamable $r0 = tLDRi killed renamable $r0, 0, 14 /* CC::al */, $noreg :: (load (s32) from %ir.x)
309 ; CHECK: tTAILJMPdND @c, 14 /* CC::al */, $noreg, implicit $sp, implicit $sp, implicit killed $r0
311 ; CHECK: $r0, dead $cpsr = tMOVi8 0, 14 /* CC::al */, $noreg
312 ; CHECK: tBX_RET 14 /* CC::al */, $noreg, implicit killed $r0
314 successors: %bb.1(0x30000000), %bb.2(0x50000000)
317 tCMPi8 renamable $r0, 0, 14, $noreg, implicit-def $cpsr
318 t2IT 0, 8, implicit-def $itstate
319 renamable $r1 = t2ADDri killed renamable $r1, 1, 1, $cpsr, $noreg, implicit killed $itstate
320 t2Bcc %bb.1, 0, killed $cpsr
325 renamable $r0 = tLDRi killed renamable $r0, 0, 14, $noreg :: (load (s32) from %ir.x)
326 tTAILJMPdND @c, 14, $noreg, implicit $sp, implicit $sp, implicit killed $r0
329 $r0, dead $cpsr = tMOVi8 0, 14, $noreg
330 tBX_RET 14, $noreg, implicit killed $r0