aarch64: Tweak post-RA handling of CONST_INT moves [PR98136]
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 30 Mar 2021 10:42:50 +0000 (11:42 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 30 Mar 2021 10:42:50 +0000 (11:42 +0100)
commit48c79f054bf435051c95ee093c45a0f8c9de5b4e
tree692221b7fef075bfaa38c430aab6a7eee79a35af
parentcc2fda1328ee69b92724d6b3cffb741f07d86047
aarch64: Tweak post-RA handling of CONST_INT moves [PR98136]

This PR is a regression caused by r8-5967, where we replaced
a call to aarch64_internal_mov_immediate in aarch64_add_offset
with a call to aarch64_force_temporary, which in turn uses the
normal emit_move_insn{,_1} routines.

The problem is that aarch64_add_offset can be called while
outputting a thunk, where we require all instructions to be
valid without splitting.  However, the move expanders were
not splitting CONST_INT moves themselves.

I think the right fix is to make the move expanders work
even in this scenario, rather than require callers to handle
it as a special case.

gcc/
PR target/98136
* config/aarch64/aarch64.md (mov<mode>): Pass multi-instruction
CONST_INTs to aarch64_expand_mov_immediate when called after RA.

gcc/testsuite/
PR target/98136
* g++.dg/pr98136.C: New test.
gcc/config/aarch64/aarch64.md
gcc/testsuite/g++.dg/pr98136.C [new file with mode: 0644]