This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [Patch, ARM, GAS] Fix single-reg LDM/STM to LDR/STR translation.
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Tejas Belagod <tejas dot belagod at arm dot com>
- Cc: binutils at sourceware dot org
- Date: Fri, 17 Sep 2010 14:59:41 +0100
- Subject: Re: [Patch, ARM, GAS] Fix single-reg LDM/STM to LDR/STR translation.
- References: <1284717984.2234.100.camel@e102484-lin.cambridge.arm.com>
On Fri, 2010-09-17 at 11:06 +0100, Tejas Belagod wrote:
> Hi,
>
> The attached patch fixes the translation of single-register LDM/STM. For
> instruction like:
> STMIA sp, {r1}
> this patch chooses to encode this as
> STR r1, [sp, #0]
> which can fit into a 16-bit thumb encoding. This is in line with what
> the ARM ARM has to say about choosing encodings for STM:
>
> "Encoding T2 does not support a list containing only one register. If an
> STM instruction with just one register <Rt> in the list is assembled to
> Thumb and encoding T1 is not available, it is assembled to the
> equivalent STR<c><q> <Rt>,[<Rn>]{,#4} instruction"
>
> For LDM/STM with single-register list that can't fit into 16-bit
> encoding after translation to STR/LDR, 32-bit encoding is used. Care
> also has been taken to record UNPREDICTABLE errors where necessary.
>
> Tested with arm-none-eabi. OK?
>
> --
> Tejas Belagod
> ARM.
>
> Changelog:
>
> gas/
>
> 2010-09-17 Tejas Belagod <tejas.belagod@arm.com>
>
> * config/tc-arm.c (do_t_ldmstm): Add logic to handle
> single-register list for ldm/stm.
>
> gas/testsuite
>
> 2010-09-17 Tejas Belagod <tejas.belagod@arm.com>
>
> * gas/arm/thumb2_ldmstm.d: Change single-register stmia to use
> 16-bit str encoding instead of str.w. Likewise for ldmia.
> * gas/arm/thumb2_ldmstm.s: Change stmia comment. Add tests for
> T1 ldmia-to-ldr.
This is OK.
R.