]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gimple.c (canonicalize_cond_expr_cond): Rewrite x ^ y into x != y.
authorJeff Law <law@redhat.com>
Mon, 8 Apr 2013 13:11:56 +0000 (07:11 -0600)
committerJeff Law <law@gcc.gnu.org>
Mon, 8 Apr 2013 13:11:56 +0000 (07:11 -0600)
        * gimple.c (canonicalize_cond_expr_cond): Rewrite x ^ y into
        x != y.

        * gcc.dg/tree-ssa/forwprop-25.c: New test

From-SVN: r197579

gcc/ChangeLog
gcc/gimple.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/forwprop-25.c [new file with mode: 0644]

index 324c56b26650567e32746d62d8543d2319948e95..b72dd89f50dda59db27e2ce8bff7c6c94e381d82 100644 (file)
@@ -1,3 +1,7 @@
+2013-04-08  Jeff Law  <law@redhat.com>
+
+       * gimple.c (canonicalize_cond_expr_cond): Rewrite x ^ y into x != y.
+                       
 2013-04-08  Richard Biener  <rguenther@suse.de>
 
        * gimple-pretty-print.c (debug_gimple_stmt): Do not print
index 785c2f021a7733a8d3b5e527bae00223ebc74c04..cdb6f2498a839dc33f74caefa044a066f2d57f8d 100644 (file)
@@ -2958,7 +2958,11 @@ canonicalize_cond_expr_cond (tree t)
       t = build2 (TREE_CODE (top0), TREE_TYPE (t),
                  TREE_OPERAND (top0, 0), TREE_OPERAND (top0, 1));
     }
-
+  /* For x ^ y use x != y.  */
+  else if (TREE_CODE (t) == BIT_XOR_EXPR)
+    t = build2 (NE_EXPR, TREE_TYPE (t),
+               TREE_OPERAND (t, 0), TREE_OPERAND (t, 1));
+  
   if (is_gimple_condexpr (t))
     return t;
 
index 8893979f4e4bc0394672f7e7c144e9e826eaa609..e137b85657bf45e772b23330686a17afde0a994d 100644 (file)
@@ -1,3 +1,7 @@
+2013-04-08  Jeff Law  <law@redhat.com>
+
+       * gcc.dg/tree-ssa/forwprop-25.c: New test
+
 2013-04-08  Richard Biener  <rguenther@suse.de>
 
        * gfortran.dg/vect/fast-math-mgrid-resid.f: Adjust.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/forwprop-25.c b/gcc/testsuite/gcc.dg/tree-ssa/forwprop-25.c
new file mode 100644 (file)
index 0000000..cf0c504
--- /dev/null
@@ -0,0 +1,43 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -fdump-tree-forwprop1" } */
+
+struct rtx_def;
+typedef struct rtx_def *rtx;
+typedef const struct rtx_def *const_rtx;
+enum machine_mode
+{
+  MAX_MACHINE_MODE,
+  NUM_MACHINE_MODES = MAX_MACHINE_MODE
+};
+extern const char *const mode_name[NUM_MACHINE_MODES];
+enum mode_class
+{ MODE_RANDOM, MODE_CC, MODE_INT, MODE_PARTIAL_INT, MODE_FRACT, MODE_UFRACT,
+    MODE_ACCUM, MODE_UACCUM, MODE_FLOAT, MODE_DECIMAL_FLOAT, MODE_COMPLEX_INT,
+    MODE_COMPLEX_FLOAT, MODE_VECTOR_INT, MODE_VECTOR_FRACT,
+    MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM,
+    MODE_VECTOR_FLOAT, MAX_MODE_CLASS };
+extern const unsigned char mode_class[NUM_MACHINE_MODES];
+extern const unsigned short mode_precision[NUM_MACHINE_MODES];
+struct rtx_def
+{
+  __extension__ enum machine_mode mode:8;
+};
+void
+convert_move (rtx to, rtx from, int unsignedp)
+{
+  enum machine_mode to_mode = ((enum machine_mode) (to)->mode);
+  enum machine_mode from_mode = ((enum machine_mode) (from)->mode);
+  ((void)
+   (!((mode_precision[from_mode] != mode_precision[to_mode])
+      || ((((enum mode_class) mode_class[from_mode]) == MODE_DECIMAL_FLOAT) !=
+         (((enum mode_class) mode_class[to_mode]) ==
+          MODE_DECIMAL_FLOAT))) ?
+    fancy_abort ("/home/gcc/virgin-gcc/gcc/expr.c", 380, __FUNCTION__),
+    0 : 0));
+}
+
+/* { dg-final { scan-tree-dump "Replaced.*!=.*with.*!=.* " "forwprop1"} } */
+/* { dg-final { cleanup-tree-dump "forwprop1" } } */
+
+
+