llvm.org GIT mirror llvm / 6253ba4
[ARM] ldr pc,=expression should be allowed in Thumb2 This change allows the pc to be used as a destination register for the pseudo instruction LDR pc,=expression . The pseudo instruction must not be transformed into a MOV, but it can use the Thumb2 LDR (literal) instruction to a constant pool entry. See (A7.7.43 from ARMv7M ARM ARM). Differential Revision: https://reviews.llvm.org/D34751 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307640 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Smith 3 years ago
2 changed file(s) with 9 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
47984798 // Pseudo instruction ldr Rt, =immediate
47994799 def t2LDRConstPool
48004800 : t2AsmPseudo<"ldr${p} $Rt, $immediate",
4801 (ins GPRnopc:$Rt, const_pool_asm_imm:$immediate, pred:$p)>;
4801 (ins GPR:$Rt, const_pool_asm_imm:$immediate, pred:$p)>;
48024802 // Version w/ the .w suffix.
48034803 def : t2InstAlias<"ldr${p}.w $Rt, $immediate",
48044804 (t2LDRConstPool GPRnopc:$Rt,
0 @RUN: llvm-mc -triple armv5-unknown-linux-gnueabi %s | FileCheck --check-prefix=CHECK-ARM %s
1 @RUN: not llvm-mc -triple thumbv7-unknown-linux-gnueabi %s 2>&1 | FileCheck --check-prefix=CHECK-SP %s
1 @RUN: llvm-mc -triple thumbv7-unknown-linux-gnueabi %s 2>&1 | FileCheck --check-prefix=CHECK-T2 %s
22 @RUN: not llvm-mc -triple thumbv5-unknown-linux-gnueabi %s 2>&1 | FileCheck --check-prefix=CHECK-NONE %s
33 @RUN: llvm-mc -triple armv5-base-apple-darwin %s | FileCheck --check-prefix=CHECK-DARWIN-ARM %s
4 @RUN: not llvm-mc -triple thumbv7-base-apple-darwin %s 2>&1 | FileCheck --check-prefix=CHECK-DARWIN-SP %s
4 @RUN: llvm-mc -triple thumbv7-base-apple-darwin %s 2>&1 | FileCheck --check-prefix=CHECK-DARWIN-T2 %s
55 @RUN: not llvm-mc -triple thumbv5-base.apple.darwin %s 2>&1 | FileCheck --check-prefix=CHECK-NONE %s
66
77 @ We dont't do the transformation for rt = sp or pc
99 ldr pc, = 0x4
1010 @ CHECK-ARM: ldr pc, .Ltmp[[TMP0:[0-9]+]]
1111 @ CHECK-DARWIN-ARM: ldr pc, Ltmp0
12 @ CHECK-SP: error: instruction requires: arm-mode
13 @ CHECK-DARWIN-SP: error: instruction requires: arm-mode
14 @ CHECK-NONE: error: instruction requires: arm-mode
12 @ CHECK-T2: ldr.w pc, .Ltmp[[TMP0:[0-9]+]]
13 @ CHECK-DARWIN-T2: ldr.w pc, Ltmp0
14 @ CHECK-NONE: error: instruction requires: thumb2
1515 ldr sp, = 0x8
1616 @ CHECK-ARM: ldr sp, .Ltmp[[TMP1:[0-9]+]]
1717 @ CHECK-DARWIN-ARM: ldr sp, Ltmp1
18 @ CHECK-SP: ldr.w sp, .Ltmp[[TMP0:[0-9]+]]
19 @ CHECK-DARWIN-SP: ldr.w sp, Ltmp0
20 @ CHECK-NONE: error: instruction requires: arm-mode
18 @ CHECK-T2: ldr.w sp, .Ltmp[[TMP1:[0-9]+]]
19 @ CHECK-DARWIN-T2: ldr.w sp, Ltmp1
20 @ CHECK-NONE: error: instruction requires: thumb2