Hi!

As the following testcase shows on aarch64, the SET_DEST can be a normal
subreg, not only a paradoxical one or REG.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
preapproved by Segher in the PR, committed to trunk.

2018-03-06  Jakub Jelinek  <ja...@redhat.com>

        PR target/84710
        * combine.c (try_combine): Use reg_or_subregno instead of handling
        just paradoxical SUBREGs and REGs.

        * gcc.dg/pr84710.c: New test.

--- gcc/combine.c.jj    2018-03-05 23:13:26.478215559 +0100
+++ gcc/combine.c       2018-03-06 08:50:17.756288841 +0100
@@ -4283,12 +4283,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2,
       if (GET_CODE (x) == PARALLEL)
        x = XVECEXP (newi2pat, 0, 0);
 
-      /* It can only be a SET of a REG or of a paradoxical SUBREG of a REG.  */
-      x = SET_DEST (x);
-      if (paradoxical_subreg_p (x))
-       x = SUBREG_REG (x);
-
-      unsigned int regno = REGNO (x);
+      /* It can only be a SET of a REG or of a SUBREG of a REG.  */
+      unsigned int regno = reg_or_subregno (SET_DEST (x));
 
       bool done = false;
       for (rtx_insn *insn = NEXT_INSN (i3);
--- gcc/testsuite/gcc.dg/pr84710.c.jj   2018-03-06 08:56:00.667240389 +0100
+++ gcc/testsuite/gcc.dg/pr84710.c      2018-03-06 08:55:22.637245765 +0100
@@ -0,0 +1,13 @@
+/* PR target/84710 */
+/* { dg-do compile } */
+/* { dg-options "-O -fno-forward-propagate" } */
+
+char a;
+int b;
+
+void
+foo (void)
+{
+  int d;
+  b = __builtin_mul_overflow ((char) d, 0xfe, &a);
+}

        Jakub

Reply via email to