diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1994-11-12 06:35:09 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1994-11-12 06:35:09 -0500 |
commit | e80316129f08a13630a1751c9eb9fea4d5888d35 (patch) | |
tree | 4fb86829d58e9a03bd15854226551f6f295cc402 | |
parent | 84e24c036d3f3b11caaa5c69be38309bada7890b (diff) | |
download | gcc-e80316129f08a13630a1751c9eb9fea4d5888d35.zip gcc-e80316129f08a13630a1751c9eb9fea4d5888d35.tar.gz gcc-e80316129f08a13630a1751c9eb9fea4d5888d35.tar.bz2 |
(expand_divmod, case TRUNC_DIV_EXPR): Promote signed division by
0x80000000 to unsigned.
From-SVN: r8430
-rw-r--r-- | gcc/expmed.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index c5860a0..bae088d 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 (); |