(expand_divmod, case TRUNC_DIV_EXPR): Promote signed division by
authorRichard Kenner <kenner@gcc.gnu.org>
Sat, 12 Nov 1994 11:35:09 +0000 (06:35 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 12 Nov 1994 11:35:09 +0000 (06:35 -0500)
0x80000000 to unsigned.

From-SVN: r8430

gcc/expmed.c

index c5860a0f2923629d315d0b606ec0db3dbe6de97c..bae088d223a64c11218159f69696f01601cbfa50 100644 (file)
@@ -2740,7 +2740,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
       case TRUNC_DIV_EXPR:
        if (op1_is_constant && HOST_BITS_PER_WIDE_INT >= size)
          {
-           if (unsignedp)
+           if (unsignedp
+               || (INTVAL (op1)
+                   == (HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (compute_mode) - 1)))
              {
                unsigned HOST_WIDE_INT mh, ml;
                int pre_shift, post_shift;
@@ -2901,6 +2903,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
                                                 tquotient, 0);
                      }
 
+                   /* We have computed OP0 / abs(OP1).  If OP1 is negative, negate
+                      the quotient.  */
                    if (d < 0)
                      {
                        insn = get_last_insn ();