summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/gcc/expmed.c3
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. */