From e80316129f08a13630a1751c9eb9fea4d5888d35 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Sat, 12 Nov 1994 06:35:09 -0500 Subject: [PATCH] (expand_divmod, case TRUNC_DIV_EXPR): Promote signed division by 0x80000000 to unsigned. From-SVN: r8430 --- gcc/expmed.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/expmed.c b/gcc/expmed.c index c5860a0f292..bae088d223a 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -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 (); -- 2.30.2