expmed.c (expand_divmod): If compute_mode is not the same as mode...
authorDavid S. Miller <davem@tanya.rutgers.edu>
Tue, 23 Sep 1997 07:25:25 +0000 (07:25 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 23 Sep 1997 07:25:25 +0000 (01:25 -0600)
        * expmed.c (expand_divmod): If compute_mode is not the same as
        mode, handle the case where convert_modes() causes op1 to no
        longer be a CONST_INT.

From-SVN: r15672

gcc/ChangeLog
gcc/expmed.c

index 1964beb7f8bfce58962e693025dd9afa52c9f378..9eb883e9e53a6980a058425d210362c9156aff96 100644 (file)
@@ -1,5 +1,9 @@
 Tue Sep 23 01:15:50 1997  David S. Miller  <davem@tanya.rutgers.edu>
 
+       * expmed.c (expand_divmod): If compute_mode is not the same as
+       mode, handle the case where convert_modes() causes op1 to no
+       longer be a CONST_INT.
+
        * reorg.c (dbr_schedule): At end of this pass, add REG_BR_PRED
        note holding get_jump_flags() calculation to all JUMP_INSNs.
        * rtl.h (enum reg_note): New note types REG_BR_PRED and REG_SAVE_AREA.
index fa3cc490a8c339ec4b591daf3e3e06b81f87e72a..b6f77c813d2c7d5b87f28f6ffc5314131e55c0ea 100644 (file)
@@ -2831,6 +2831,14 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
     {
       op0 = convert_modes (compute_mode, mode, op0, unsignedp);
       op1 = convert_modes (compute_mode, mode, op1, unsignedp);
+
+      /* convert_modes may have tossed op1 into a register, so we
+        absolutely must recompute the following.  */
+      op1_is_constant = GET_CODE (op1) == CONST_INT;
+      op1_is_pow2 = (op1_is_constant
+                    && ((EXACT_POWER_OF_2_OR_ZERO_P (INTVAL (op1))
+                         || (! unsignedp
+                             && EXACT_POWER_OF_2_OR_ZERO_P (-INTVAL (op1))))));
     }
 
   /* If one of the operands is a volatile MEM, copy it into a register.  */