summaryrefslogtreecommitdiff
path: root/gcc/expmed.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-03-24 08:16:26 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1996-03-24 08:16:26 -0500
commita39a7484b11e4f6bfa4d0799671564b09f43dc24 (patch)
treeb656f91e5b4306abf4cbd7bafc4f70229ba02a9d /gcc/expmed.c
parent3ef00709c644f236ffeae3e990704767b749221a (diff)
downloadgcc-a39a7484b11e4f6bfa4d0799671564b09f43dc24.tar.gz
(negate_rtx): Don't try to negate a constant ourself; instead call
simplify_unary_operation. From-SVN: r11611
Diffstat (limited to 'gcc/expmed.c')
-rw-r--r--gcc/expmed.c21
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