]> 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 22:53:09 +0000 (23:53 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 16 Jan 2011 22:53:09 +0000 (23:53 +0100)
Backport from mainline
2010-12-10  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/46865
* rtl.c (rtx_equal_p_cb): 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: r168877

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 1b7f9e329981362fbffa2f63d97cd884a1e065b5..f2d5b91d1f6ae8d1198435fd3ba662b451f49722 100644 (file)
@@ -1,3 +1,14 @@
+2011-01-16  Jakub Jelinek  <jakub@redhat.com>
+
+       Backport from mainline
+       2010-12-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/46865
+       * rtl.c (rtx_equal_p_cb): For last operand of
+       ASM_OPERANDS and ASM_INPUT if integers are different,
+       call locator_eq.
+       * jump.c (rtx_renumbered_equal_p): Likewise.
+
 2011-01-07  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        Backport from mainline:
index 2b9a9545223bd6e2e02c83029e57da6abc5f2097..cc024a80e782170c203053988a775da065b157ae 100644 (file)
@@ -1670,7 +1670,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 == 5)
+                  || (code == ASM_INPUT && i == 1))
+                 && locator_eq (XINT (x, i), XINT (y, i)))
+               break;
+             return 0;
+           }
          break;
 
        case 't':
index c275091ad775df86f00209fa8f9ae78f442409b1..09700d0b654c73d5da71010ada0919a7d0764a8b 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -405,7 +405,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 == 5)
+                  || (code == ASM_INPUT && i == 1))
+                 && locator_eq (XINT (x, i), XINT (y, i)))
+               break;
+#endif
+             return 0;
+           }
          break;
 
        case 'V':
index 3947ce58b02d4efbe25384d4bd2ef63326d80530..1564222901527af514e4385718f7780dda8b14f4 100644 (file)
@@ -1,3 +1,12 @@
+2011-01-16  Jakub Jelinek  <jakub@redhat.com>
+
+       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.
+
 2011-01-13  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * gfortran.dg/cray_pointers_2.f90: Use dg-timeout-factor 4.
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 } } */