[PATCH] gas: Emit A2 encoding for ARM PUSH/POP with single register

Meador Inge meadori@codesourcery.com
Mon Apr 2 16:25:00 GMT 2012

On 04/02/2012 09:39 AM, Richard Earnshaw wrote:

> In ARM state, stmfd sp!, {<single-reg>} is not 'push' and should
> continue to assemble to an stmfd instruction (otherwise there's no way
> to generate that bit pattern).  Similarly for ldmfd.   Only push and pop
> should be folded in this way.

Hmmm, I see now.  In the ARMARM it says that STMFD should only be treated as
PUSH if the number of registers is greater than or equal to two (8.8.201).  Is
that how you arrived at the above?  I got tripped up by the "Equivalent STM
syntax" statement in 8.8.133.

> Secondly, your use of r0 in the tests is insufficient.  r0 is all-bits
> zero in the register specifier, so you fail to test that the register
> bits are inserted correctly into bit pattern.  I suggest you _add_ tests
> using r9 in the register list.

Good point.  I will add more tests.

Thanks for the review.  v3 patch coming soon.

Meador Inge
CodeSourcery / Mentor Embedded

More information about the Binutils mailing list