Patchwork Restore backwards compatibility of ppc inline asm with asm dialects (PR target/56256)

login
register
mail settings
Submitter Jakub Jelinek
Date Feb. 9, 2013, 8:21 a.m.
Message ID <20130209082144.GS4385@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/219375/
State New
Headers show

Comments

Jakub Jelinek - Feb. 9, 2013, 8:21 a.m.
Hi!

When old mnemonics support has been dropped, the ASSEMBLER_DIALECT
macro has been removed also.  This has unfortunate effect that
projects that used {|} in inline asm for ppc no longer compile, as the
{, | and } characters are now passed through to the assembler.

This patch defines ASSEMBLER_DIALECT again to fix this.

Bootstrapped/regtested on powerpc-linux and powerpc64-linux, ok for trunk?

2013-02-09  Jakub Jelinek  <jakub@redhat.com>

	PR target/56256
	* config/rs6000/rs6000.h (ASSEMBLER_DIALECT): Define.

	* gcc.target/powerpc/pr56256.c: New test.


	Jakub
David Edelsohn - Feb. 9, 2013, 9:26 a.m.
On Sat, Feb 9, 2013 at 3:21 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> When old mnemonics support has been dropped, the ASSEMBLER_DIALECT
> macro has been removed also.  This has unfortunate effect that
> projects that used {|} in inline asm for ppc no longer compile, as the
> {, | and } characters are now passed through to the assembler.
>
> This patch defines ASSEMBLER_DIALECT again to fix this.
>
> Bootstrapped/regtested on powerpc-linux and powerpc64-linux, ok for trunk?
>
> 2013-02-09  Jakub Jelinek  <jakub@redhat.com>
>
>         PR target/56256
>         * config/rs6000/rs6000.h (ASSEMBLER_DIALECT): Define.
>
>         * gcc.target/powerpc/pr56256.c: New test.

Okay.

Thanks, David

Patch

--- gcc/config/rs6000/rs6000.h.jj	2013-01-11 09:03:12.000000000 +0100
+++ gcc/config/rs6000/rs6000.h	2013-02-08 16:46:35.988977363 +0100
@@ -356,6 +356,12 @@  extern const char *host_detect_local_cpu
 #define PROCESSOR_DEFAULT   PROCESSOR_PPC603
 #define PROCESSOR_DEFAULT64 PROCESSOR_RS64A
 
+/* Specify the dialect of assembler to use.  Only new mnemonics are supported
+   starting with GCC 4.8, i.e. just one dialect, but for backwards
+   compatibility with older inline asm ASSEMBLER_DIALECT needs to be
+   defined.  */
+#define ASSEMBLER_DIALECT 1
+
 /* Debug support */
 #define MASK_DEBUG_STACK	0x01	/* debug stack applications */
 #define	MASK_DEBUG_ARG		0x02	/* debug argument handling */
--- gcc/testsuite/gcc.target/powerpc/pr56256.c.jj	2013-02-08 17:00:11.096171281 +0100
+++ gcc/testsuite/gcc.target/powerpc/pr56256.c	2013-02-08 17:09:05.448004295 +0100
@@ -0,0 +1,11 @@ 
+/* PR target/56256 */
+/* { dg-do assemble } */
+/* { dg-options "-O2" } */
+
+int
+foo (void)
+{
+  int a;
+  __asm__ ("{lil|li} %0,%1" : "=r" (a) : "I" (26));
+  return a;
+}