From 8bb5a861a0efae6b9c8f07936ad9bb3508ada23e Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Wed, 7 Sep 2011 21:41:25 +0000 Subject: [PATCH] Thumb2 assembly parsing and encoding for LDRB(immediate). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139258 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMInstrThumb2.td | 10 +++++++--- test/MC/ARM/basic-thumb2-instructions.s | 16 ++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/lib/Target/ARM/ARMInstrThumb2.td b/lib/Target/ARM/ARMInstrThumb2.td index 71bea1f507c..e2b16d85347 100644 --- a/lib/Target/ARM/ARMInstrThumb2.td +++ b/lib/Target/ARM/ARMInstrThumb2.td @@ -3702,6 +3702,10 @@ def : InstAlias<"dmb", (t2DMB 0xf)>, Requires<[IsThumb2, HasDB]>; def : InstAlias<"dsb", (t2DSB 0xf)>, Requires<[IsThumb2, HasDB]>; def : InstAlias<"isb", (t2ISB 0xf)>, Requires<[IsThumb2, HasDB]>; -// Alias for LDRi12 without the ".w" optional width specifier. -def : t2InstAlias<"ldr${p} $Rd, $addr", - (t2LDRi12 GPR:$Rd, t2addrmode_imm12:$addr, pred:$p)>; +// Alias for LDR, LDRB, LDRH without the ".w" optional width specifier. +def : t2InstAlias<"ldr${p} $Rt, $addr", + (t2LDRi12 GPR:$Rt, t2addrmode_imm12:$addr, pred:$p)>; +def : t2InstAlias<"ldrb${p} $Rt, $addr", + (t2LDRBi12 rGPR:$Rt, t2addrmode_imm12:$addr, pred:$p)>; +def : t2InstAlias<"ldrh${p} $Rt, $addr", + (t2LDRHi12 rGPR:$Rt, t2addrmode_imm12:$addr, pred:$p)>; diff --git a/test/MC/ARM/basic-thumb2-instructions.s b/test/MC/ARM/basic-thumb2-instructions.s index 40c152d3479..d23b565540e 100644 --- a/test/MC/ARM/basic-thumb2-instructions.s +++ b/test/MC/ARM/basic-thumb2-instructions.s @@ -540,6 +540,22 @@ _func: @------------------------------------------------------------------------------ +@ LDRB(immediate) +@------------------------------------------------------------------------------ + ldrb r5, [r5, #-4] + ldrb r5, [r6, #32] + ldrb r5, [r6, #33] + ldrb r5, [r6, #257] + ldrb.w lr, [r7, #257] + +@ CHECK: ldrb r5, [r5, #-4] @ encoding: [0x15,0xf8,0x04,0x5c] +@ CHECK: ldrb.w r5, [r6, #32] @ encoding: [0x96,0xf8,0x20,0x50] +@ CHECK: ldrb.w r5, [r6, #33] @ encoding: [0x96,0xf8,0x21,0x50] +@ CHECK: ldrb.w r5, [r6, #257] @ encoding: [0x96,0xf8,0x01,0x51] +@ CHECK: ldrb.w lr, [r7, #257] @ encoding: [0x97,0xf8,0x01,0xe1] + + +@------------------------------------------------------------------------------ @ IT @------------------------------------------------------------------------------ @ Test encodings of a few full IT blocks, not just the IT instruction -- 2.11.0