]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR rtl-optimization/46865 (Using -save-temps (or ccache, distcc) produce...
authorJakub Jelinek <jakub@redhat.com>
Sun, 16 Jan 2011 20:14:37 +0000 (21:14 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 16 Jan 2011 20:14:37 +0000 (21:14 +0100)
Backport from mainline
2010-12-10  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/46865
* rtl.c (rtx_equal_p_cb, rtx_equal_p): For last operand of
ASM_OPERANDS and ASM_INPUT if integers are different,
call locator_eq.
* jump.c (rtx_renumbered_equal_p): Likewise.

* gcc.target/i386/pr46865-1.c: New test.
* gcc.target/i386/pr46865-2.c: New test.

From-SVN: r168862

gcc/ChangeLog
gcc/jump.c
gcc/rtl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr46865-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr46865-2.c [new file with mode: 0644]

index ed1b160e3b414da6a23bfec2720f8adbdb889e89..3260141e7c6cd30504eeded52c97ead448320578 100644 (file)
@@ -3,6 +3,12 @@
        Backport from mainline
        2010-12-10  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/46865
+       * rtl.c (rtx_equal_p_cb, rtx_equal_p): For last operand of
+       ASM_OPERANDS and ASM_INPUT if integers are different,
+       call locator_eq.
+       * jump.c (rtx_renumbered_equal_p): Likewise.
+
        PR tree-optimization/46864
        * tree-ssa-loop-im.c (loop_suitable_for_sm): Return false even
        when there are EDGE_EH exit edges.
index dc1d2f7b164b832e86cf5d1e29ba6c7fa2a04cfb..5a92267af5bd76b3afb11bc27de2001305adb61c 100644 (file)
@@ -1728,7 +1728,13 @@ rtx_renumbered_equal_p (const_rtx x, const_rtx y)
 
        case 'i':
          if (XINT (x, i) != XINT (y, i))
-           return 0;
+           {
+             if (((code == ASM_OPERANDS && i == 6)
+                  || (code == ASM_INPUT && i == 1))
+                 && locator_eq (XINT (x, i), XINT (y, i)))
+               break;
+             return 0;
+           }
          break;
 
        case 't':
index fe9c9514f1cd40624b9af8ab00ad8ebbc861b4bb..e0841d084c630aa96ceb60fce9d64676e6a8fb46 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -429,7 +429,15 @@ rtx_equal_p_cb (const_rtx x, const_rtx y, rtx_equal_p_callback_function cb)
        case 'n':
        case 'i':
          if (XINT (x, i) != XINT (y, i))
-           return 0;
+           {
+#ifndef GENERATOR_FILE
+             if (((code == ASM_OPERANDS && i == 6)
+                  || (code == ASM_INPUT && i == 1))
+                 && locator_eq (XINT (x, i), XINT (y, i)))
+               break;
+#endif
+             return 0;
+           }
          break;
 
        case 'V':
@@ -549,7 +557,15 @@ rtx_equal_p (const_rtx x, const_rtx y)
        case 'n':
        case 'i':
          if (XINT (x, i) != XINT (y, i))
-           return 0;
+           {
+#ifndef GENERATOR_FILE
+             if (((code == ASM_OPERANDS && i == 6)
+                  || (code == ASM_INPUT && i == 1))
+                 && locator_eq (XINT (x, i), XINT (y, i)))
+               break;
+#endif
+             return 0;
+           }
          break;
 
        case 'V':
index 8d011dd6e5ee5a92bfef8e751613684424caea67..0d8c6aa5f873a809c2f86da11e722c212dc5ae0f 100644 (file)
@@ -3,6 +3,10 @@
        Backport from mainline
        2010-12-10  Jakub Jelinek  <jakub@redhat.com>
 
+       PR rtl-optimization/46865
+       * gcc.target/i386/pr46865-1.c: New test.
+       * gcc.target/i386/pr46865-2.c: New test.
+
        PR tree-optimization/46864
        * g++.dg/opt/pr46864.C: New test.
 
diff --git a/gcc/testsuite/gcc.target/i386/pr46865-1.c b/gcc/testsuite/gcc.target/i386/pr46865-1.c
new file mode 100644 (file)
index 0000000..220a1c0
--- /dev/null
@@ -0,0 +1,31 @@
+/* PR rtl-optimization/46865 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+extern unsigned long f;
+
+#define m1(f)                                                  \
+  if (f & 1)                                                   \
+    asm volatile ("nop /* asmnop */\n");                       \
+  else                                                         \
+    asm volatile ("nop /* asmnop */\n");
+
+#define m2(f)                                                  \
+  if (f & 1)                                                   \
+    asm volatile ("nop /* asmnop */\n" : : "i" (6) : "cx");    \
+  else                                                         \
+    asm volatile ("nop /* asmnop */\n" : : "i" (6) : "cx");
+
+void
+foo (void)
+{
+  m1 (f);
+}
+
+void
+bar (void)
+{
+  m2 (f);
+}
+
+/* { dg-final { scan-assembler-times "asmnop" 2 } } */
diff --git a/gcc/testsuite/gcc.target/i386/pr46865-2.c b/gcc/testsuite/gcc.target/i386/pr46865-2.c
new file mode 100644 (file)
index 0000000..4a91f7c
--- /dev/null
@@ -0,0 +1,32 @@
+/* PR rtl-optimization/46865 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -save-temps" } */
+
+extern unsigned long f;
+
+#define m1(f)                                                  \
+  if (f & 1)                                                   \
+    asm volatile ("nop /* asmnop */\n");                       \
+  else                                                         \
+    asm volatile ("nop /* asmnop */\n");
+
+#define m2(f)                                                  \
+  if (f & 1)                                                   \
+    asm volatile ("nop /* asmnop */\n" : : "i" (6) : "cx");    \
+  else                                                         \
+    asm volatile ("nop /* asmnop */\n" : : "i" (6) : "cx");
+
+void
+foo (void)
+{
+  m1 (f);
+}
+
+void
+bar (void)
+{
+  m2 (f);
+}
+
+/* { dg-final { scan-assembler-times "asmnop" 2 } } */
+/* { dg-final { cleanup-saved-temps } } */