OSDN Git Service

(negate_rtx): Don't try to negate a constant ourself; instead call
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 24 Mar 1996 13:16:26 +0000 (13:16 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 24 Mar 1996 13:16:26 +0000 (13:16 +0000)
simplify_unary_operation.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@11611 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/expmed.c

index ec392e7..0d3983c 100644 (file)
@@ -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;
 }
 \f
 /* Generate code to store value from rtx VALUE