combine.c (simplify_comparison): Shift a NOT out of a single bit test.
authorRichard Henderson <rth@cygnus.com>
Mon, 18 Sep 2000 18:39:03 +0000 (11:39 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 18 Sep 2000 18:39:03 +0000 (11:39 -0700)
        * combine.c (simplify_comparison): Shift a NOT out of a single
        bit test.

From-SVN: r36508

gcc/ChangeLog
gcc/combine.c

index ec5c66370e6bd31b1d182e56bcf40d7d835230f3..047adf80d22271a4af9d1fa1bda5e6577912982d 100644 (file)
@@ -1,5 +1,8 @@
 2000-09-18  Richard Henderson  <rth@cygnus.com>
 
+       * combine.c (simplify_comparison): Shift a NOT out of a single
+       bit test.
+
        * combine.c (if_then_else_cond): Canonicalize BImode true to
        STORE_FLAG_VALUE.
        * explow.c (trunc_int_for_mode): Likewise.
index b8ac09b766af853f7a7139c0d23feaaf06bbdb2d..a498b580d772df5d7182a9d8c9bfdb0247590f91 100644 (file)
@@ -10811,6 +10811,21 @@ simplify_comparison (code, pop0, pop1)
              continue;
            }
 
+         /* Convert (ne (and (lshiftrt (not X)) 1) 0) to
+            (eq (and (lshiftrt X) 1) 0).  */
+         if (const_op == 0 && equality_comparison_p
+             && XEXP (op0, 1) == const1_rtx
+             && GET_CODE (XEXP (op0, 0)) == LSHIFTRT
+             && GET_CODE (XEXP (XEXP (op0, 0), 0)) == NOT)
+           {
+             op0 = simplify_and_const_int
+               (op0, mode, gen_rtx_combine (LSHIFTRT, mode,
+                                            XEXP (XEXP (XEXP (op0, 0), 0), 0),
+                                            XEXP (XEXP (op0, 0), 1)),
+                (HOST_WIDE_INT) 1);
+             code = (code == NE ? EQ : NE);
+             continue;
+           }
          break;
 
        case ASHIFT: