The following patch fixes

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58048

LRA has a correct behaviour (as reload) on the test with -O0. But with -O2 a constant propagation into asm operands resulted in LRA cycling instead of error reporting.

The patch was successfully bootstrapped and tested on x86/x86-64.

Committed as rev. 201454.

2013-08-02  Vladimir Makarov  <vmaka...@redhat.com>

        PR rtl-optimization/58048
        * lra-constraints.c (process_alt_operands): Don't check asm
        operand on register.

2013-08-02  Vladimir Makarov  <vmaka...@redhat.com>

        PR rtl-optimization/58048
        * gcc.target/i386/pr58048.c: New.

Index: lra-constraints.c
===================================================================
--- lra-constraints.c   (revision 201438)
+++ lra-constraints.c   (working copy)
@@ -1892,7 +1892,7 @@ process_alt_operands (int only_alternati
 
              /* For asms, verify that the class for this alternative is 
possible
                 for the mode that is specified.  */
-             if (!no_regs_p && REG_P (op) && INSN_CODE (curr_insn) < 0)
+             if (!no_regs_p && INSN_CODE (curr_insn) < 0)
                {
                  int i;
                  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
Index: testsuite/gcc.target/i386/pr58048.c
===================================================================
--- testsuite/gcc.target/i386/pr58048.c (revision 0)
+++ testsuite/gcc.target/i386/pr58048.c (working copy)
@@ -0,0 +1,11 @@
+/* PR target/58048 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+void
+div3 (void)
+{
+    double tmp1;
+
+    asm volatile ("fscale":"=t" (tmp1):"0" (0), "u" (0)); /* { dg-error 
"inconsistent operand constraints in an 'asm'"  } */
+}

Reply via email to