]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Ensure emit_move_insn operands are valid
authorAndrew Stubbs <ams@codesourcery.com>
Fri, 7 May 2021 14:31:05 +0000 (15:31 +0100)
committerAndrew Stubbs <ams@codesourcery.com>
Fri, 7 May 2021 22:47:38 +0000 (23:47 +0100)
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.

gcc/builtins.c

index 6f67eb7eeb5588e99d1a149ccc8e5b8cf6e767a3..bc40bad54e763187fcb9a4e428faf648415e5cd2 100644 (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)