Commit e8031612 by Richard Kenner

(expand_divmod, case TRUNC_DIV_EXPR): Promote signed division by

0x80000000 to unsigned.

From-SVN: r8430
parent 84e24c03
...@@ -2740,7 +2740,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) ...@@ -2740,7 +2740,9 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
case TRUNC_DIV_EXPR: case TRUNC_DIV_EXPR:
if (op1_is_constant && HOST_BITS_PER_WIDE_INT >= size) 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; unsigned HOST_WIDE_INT mh, ml;
int pre_shift, post_shift; int pre_shift, post_shift;
...@@ -2901,6 +2903,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp) ...@@ -2901,6 +2903,8 @@ expand_divmod (rem_flag, code, mode, op0, op1, target, unsignedp)
tquotient, 0); tquotient, 0);
} }
/* We have computed OP0 / abs(OP1). If OP1 is negative, negate
the quotient. */
if (d < 0) if (d < 0)
{ {
insn = get_last_insn (); insn = get_last_insn ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment