]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: alpha.c (alpha_emit_conditional_branch): Don't use (op0-op1) == 0 if op0...
authorEric Botcazou <ebotcazou@act-europe.fr>
Fri, 12 Nov 2004 09:11:38 +0000 (10:11 +0100)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Fri, 12 Nov 2004 09:11:38 +0000 (09:11 +0000)
Backport from mainline:
2004-02-25  Richard Henderson  <rth@redhat.com>

* config/alpha/alpha.c (alpha_emit_conditional_branch): Don't
use (op0-op1) == 0 if op0 is a pointer.

From-SVN: r90524

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/testsuite/ChangeLog

index e3f1af6833e004ffff4dd4efe9d652c1e72f3eab..f3776ec5616241434a5d4be4cf4680c65fcba59b 100644 (file)
@@ -1,3 +1,11 @@
+2004-11-12  Eric Botcazou  <ebotcazou@act-europe.fr>
+
+       Backport from mainline:
+       2004-02-25  Richard Henderson  <rth@redhat.com>
+
+       * config/alpha/alpha.c (alpha_emit_conditional_branch): Don't
+       use (op0-op1) == 0 if op0 is a pointer.
+
 2004-11-10  Joseph S. Myers  <joseph@codesourcery.com>
 
        PR c/18322
index f10785121af19e76355b26ff7a5fc6aad6af94fa..fbaeabe5049afbd6ea1ef1b4e34e41483c4a20e5 100644 (file)
@@ -3197,7 +3197,13 @@ alpha_emit_conditional_branch (enum rtx_code code)
          /* If the constants doesn't fit into an immediate, but can
             be generated by lda/ldah, we adjust the argument and
             compare against zero, so we can use beq/bne directly.  */
-         else if (GET_CODE (op1) == CONST_INT && (code == EQ || code == NE))
+         /* ??? Don't do this when comparing against symbols, otherwise
+            we'll reduce (&x == 0x1234) to (&x-0x1234 == 0), which will
+            be declared false out of hand (at least for non-weak).  */
+         else if (GET_CODE (op1) == CONST_INT
+                  && (code == EQ || code == NE)
+                  && !(symbolic_operand (op0, VOIDmode)
+                       || (GET_CODE (op0) == REG && REG_POINTER (op0))))
            {
              HOST_WIDE_INT v = INTVAL (op1), n = -v;
 
index a13f6c9327fe6ca771016451f2753d927e071450..3ebbb772865d003c139e88eb4c93af641a64e0c6 100644 (file)
@@ -1,3 +1,7 @@
+2004-11-12  Eric Botcazou  <ebotcazou@act-europe.fr>
+
+       * gcc.c-torture/execute/20041112-1.c: New test.
+
 2004-11-10  Joseph S. Myers  <joseph@codesourcery.com>
 
        PR c/18322