Bug 44701 - [4.6 regression] PR44492 fix broke gcc.target/powerpc/asm-es-2.c
Summary: [4.6 regression] PR44492 fix broke gcc.target/powerpc/asm-es-2.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-28 17:34 UTC by Mikael Pettersson
Modified: 2010-07-27 17:58 UTC (History)
3 users (show)

See Also:
Host: powerpc64-unknown-linux-gnu
Target: powerpc64-unknown-linux-gnu
Build: powerpc64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2010-07-06 21:46:33


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikael Pettersson 2010-06-28 17:34:28 UTC
PR44492 was fixed in r161328.  This revision changed the generated code for asm-es-2.c as follows:

--- asm-es-2.s-ok
+++ asm-es-2.s-bad
@@ -23,9 +23,10 @@
 f2:
        .p2align 4,,15
 .L3:
+       addi 3,3,16
 #APP
  # 14 "gcc-4.6-20100626/gcc/testsuite/gcc.target/powerpc/asm-es-2.c" 1
-       asm2u 16(3)
+       asm2 0(3)
  # 0 "" 2
 #NO_APP
        b .L3

Since asm-es-2.c contains

/* { dg-final { scan-assembler "asm2u 16\\(3\\)" } } */

the code doesn't match causing the test case to now FAIL.
Comment 1 Jakub Jelinek 2010-06-29 09:49:19 UTC
Guess something like:

--- gcc/testsuite/gcc.target/powerpc/asm-es-2.c	2009-07-20 20:41:46.000000000 +0200
+++ gcc/testsuite/gcc.target/powerpc/asm-es-2.c	2010-06-29 11:37:05.482959217 +0200
@@ -11,7 +11,7 @@ f2 (int *p)
   while (1)
     {
       p += 4;
-      asm ("asm2%U0 %0" : "=m" (*p));
+      asm ("asm2%U0 %0" : "=m<>" (*p));
     }
 }
 
should fix this.
Comment 2 Mikael Pettersson 2010-06-29 11:00:51 UTC
(In reply to comment #1)
> -      asm ("asm2%U0 %0" : "=m" (*p));
> +      asm ("asm2%U0 %0" : "=m<>" (*p));

That fixed the test case.  Thanks.  I didn't know about the PowerPC-specific %U thing, but now I see that the compiler did the right thing.

Seems like the descriptions of "m" and "es" in the PowerPC-specific part of md.texi are now a bit stale: "es" should be equivalent to "m", and "m" should be safe (free of side-effects) unless accompanied by "<" or ">".
Comment 3 Andrew Pinski 2010-07-06 21:46:32 UTC
Confirmed.
Comment 4 Pat Haugen 2010-07-12 21:03:36 UTC
Adding '<>' to the "=m" constraint fixes the testcase, but adding a single '>' (or '<') results in an error for impossible constraints. This is caused by the following snippet that was added to reload1.c:

                      switch (GET_CODE (XEXP (recog_data.operand[opno], 0)))
                        {
                        case PRE_INC:
                        case POST_INC:
                        case PRE_DEC:
                        case POST_DEC:
                        case PRE_MODIFY:
                        case POST_MODIFY:
                          if (strchr (recog_data.constraints[opno], '<') == NULL
                              || strchr (recog_data.constraints[opno], '>')
                                 == NULL)
                            return 0;
                          break;

Should the code be using '&&' instead of '||'?
Comment 5 Pat Haugen 2010-07-12 21:05:54 UTC
Sorry, recog.c is where the prior code snippet came from.
Comment 6 Jakub Jelinek 2010-07-13 14:04:04 UTC
Subject: Bug 44701

Author: jakub
Date: Tue Jul 13 14:03:49 2010
New Revision: 162142

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162142
Log:
	PR testsuite/44701
	* recog.c (constrain_operands): Allow side-effects in memory
	operands if either < or > constraint is used, rather than if
	both < and > is used.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/recog.c

Comment 7 Richard Biener 2010-07-23 12:06:49 UTC
Fixed?
Comment 8 Mikael Pettersson 2010-07-23 12:22:21 UTC
(In reply to comment #7)
> Fixed?

No, the test case itself needs a fix too.  Jakub posted it to gcc-patches, but it was never approved AFAIK and is still not applied.
Comment 9 Jakub Jelinek 2010-07-27 17:53:13 UTC
Subject: Bug 44701

Author: jakub
Date: Tue Jul 27 17:52:35 2010
New Revision: 162581

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=162581
Log:
	PR testsuite/44701
	* doc/md.texi: Clarify m and es constraints on PowerPC and m and S
	constraints on IA-64.

	* gcc.target/powerpc/asm-es-2.c (f2): Add <> constraints.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/doc/md.texi
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.target/powerpc/asm-es-2.c

Comment 10 Jakub Jelinek 2010-07-27 17:58:27 UTC
Should be fixed now.