]> git.ipfire.org Git - thirdparty/gcc.git/commit
xtensa: Define TARGET_DIFFERENT_ADDR_DISPLACEMENT_P target hook
authorTakayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
Wed, 23 Oct 2024 02:31:15 +0000 (11:31 +0900)
committerMax Filippov <jcmvbkbc@gmail.com>
Sun, 27 Oct 2024 17:56:06 +0000 (10:56 -0700)
commit211459e12147e9ed42c0a0947b1b95b551e03ef3
tree92104ac657d295a3e929529362989400fcad4481
parentc246c4bcb353e8dc30e7e4d45dd27d982a21eab4
xtensa: Define TARGET_DIFFERENT_ADDR_DISPLACEMENT_P target hook

In commit bc5a9dab55d13f888a3cdd150c8cf5c2244f35e0 ("gcc: xtensa: reorder
movsi_internal patterns for better code generation during LRA"),  the
instruction order in "movsi_internal" MD definition was changed to make LRA
use load/store instructions with larger memory address displacements, but as
a side effect, it now uses the larger displacements (ie., the larger
instructions) even outside of reload operations.

The underlying problem is that LRA assumes by default that there is only one
maximal legitimate displacement for the same address structure, meaning that
it has no choice but to use the first load/store instruction it finds.

To fix this, define TARGET_DIFFERENT_ADDR_DISPLACEMENT_P hook to always
return true.

gcc/ChangeLog:

* config/xtensa/xtensa.cc (TARGET_DIFFERENT_ADDR_DISPLACEMENT_P):
Add new target hook to always return true.
* config/xtensa/xtensa.md (movsi_internal):
Revert the previous changes.
gcc/config/xtensa/xtensa.cc
gcc/config/xtensa/xtensa.md