]> git.ipfire.org Git - thirdparty/gcc.git/commit
arm: Use POP {pc} to return when returning [PR118089]
authorRichard Earnshaw <rearnsha@arm.com>
Thu, 19 Dec 2024 16:00:48 +0000 (16:00 +0000)
committerRichard Earnshaw <rearnsha@arm.com>
Wed, 5 Feb 2025 11:51:41 +0000 (11:51 +0000)
commit5163cf2ae14c5e7ec730ad72680564001d0d0441
tree9f1b9c64e55f51b50dde2e67dedd8ab354dcddbf
parentb47c7a5a3c8280ea64754a6c24582236eacef8a2
arm: Use POP {pc} to return when returning [PR118089]

When generating thumb2 code,
LDM SP!, {PC}
is a two-byte instruction, whereas
LDR PC, [SP], #4
is needs 4 bytes.  When optimizing for size, or when there's no obvious
performance benefit prefer the former.

gcc/ChangeLog:

PR target/118089
* config/arm/arm.cc (thumb2_expand_return): Use LDM SP!, {PC}
when optimizing for size, or when there's no performance benefit over
LDR PC, [SP], #4.
(arm_expand_epilogue): Likewise.
gcc/config/arm/arm.cc