From: Jim Grosbach Date: Tue, 11 Feb 2014 20:48:39 +0000 (+0000) Subject: ARM: Thumb2 LDR(literal) can target SP. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0c2ff8cbfd13804ae7a965960a35c51ac7fb4a0d;p=oota-llvm.git ARM: Thumb2 LDR(literal) can target SP. Fix a slightly overzealous destination register restriction for the 'without .w' alias. Add some explicit testcases. rdar://16033140 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201173 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/ARM/ARMInstrThumb2.td b/lib/Target/ARM/ARMInstrThumb2.td index dd53ff6ccf0..e0bed42051d 100644 --- a/lib/Target/ARM/ARMInstrThumb2.td +++ b/lib/Target/ARM/ARMInstrThumb2.td @@ -4365,7 +4365,7 @@ def : t2InstAlias<"ldrsh${p} $Rt, $addr", (t2LDRSHs rGPR:$Rt, t2addrmode_so_reg:$addr, pred:$p)>; def : t2InstAlias<"ldr${p} $Rt, $addr", - (t2LDRpci rGPR:$Rt, t2ldrlabel:$addr, pred:$p)>; + (t2LDRpci GPRnopc:$Rt, t2ldrlabel:$addr, pred:$p)>; def : t2InstAlias<"ldrb${p} $Rt, $addr", (t2LDRBpci rGPR:$Rt, t2ldrlabel:$addr, pred:$p)>; def : t2InstAlias<"ldrh${p} $Rt, $addr", diff --git a/test/MC/ARM/basic-thumb2-instructions.s b/test/MC/ARM/basic-thumb2-instructions.s index 3a5f48832c1..d1f7c449cee 100644 --- a/test/MC/ARM/basic-thumb2-instructions.s +++ b/test/MC/ARM/basic-thumb2-instructions.s @@ -800,11 +800,14 @@ _func: @------------------------------------------------------------------------------ ldr.w r5, _foo ldr lr, (_strcmp-4) + ldr sp, _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 @ CHECK: ldr.w lr, _strcmp-4 @ encoding: [0x5f'A',0xf8'A',A,0xe0'A'] @ CHECK: @ fixup A - offset: 0, value: _strcmp-4, kind: fixup_t2_ldst_pcrel_12 +@ 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 ldr r7, [pc, #8] ldr.n r7, [pc, #8] @@ -818,6 +821,7 @@ _func: ldr r8, [pc, #132] ldr pc, [pc, #256] ldr pc, [pc, #-400] + ldr sp, [pc, #4] @ CHECK: ldr r7, [pc, #8] @ encoding: [0x02,0x4f] @ CHECK: ldr r7, [pc, #8] @ encoding: [0x02,0x4f] @@ -831,6 +835,7 @@ _func: @ CHECK: ldr.w r8, [pc, #132] @ encoding: [0xdf,0xf8,0x84,0x80] @ CHECK: ldr.w pc, [pc, #256] @ encoding: [0xdf,0xf8,0x00,0xf1] @ CHECK: ldr.w pc, [pc, #-400] @ encoding: [0x5f,0xf8,0x90,0xf1] +@ CHECK: ldr.w sp, [pc, #4] @ encoding: [0xdf,0xf8,0x04,0xd0] ldrb r9, [pc, #-0] ldrsb r11, [pc, #-0]