diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-03-30 14:25:43 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-03-30 14:25:43 +0000 |
commit | e1a6b99e0e5465fbf5c110a68d72a3a621806523 (patch) | |
tree | 81043ae956cb35c3c5b35a5f7a29e61b2f2d240d /gnu/usr.bin/gcc | |
parent | 460f188468b6c03b5caeace4aaacb13107ffa277 (diff) |
From NetBSD:
Patch from J"orn Rennecke that fixes code generation bugs with long
long comparisons. As of this date, this change hasn't made it into
the development sources. We must consider this when it comes time
to integrate a newer gcc release.
Thu Mar 7 01:16:23 1996 J"orn Rennecke (amylaar@meolyon.hanse.de)
* expmed.c (negate_rtx): Don't negate LONG_MIN if mode is wider
than HOST_WIDE_INT.
gcc now produces worse code for this test case than gcc 2.5.8 when
invoked with -O , but it will optimize as good as gcc 2.5.8 (i.e. all
comparisons vanish) when invoked with -O2 , thus I think it doesn't
matter. If anyone is interested in looking into this, the code in
expr.c, function expand_expr, case MINUS_EXPR, if-clause for if
(TREE_UNSIGNED (type) || TREE_OVERFLOW (negated)), will refuse to
convert the subtraction into an addition if there is an overflow in
the conversion or negation of the constant. If both host and target
machine are binary computers with 2-complement representation, the
overflow should not matter.
Diffstat (limited to 'gnu/usr.bin/gcc')
-rw-r--r-- | gnu/usr.bin/gcc/expmed.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gnu/usr.bin/gcc/expmed.c b/gnu/usr.bin/gcc/expmed.c index 8006e8be954..83c77e6f131 100644 --- a/gnu/usr.bin/gcc/expmed.c +++ b/gnu/usr.bin/gcc/expmed.c @@ -188,6 +188,9 @@ negate_rtx (mode, x) if (GET_CODE (x) == CONST_INT) { HOST_WIDE_INT val = - INTVAL (x); + if (GET_MODE_BITSIZE (mode) > HOST_BITS_PER_WIDE_INT + && INTVAL (x) < 0 && val < 0) + return expand_unop (mode, neg_optab, x, NULL_RTX, 0); if (GET_MODE_BITSIZE (mode) < HOST_BITS_PER_WIDE_INT) { /* Sign extend the value from the bits that are significant. */ |