]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
arm: fix incorrect assembly of stm{,ia} as push [PR32363]
authorRichard Earnshaw <rearnsha@arm.com>
Fri, 20 Dec 2024 18:28:05 +0000 (18:28 +0000)
committerRichard Earnshaw <rearnsha@arm.com>
Fri, 20 Dec 2024 18:41:36 +0000 (18:41 +0000)
commit9edd0af148442f6192529b6edc9017f95ab404d8
tree25c78633ac876c57ec0dde9b807ab6f0b0a3f59d
parent602f66f5aba3b3871cef08306f9c3c2962992784
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.
gas/config/tc-arm.c
gas/testsuite/gas/arm/thumb2_ldmstm.d
gas/testsuite/gas/arm/thumb2_ldmstm.s