From 642caea2c624aaeb492a112d60f419ee4d1a10c7 Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Fri, 16 Sep 2011 21:06:12 +0000 Subject: [PATCH] Thumb2 assembly parsing and encoding for STR(immediate). Add aliases for STRB/STRH while there. Tests forthcoming for those. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139942 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMInstrThumb2.td | 16 ++++++++++++++++ test/MC/ARM/basic-thumb2-instructions.s | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/lib/Target/ARM/ARMInstrThumb2.td b/lib/Target/ARM/ARMInstrThumb2.td index 4d15b0201dd..5ad65d76cf7 100644 --- a/lib/Target/ARM/ARMInstrThumb2.td +++ b/lib/Target/ARM/ARMInstrThumb2.td @@ -3864,3 +3864,19 @@ def : t2InstAlias<"usat${p} $Rd, $sat_imm, $Rn", // STM w/o the .w suffix. def : t2InstAlias<"stm${p} $Rn, $regs", (t2STMIA GPR:$Rn, pred:$p, reglist:$regs)>; + +// Alias for STR, STRB, and STRH without the ".w" optional +// width specifier. +def : t2InstAlias<"str${p} $Rt, $addr", + (t2STRi12 GPR:$Rt, t2addrmode_imm12:$addr, pred:$p)>; +def : t2InstAlias<"strb${p} $Rt, $addr", + (t2STRBi12 rGPR:$Rt, t2addrmode_imm12:$addr, pred:$p)>; +def : t2InstAlias<"strh${p} $Rt, $addr", + (t2STRHi12 rGPR:$Rt, t2addrmode_imm12:$addr, pred:$p)>; + +def : t2InstAlias<"str${p} $Rt, $addr", + (t2STRs GPR:$Rt, t2addrmode_so_reg:$addr, pred:$p)>; +def : t2InstAlias<"strb${p} $Rt, $addr", + (t2STRBs rGPR:$Rt, t2addrmode_so_reg:$addr, pred:$p)>; +def : t2InstAlias<"strh${p} $Rt, $addr", + (t2STRHs rGPR:$Rt, t2addrmode_so_reg:$addr, pred:$p)>; diff --git a/test/MC/ARM/basic-thumb2-instructions.s b/test/MC/ARM/basic-thumb2-instructions.s index 160ed80d3ae..3c64c7d8a27 100644 --- a/test/MC/ARM/basic-thumb2-instructions.s +++ b/test/MC/ARM/basic-thumb2-instructions.s @@ -2160,6 +2160,22 @@ _func: @ CHECK: stm.w r5!, {r3, r8} @ encoding: [0xa5,0xe8,0x08,0x01] +@------------------------------------------------------------------------------ +@ STR(immediate) +@------------------------------------------------------------------------------ + str r5, [r5, #-4] + str r5, [r6, #32] + str r5, [r6, #33] + str r5, [r6, #257] + str.w pc, [r7, #257] + +@ CHECK: str r5, [r5, #-4] @ encoding: [0x45,0xf8,0x04,0x5c] +@ CHECK: str r5, [r6, #32] @ encoding: [0x35,0x62] +@ CHECK: str.w r5, [r6, #33] @ encoding: [0xc6,0xf8,0x21,0x50] +@ CHECK: str.w r5, [r6, #257] @ encoding: [0xc6,0xf8,0x01,0x51] +@ CHECK: str.w pc, [r7, #257] @ encoding: [0xc7,0xf8,0x01,0xf1] + + @------------------------------------------------------------------------------ @ SUB (register) @------------------------------------------------------------------------------ -- 2.34.1