1 # RUN: llc -run-pass regallocfast %s -o - | FileCheck %s
3 # This test examines register allocation and spilling with Fast Register
4 # Allocator. The test uses inline assembler that requests an input variable to
5 # be loaded in a high register but at the same time has r12 marked as clobbered.
6 # The allocator initially satisfies the load request by selecting r12 but then
7 # needs to spill this register when it reaches the INLINEASM instruction and
8 # notices its clobber definition.
10 # The test checks that the compiler is able to spill a register from the hGPR
11 # class in Thumb2 by inserting the t2STRi12/t2LDRi12 instructions.
14 ; ModuleID = 'test.ll'
15 source_filename = "test.c"
16 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
17 target triple = "thumbv7m-none-unknown-eabi"
19 define dso_local void @constraint_h() {
21 %i = alloca i32, align 4
22 %0 = load i32, i32* %i, align 4
23 call void asm sideeffect "@ $0", "h,~{r12}"(i32 %0)
30 tracksRegLiveness: true
32 - { id: 0, class: hgpr }
33 - { id: 1, class: tgpr }
35 - { id: 0, name: i, size: 4, alignment: 4, stack-id: default, local-offset: -4 }
38 %1:tgpr = tLDRspi %stack.0.i, 0, 14, $noreg :: (dereferenceable load 4 from %ir.i)
40 INLINEASM &"@ $0", 1, 589833, %0, 12, implicit-def early-clobber $r12
45 # CHECK-NEXT: renamable $r0 = tLDRspi %stack.0.i, 0, 14, $noreg :: (dereferenceable load 4 from %ir.i)
46 # CHECK-NEXT: renamable $r12 = COPY killed renamable $r0
47 # CHECK-NEXT: t2STRi12 killed $r12, %stack.1, 0, 14, $noreg :: (store 4 into %stack.1)
48 # CHECK-NEXT: $r8 = t2LDRi12 %stack.1, 0, 14, $noreg :: (load 4 from %stack.1)
49 # CHECK-NEXT: INLINEASM &"@ $0", 1, 589833, renamable $r8, 12, implicit-def early-clobber $r12
50 # CHECK-NEXT: tBX_RET 14, $noreg