Skip to content

Commit

Permalink
[ARM] Thumb2 LDR (literal) should accept PC as the destination
Browse files Browse the repository at this point in the history
The version of this instruction with the .w suffix already correctly accepts
this, but the alias without the .w did not.

Differential Revision: https://reviews.llvm.org/D26499



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286446 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
ostannard committed Nov 10, 2016
1 parent b2e86a3 commit 4a04eb0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Target/ARM/ARMInstrThumb2.td
Original file line number Diff line number Diff line change
Expand Up @@ -4407,7 +4407,7 @@ def : t2InstAlias<"ldrsh${p} $Rt, $addr",
(t2LDRSHs rGPR:$Rt, t2addrmode_so_reg:$addr, pred:$p)>;

def : t2InstAlias<"ldr${p} $Rt, $addr",
(t2LDRpci GPRnopc:$Rt, t2ldrlabel:$addr, pred:$p)>;
(t2LDRpci GPR:$Rt, t2ldrlabel:$addr, pred:$p)>;
def : t2InstAlias<"ldrb${p} $Rt, $addr",
(t2LDRBpci rGPR:$Rt, t2ldrlabel:$addr, pred:$p)>;
def : t2InstAlias<"ldrh${p} $Rt, $addr",
Expand Down
5 changes: 5 additions & 0 deletions test/MC/ARM/basic-thumb2-instructions.s
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,7 @@ _func:
ldr.w r5, _foo
ldr lr, (_strcmp-4)
ldr sp, _foo
ldr pc, _foo

@ CHECK: ldr.w r5, _foo @ encoding: [0x5f'A',0xf8'A',A,0x50'A']
@ CHECK: @ fixup A - offset: 0, value: _foo, kind: fixup_t2_ldst_pcrel_12
Expand All @@ -898,6 +899,10 @@ _func:
@ CHECK: ldr.w sp, _foo @ encoding: [0x5f'A',0xf8'A',A,0xd0'A']
@ CHECK: @ fixup A - offset: 0, value: _foo, kind: fixup_t2_ldst_pcrel_12
@ CHECK-BE: ldr.w sp, _foo @ encoding: [0xf8'A',0x5f'A',0xd0'A',A]
@ CHECK-BE: @ fixup A - offset: 0, value: _foo, kind: fixup_t2_ldst_pcrel_12
@ CHECK: ldr.w pc, _foo @ encoding: [0x5f'A',0xf8'A',A,0xf0'A']
@ CHECK: @ fixup A - offset: 0, value: _foo, kind: fixup_t2_ldst_pcrel_12
@ CHECK-BE: ldr.w pc, _foo @ encoding: [0xf8'A',0x5f'A',0xf0'A',A]
@ CHECK-BE: @ fixup A - offset: 0, value: _foo, kind: fixup_t2_ldst_pcrel_12

ldr r7, [pc, #8]
Expand Down

0 comments on commit 4a04eb0

Please sign in to comment.