diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-03-24 13:16:26 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-03-24 13:16:26 +0000 |
commit | 2242dc4b474ec80fe68cc1b75801d09384fae60f (patch) | |
tree | b656f91e5b4306abf4cbd7bafc4f70229ba02a9d /gcc/expmed.c | |
parent | b429470f14cf6c8c32efff6b579c198b9290e372 (diff) | |
download | gcc-2242dc4b474ec80fe68cc1b75801d09384fae60f.tar.gz |
(negate_rtx): Don't try to negate a constant ourself; instead call
simplify_unary_operation.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@11611 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r-- | gcc/expmed.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/gcc/expmed.c b/gcc/expmed.c index ec392e7aa73..0d3983c183a 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -185,21 +185,12 @@ negate_rtx (mode, x) enum machine_mode mode; rtx x; { - if (GET_CODE (x) == CONST_INT) - { - HOST_WIDE_INT val = - INTVAL (x); - if (GET_MODE_BITSIZE (mode) < HOST_BITS_PER_WIDE_INT) - { - /* Sign extend the value from the bits that are significant. */ - if (val & ((HOST_WIDE_INT) 1 << (GET_MODE_BITSIZE (mode) - 1))) - val |= (HOST_WIDE_INT) (-1) << GET_MODE_BITSIZE (mode); - else - val &= ((HOST_WIDE_INT) 1 << GET_MODE_BITSIZE (mode)) - 1; - } - return GEN_INT (val); - } - else - return expand_unop (GET_MODE (x), neg_optab, x, NULL_RTX, 0); + rtx result = simplify_unary_operation (NEG, mode, x, mode); + + if (result = 0) + result = expand_unop (mode, neg_optab, x, NULL_RTX, 0); + + return result; } /* Generate code to store value from rtx VALUE |