During subreg1, we fail to split

(insn 4 3 5 2 (set (reg:TI 63 [ x ])
        (const_int 0 [0])) pr55941.c:2 85 {*movti_internal_rex64}
     (nil))

which leads to all the rest of the problems described in the PR.

This happens because we read the mode from the CONST_INT, and unsurprisingly VOIDmode does not match SCALAR_INT_MODE_P. Given that src and dest mode must match, it's just easier to take the mode from there.

This leads to all of the subregs being split during subreg1, and the rest of rtl passes clean things up exactly as we like.


r~
        PR target/55941
        * lower-subreg.c (simple_move): Check dest mode instead of src mode.


diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index 5bf6cc1..228d3a2 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -343,7 +343,7 @@ simple_move (rtx insn, bool speed_p)
      registers.  That means that we can't decompose if this is a
      non-integer mode for which there is no integer mode of the same
      size.  */
-  mode = GET_MODE (SET_SRC (set));
+  mode = GET_MODE (SET_DEST (set));
   if (!SCALAR_INT_MODE_P (mode)
       && (mode_for_size (GET_MODE_SIZE (mode) * BITS_PER_UNIT, MODE_INT, 0)
          == BLKmode))

Reply via email to