]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/22067 (Inconsistent multiply by immediate)
authorDavid Edelsohn <edelsohn@gnu.org>
Sat, 17 Sep 2005 20:17:54 +0000 (20:17 +0000)
committerDavid Edelsohn <dje@gcc.gnu.org>
Sat, 17 Sep 2005 20:17:54 +0000 (16:17 -0400)
        PR middle-end/22067
        * expmed.c (expand_mult): Substitute simple register for op0 when
        computing max_cost.

From-SVN: r104373

gcc/ChangeLog
gcc/expmed.c

index abf9fe06017d8df8685f24fa74dd018985d21cef..0c41cf79930b33bccae94c9b44d55972a5852b1e 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-17  David Edelsohn  <edelsohn@gnu.org>
+
+       PR middle-end/22067
+       * expmed.c (expand_mult): Substitute simple register for op0 when
+       computing max_cost.
+
 2005-09-17  Richard Henderson  <rth@redhat.com>
 
        * expr.c (emit_move_via_integer): Add force argument, pass it on
index a58ae0ff57817793fa0c3321b7f0026dd8d98e57..292957cc3c85012eb5c6413baa527b2be08f0843 100644 (file)
@@ -3022,6 +3022,7 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
       && (unsignedp || !flag_trapv))
     {
       HOST_WIDE_INT coeff = 0;
+      rtx reg = gen_raw_REG (mode, LAST_VIRTUAL_REGISTER + 1);
 
       /* synth_mult does an `unsigned int' multiply.  As long as the mode is
         less than or equal in size to `unsigned int' this doesn't matter.
@@ -3040,7 +3041,7 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
            {
              /* Its safe to use -INTVAL (op1) even for INT_MIN, as the
                 result is interpreted as an unsigned coefficient.  */
-             max_cost = rtx_cost (gen_rtx_MULT (mode, op0, op1), SET)
+             max_cost = rtx_cost (gen_rtx_MULT (mode, reg, op1), SET)
                         - neg_cost[mode];
              if (max_cost > 0
                  && choose_mult_variant (mode, -INTVAL (op1), &algorithm,
@@ -3083,7 +3084,7 @@ expand_mult (enum machine_mode mode, rtx op0, rtx op1, rtx target,
                                 build_int_cst (NULL_TREE, floor_log2 (coeff)),
                                 target, unsignedp);
 
-         max_cost = rtx_cost (gen_rtx_MULT (mode, op0, op1), SET);
+         max_cost = rtx_cost (gen_rtx_MULT (mode, reg, op1), SET);
          if (choose_mult_variant (mode, coeff, &algorithm, &variant,
                                   max_cost))
            return expand_mult_const (mode, op0, coeff, target,