diff options
| author | Petr Pavlu <petr.pavlu@arm.com> | 2018-11-08 13:02:10 +0000 |
|---|---|---|
| committer | Petr Pavlu <petr.pavlu@arm.com> | 2018-11-08 13:02:10 +0000 |
| commit | 7c84b2e3abc95eb7b31e0cb7bf06df7c27f9c035 (patch) | |
| tree | fbd7dc43db94bd261a0eef26199829b7ebafa978 /llvm/test/CodeGen/Thumb2 | |
| parent | 54c2fa1202cafa98adbb5a8e58c591f3002f54c1 (diff) | |
| download | bcm5719-llvm-7c84b2e3abc95eb7b31e0cb7bf06df7c27f9c035.tar.gz bcm5719-llvm-7c84b2e3abc95eb7b31e0cb7bf06df7c27f9c035.zip | |
[ARM] Enable spilling of the hGPR register class in Thumb2
Generalize code in Thumb2InstrInfo::storeRegToStackSlot() and
loadRegToStackSlot() to allow the GPR class or any of its sub-classes
(including hGPR) to be stored/loaded by ARM::t2STRi12/ARM::t2LDRi12.
Differential Revision: https://reviews.llvm.org/D51927
llvm-svn: 346401
Diffstat (limited to 'llvm/test/CodeGen/Thumb2')
| -rw-r--r-- | llvm/test/CodeGen/Thumb2/high-reg-spill.mir | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/Thumb2/high-reg-spill.mir b/llvm/test/CodeGen/Thumb2/high-reg-spill.mir new file mode 100644 index 00000000000..d9bfdcafa38 --- /dev/null +++ b/llvm/test/CodeGen/Thumb2/high-reg-spill.mir @@ -0,0 +1,50 @@ +# RUN: llc -run-pass regallocfast %s -o - | FileCheck %s + +# This test examines register allocation and spilling with Fast Register +# Allocator. The test uses inline assembler that requests an input variable to +# be loaded in a high register but at the same time has r12 marked as clobbered. +# The allocator initially satisfies the load request by selecting r12 but then +# needs to spill this register when it reaches the INLINEASM instruction and +# notices its clobber definition. +# +# The test checks that the compiler is able to spill a register from the hGPR +# class in Thumb2 by inserting the t2STRi12/t2LDRi12 instructions. + +--- | + ; ModuleID = 'test.ll' + source_filename = "test.c" + target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" + target triple = "thumbv7m-none-unknown-eabi" + + define dso_local void @constraint_h() { + entry: + %i = alloca i32, align 4 + %0 = load i32, i32* %i, align 4 + call void asm sideeffect "@ $0", "h,~{r12}"(i32 %0) + ret void + } + +... +--- +name: constraint_h +tracksRegLiveness: true +registers: + - { id: 0, class: hgpr } + - { id: 1, class: tgpr } +stack: + - { id: 0, name: i, size: 4, alignment: 4, stack-id: 0, local-offset: -4 } +body: | + bb.0.entry: + %1:tgpr = tLDRspi %stack.0.i, 0, 14, $noreg :: (dereferenceable load 4 from %ir.i) + %0:hgpr = COPY %1 + INLINEASM &"@ $0", 1, 589833, %0, 12, implicit-def early-clobber $r12 + tBX_RET 14, $noreg + +... +# CHECK: bb.0.entry: +# CHECK-NEXT: renamable $r0 = tLDRspi %stack.0.i, 0, 14, $noreg :: (dereferenceable load 4 from %ir.i) +# CHECK-NEXT: renamable $r12 = COPY killed renamable $r0 +# CHECK-NEXT: t2STRi12 killed $r12, %stack.1, 0, 14, $noreg :: (store 4 into %stack.1) +# CHECK-NEXT: $r8 = t2LDRi12 %stack.1, 0, 14, $noreg :: (load 4 from %stack.1) +# CHECK-NEXT: INLINEASM &"@ $0", 1, 589833, killed renamable $r8, 12, implicit-def early-clobber $r12 +# CHECK-NEXT: tBX_RET 14, $noreg |

