https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89679

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The other variant would be perhaps more in line with the PR70574 change where
we don't add REG_EQUAL notes with paradoxical subregs in it, by:
--- gcc/expmed.c.jj     2019-01-10 11:43:14.387377695 +0100
+++ gcc/expmed.c        2019-03-12 17:38:55.286511666 +0100
@@ -3356,13 +3356,20 @@ expand_mult_const (machine_mode mode, rt
              tem = gen_lowpart (nmode, op0);
            }

-         insn = get_last_insn ();
-         wide_int wval_so_far
-           = wi::uhwi (val_so_far,
-                       GET_MODE_PRECISION (as_a <scalar_mode> (nmode)));
-         rtx c = immed_wide_int_const (wval_so_far, nmode);
-         set_dst_reg_note (insn, REG_EQUAL, gen_rtx_MULT (nmode, tem, c),
-                           accum_inner);
+         /* Don't add a REG_EQUAL note if tem is a paradoxical SUBREG.
+            In that case, only the low bits of accum would be guaranteed to
+            be equal to the content of the REG_EQUAL note, the upper bits
+            can be anything.  */
+         if (!paradoxical_subreg_p (tem))
+           {
+             insn = get_last_insn ();
+             wide_int wval_so_far
+               = wi::uhwi (val_so_far,
+                           GET_MODE_PRECISION (as_a <scalar_mode> (nmode)));
+             rtx c = immed_wide_int_const (wval_so_far, nmode);
+             set_dst_reg_note (insn, REG_EQUAL, gen_rtx_MULT (nmode, tem, c),
+                               accum_inner);
+           }
        }
     }

Reply via email to