1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -run-pass regallocfast %s -o - | FileCheck %s
4 # This test examines register allocation and spilling with Fast Register
5 # Allocator. The test uses inline assembler that requests an input variable to
6 # be loaded in a high register but at the same time has r12 marked as clobbered.
7 # The allocator initially satisfies the load request by selecting r12 but then
8 # needs to spill this register when it reaches the INLINEASM instruction and
9 # notices its clobber definition.
11 # The test checks that the compiler is able to spill a register from the hGPR
12 # class in Thumb2 by inserting the t2STRi12/t2LDRi12 instructions.
15 ; ModuleID = 'test.ll'
16 source_filename = "test.c"
17 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
18 target triple = "thumbv7m-none-unknown-eabi"
20 define dso_local void @constraint_h() {
22 %i = alloca i32, align 4
23 %0 = load i32, ptr %i, align 4
24 call void asm sideeffect "@ $0", "h,~{r12}"(i32 %0)
31 tracksRegLiveness: true
33 - { id: 0, class: hgpr }
34 - { id: 1, class: tgpr }
36 - { id: 0, name: i, size: 4, alignment: 4, stack-id: default, local-offset: -4 }
39 ; CHECK-LABEL: name: constraint_h
40 ; CHECK: renamable $r0 = tLDRspi %stack.0.i, 0, 14 /* CC::al */, $noreg :: (dereferenceable load (s32) from %ir.i)
41 ; CHECK: renamable $r8 = COPY killed renamable $r0
42 ; CHECK: INLINEASM &"@ $0", 1 /* sideeffect attdialect */, 589833 /* reguse:GPRnopc */, killed renamable $r8, 12 /* clobber */, implicit-def dead early-clobber $r12
43 ; CHECK: tBX_RET 14 /* CC::al */, $noreg
44 %1:tgpr = tLDRspi %stack.0.i, 0, 14, $noreg :: (dereferenceable load (s32) from %ir.i)
46 INLINEASM &"@ $0", 1, 589833, %0, 12, implicit-def early-clobber $r12