arm: fix incorrect assembly of stm{,ia} as push [PR32363]

PR/32363.

Gas was incorrectly translating
	stm sp!, {regs}
into
	push {regs}
but this is invalid.  Conversely, it was also failing to translate
	stmfd sp!, {lowregs[, lr]}
into a 16-bit push instruction.  Fortunately stmia SP! is unlikely to be
a common idiom on a full-descending stack as it writes values to the stack,
then immediately deallocates that bit of the stack.

Fixed this and cleaned up the logic somewhat.  While there, change some of
the ordering so that "ldm base, {base}" is transformed preferentially to
LDR.  This is in keeping with the general preference in the Arm ARM for
avoiding single register LDM instructions.
3 files changed