]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
simplify-rtx.c (mode_signbit_p): Externalize function...
authorPat Haugen <pthaugen@us.ibm.com>
Mon, 18 Oct 2004 18:46:06 +0000 (18:46 +0000)
committerDavid Edelsohn <dje@gcc.gnu.org>
Mon, 18 Oct 2004 18:46:06 +0000 (14:46 -0400)
2004-10-18  Pat Haugen  <pthaugen@us.ibm.com>

        * simplify-rtx.c (mode_signbit_p): Externalize function...
        * rtl.h (mode_signbit_p): ... to here.
        * combine.c (simplify_shift_const): Recognize PLUS signbit as
        canonical form of XOR signbit and move to outer op.

From-SVN: r89235

gcc/ChangeLog
gcc/combine.c
gcc/rtl.h
gcc/simplify-rtx.c

index fe4213bd8c7e053e4e6e63623c94e92009e63b13..7e1ab3c3f18a8420279c0810ee399801a808dee4 100644 (file)
@@ -1,3 +1,10 @@
+2004-10-18  Pat Haugen  <pthaugen@us.ibm.com>
+
+       * simplify-rtx.c (mode_signbit_p): Externalize function...
+       * rtl.h (mode_signbit_p): ... to here.
+       * combine.c (simplify_shift_const): Recognize PLUS signbit as
+       canonical form of XOR signbit and move to outer op.
+
 2004-10-18  Diego Novillo  <dnovillo@redhat.com>
 
        * tree-cfg.c (bsi_for_stmt): Rename from stmt_for_bsi.
index 559ee1531362d9b3c8f8e7786593241e284ae197..98efe3eb1476ffeef290169cf7afdbb1190c2cdd 100644 (file)
@@ -9022,6 +9022,26 @@ simplify_shift_const (rtx x, enum rtx_code code,
              varop = XEXP (varop, 0);
              continue;
            }
+
+         /* Check for 'PLUS signbit', which is the canonical form of 'XOR
+            signbit', and attempt to change the PLUS to an XOR and move it to
+            the outer operation as is done above in the AND/IOR/XOR case
+            leg for shift(logical). See details in logical handling above
+            for reasoning in doing so. */
+         if (code == LSHIFTRT
+             && GET_CODE (XEXP (varop, 1)) == CONST_INT
+             && mode_signbit_p (result_mode, XEXP (varop, 1))
+             && (new = simplify_binary_operation (code, result_mode,
+                                                  XEXP (varop, 1),
+                                                  GEN_INT (count))) != 0
+             && GET_CODE (new) == CONST_INT
+             && merge_outer_ops (&outer_op, &outer_const, XOR,
+                                 INTVAL (new), result_mode, &complement_p))
+           {
+             varop = XEXP (varop, 0);
+             continue;
+           }
+
          break;
 
        case MINUS:
index 3ebf4aa7a17b7fdff0d068ae614d54434c80753e..ca2a0174ae55b05221438a242f757d1416618290 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1570,6 +1570,7 @@ extern rtx simplify_gen_subreg (enum machine_mode, rtx, enum machine_mode,
 extern rtx simplify_replace_rtx (rtx, rtx, rtx);
 extern rtx simplify_rtx (rtx);
 extern rtx avoid_constant_pool_reference (rtx);
+extern bool mode_signbit_p (enum machine_mode, rtx);
 
 /* In regclass.c  */
 extern enum machine_mode choose_hard_reg_mode (unsigned int, unsigned int,
index 7236bbfc064645bbc23445cf82145bedd287c5ce..4af468a40ca8f057e74ff75eaba645d8334ad2c5 100644 (file)
@@ -50,7 +50,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
  ((((HOST_WIDE_INT) low) < 0) ? ((HOST_WIDE_INT) -1) : ((HOST_WIDE_INT) 0))
 
 static rtx neg_const_int (enum machine_mode, rtx);
-static bool mode_signbit_p (enum machine_mode, rtx);
 static int simplify_plus_minus_op_data_cmp (const void *, const void *);
 static rtx simplify_plus_minus (enum rtx_code, enum machine_mode, rtx,
                                rtx, int);
@@ -72,7 +71,7 @@ neg_const_int (enum machine_mode mode, rtx i)
 /* Test whether expression, X, is an immediate constant that represents
    the most significant bit of machine mode MODE.  */
 
-static bool
+bool
 mode_signbit_p (enum machine_mode mode, rtx x)
 {
   unsigned HOST_WIDE_INT val;