amdgcn: align TImode registers
authorAndrew Stubbs <ams@codesourcery.com>
Thu, 10 Sep 2020 09:10:32 +0000 (10:10 +0100)
committerAndrew Stubbs <ams@codesourcery.com>
Fri, 11 Sep 2020 09:55:32 +0000 (10:55 +0100)
This prevents execution failures caused by partially overlapping input and
output registers.  This is the same solution already used for DImode.

gcc/ChangeLog:

* config/gcn/gcn.c (gcn_hard_regno_mode_ok): Align TImode registers.
* config/gcn/gcn.md: Assert that TImode registers do not early clobber.

gcc/config/gcn/gcn.c
gcc/config/gcn/gcn.md

index 8b3c4544dd536ad0ec17290d2d3b65df99eeb84e..84d1fd9a35428e131b8b5efca904cf056b327222 100644 (file)
@@ -475,7 +475,8 @@ gcn_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
     return (vgpr_1reg_mode_p (mode)
            || (!((regno - FIRST_VGPR_REG) & 1) && vgpr_2reg_mode_p (mode))
            /* TImode is used by DImode compare_and_swap.  */
-           || mode == TImode);
+           || (mode == TImode
+               && !((regno - FIRST_VGPR_REG) & 3)));
   return false;
 }
 
index aeb25fbb931114376d3d640c45f99beadcb37e9f..0e73fea93cfe84fa964b03b4606f38182dc5780b 100644 (file)
    (set (match_dup 4) (match_dup 5))
    (set (match_dup 6) (match_dup 7))]
   {
+    gcc_assert (rtx_equal_p (operands[0], operands[1])
+               || !reg_overlap_mentioned_p (operands[0], operands[1]));
     operands[6] = gcn_operand_part (TImode, operands[0], 3);
     operands[7] = gcn_operand_part (TImode, operands[1], 3);
     operands[4] = gcn_operand_part (TImode, operands[0], 2);