https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117711
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |ramana at gcc dot gnu.org,
| |rearnsha at gcc dot gnu.org,
| |rsandifo at gcc dot gnu.org,
| |wilco at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
mem = force_const_mem (ptr_mode, imm);
gcc_assert (mem);
/* If we aren't generating PC relative literals, then
we need to expand the literal pool access carefully.
This is something that needs to be done in a number
of places, so could well live as a separate function. */
if (!aarch64_pcrelative_literal_loads)
{
gcc_assert (can_create_pseudo_p ());
base = gen_reg_rtx (ptr_mode);
aarch64_expand_mov_immediate (base, XEXP (mem, 0));
if (ptr_mode != Pmode)
base = convert_memory_address (Pmode, base);
mem = gen_rtx_MEM (ptr_mode, base);
looks just weird to me.
Because force_const_mem always returns a MEM whose operand has Pmode, not
ptr_mode; either gen_rtx_SYMBOL_REF (Pmode, ...) or create_block_symbol.
So, I think it should be just
--- gcc/config/aarch64/aarch64.cc 2024-11-23 13:00:28.456026395 +0100
+++ gcc/config/aarch64/aarch64.cc 2024-11-26 13:03:54.222936662 +0100
@@ -6199,10 +6199,8 @@ aarch64_expand_mov_immediate (rtx dest,
if (!aarch64_pcrelative_literal_loads)
{
gcc_assert (can_create_pseudo_p ());
- base = gen_reg_rtx (ptr_mode);
+ base = gen_reg_rtx (Pmode);
aarch64_expand_mov_immediate (base, XEXP (mem, 0));
- if (ptr_mode != Pmode)
- base = convert_memory_address (Pmode, base);
mem = gen_rtx_MEM (ptr_mode, base);
}
In any case, I have no way to test this.
Note, the gen_reg_rtx (ptr_mode); part has been added in r6-3287 and the if
(ptr_mode != Pmode) part in r8-1673.
aarch64_expand_sve_ld1rq
uses
src = force_const_mem (GET_MODE (src), src);
if (!src)
return false;
/* Make sure that the address is legitimate. */
if (!aarch64_sve_ld1rq_operand_p (src))
{
rtx addr = force_reg (Pmode, XEXP (src, 0));
and so it already (correctly) relies on XEXP (force_const_mem (...), 0) having
Pmode.