Ensure emit_move_insn operands are valid

Some architectures are fine with PLUS in move instructions, but others
are not (amdgcn is the motivating example).

2021-05-07  Jakub Jelinek  <jakub@redhat.com>
	    Andrew Stubbs  <amd@codesourcery.com>

gcc/ChangeLog:

	PR target/100418
	* builtins.c (try_store_by_multiple_pieces): Use force_operand for
	emit_move_insn operands.
This commit is contained in:
Andrew Stubbs 2021-05-07 15:31:05 +01:00
parent a87ceadf17
commit 07d7d37d1a

View file

@ -6775,9 +6775,10 @@ try_store_by_multiple_pieces (rtx to, rtx len, unsigned int ctz_len,
/* Adjust PTR, TO and REM. Since TO's address is likely
PTR+offset, we have to replace it. */
emit_move_insn (ptr, XEXP (to, 0));
emit_move_insn (ptr, force_operand (XEXP (to, 0), NULL_RTX));
to = replace_equiv_address (to, ptr);
emit_move_insn (rem, plus_constant (ptr_mode, rem, -blksize));
rtx rem_minus_blksize = plus_constant (ptr_mode, rem, -blksize);
emit_move_insn (rem, force_operand (rem_minus_blksize, NULL_RTX));
}
/* Iterate over power-of-two block sizes from the maximum length to
@ -6811,9 +6812,10 @@ try_store_by_multiple_pieces (rtx to, rtx len, unsigned int ctz_len,
/* Adjust REM and PTR, unless this is the last iteration. */
if (i != sctz_len)
{
emit_move_insn (ptr, XEXP (to, 0));
emit_move_insn (ptr, force_operand (XEXP (to, 0), NULL_RTX));
to = replace_equiv_address (to, ptr);
emit_move_insn (rem, plus_constant (ptr_mode, rem, -blksize));
rtx rem_minus_blksize = plus_constant (ptr_mode, rem, -blksize);
emit_move_insn (rem, force_operand (rem_minus_blksize, NULL_RTX));
}
if (label)