combine.c (force_to_mode): Only replace with (not Y) if all bits in fuller_mask ...
authorJakub Jelinek <jakub@redhat.com>
Wed, 20 Nov 2002 09:43:20 +0000 (10:43 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 20 Nov 2002 09:43:20 +0000 (10:43 +0100)
* combine.c (force_to_mode): Only replace with (not Y) if all bits in fuller_mask
(not just mask) are set in C.

* gcc.c-torture/execute/20021118-3.c: New test.

From-SVN: r59295

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/20021118-3.c [new file with mode: 0644]

index 4f18c0606fb46fe404d36e69547a37d16bad58bb..52386836e024093037bfc63d607ad9324e0ab7a2 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-20  Jakub Jelinek  <jakub@redhat.com>
+
+       * combine.c (force_to_mode): Only replace with (not Y) if all bits in fuller_mask
+       (not just mask) are set in C.
+
 2002-11-19  Andreas Jaeger  <aj@suse.de>
 
        * loop.c (record_giv): Initialize not_replaceable.
index 8ce9d10eb1d013b69781ad58bf72eaf56748a6a2..a0214d195674a4f217b5e06e1e80dc4ccd80a092 100644 (file)
@@ -6978,10 +6978,10 @@ force_to_mode (x, mode, mask, reg, just_select)
          return force_to_mode (x, mode, mask, reg, next_select);
        }
 
-      /* Similarly, if C contains every bit in the mask, then we may
+      /* Similarly, if C contains every bit in the fuller_mask, then we may
         replace with (not Y).  */
       if (GET_CODE (XEXP (x, 0)) == CONST_INT
-         && ((INTVAL (XEXP (x, 0)) | (HOST_WIDE_INT) mask)
+         && ((INTVAL (XEXP (x, 0)) | (HOST_WIDE_INT) fuller_mask)
              == INTVAL (XEXP (x, 0))))
        {
          x = simplify_gen_unary (NOT, GET_MODE (x),
index cb13824c9725d6984b7a27cc3a74bc30e087fb90..a09e7c7235f825edf2dd251ac9458166e78bdfbd 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-20  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.c-torture/execute/20021118-3.c: New test.
+
 2002-11-19  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * gcc.c-torture/compile/20021119-1.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/20021118-3.c b/gcc/testsuite/gcc.c-torture/execute/20021118-3.c
new file mode 100644 (file)
index 0000000..8ec01ca
--- /dev/null
@@ -0,0 +1,18 @@
+extern void abort (void);
+extern void exit (int);
+
+int
+foo (int x)
+{
+  if (x == -2 || -x - 100 >= 0)
+    abort ();
+  return 0;
+}
+           
+int
+main ()
+{
+  foo (-3);
+  foo (-99);
+  exit (0);
+}