This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, rs6000] Fix PR target/68872, make -mcpu=powerpc64le pass correct assembler option


Currently, -mcpu=powerpc64le correctly sets the TARGET_* flags for an
LE compile, meaning it mimics a -mcpu=power8 compile, but it doesn't
pass the correct -mpower8/-mpwr8 option to the assembler, so we die
with lots of assembler errors on POWER8 instructions.  This patch
fixes things so we pass the correct assembler option when using
-mcpu=powerpc64le.

This passes bootstrap/regtesting on powerpc64le-linux.  Ok for mainline?
Ok for the release branches too after testing?

Peter


gcc/
	PR target/68772
	* config/rs6000/rs6000.h (ASM_CPU_SPEC): For -mcpu=powerpc64le,
	pass %(asm_cpu_power8)/-mpwr8.
	* config/rs6000/aix53.h: Likewise.
	* config/rs6000/aix61.h: Likewise.
	* config/rs6000/aix71.h: Likewise.

gcc/testsuite/
        PR target/68772
        * gcc.target/powerpc/pr68872.c: New test.

Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h	(revision 231887)
+++ gcc/config/rs6000/rs6000.h	(working copy)
@@ -128,6 +128,7 @@
 %{mcpu=power9: %(asm_cpu_power9)} \
 %{mcpu=a2: -ma2} \
 %{mcpu=powerpc: -mppc} \
+%{mcpu=powerpc64le: %(asm_cpu_power8)} \
 %{mcpu=rs64a: -mppc64} \
 %{mcpu=401: -mppc} \
 %{mcpu=403: -m403} \
Index: gcc/config/rs6000/aix53.h
===================================================================
--- gcc/config/rs6000/aix53.h	(revision 231887)
+++ gcc/config/rs6000/aix53.h	(working copy)
@@ -65,6 +65,7 @@
 %{mcpu=power8: -mpwr8} \
 %{mcpu=power9: -mpwr9} \
 %{mcpu=powerpc: -mppc} \
+%{mcpu=powerpc64le: -mpwr8} \
 %{mcpu=rs64a: -mppc} \
 %{mcpu=603: -m603} \
 %{mcpu=603e: -m603} \
Index: gcc/config/rs6000/aix61.h
===================================================================
--- gcc/config/rs6000/aix61.h	(revision 231887)
+++ gcc/config/rs6000/aix61.h	(working copy)
@@ -82,6 +82,7 @@
 %{mcpu=power8: -mpwr8} \
 %{mcpu=power9: -mpwr9} \
 %{mcpu=powerpc: -mppc} \
+%{mcpu=powerpc64le: -mpwr8} \
 %{mcpu=rs64a: -mppc} \
 %{mcpu=603: -m603} \
 %{mcpu=603e: -m603} \
Index: gcc/config/rs6000/aix71.h
===================================================================
--- gcc/config/rs6000/aix71.h	(revision 231887)
+++ gcc/config/rs6000/aix71.h	(working copy)
@@ -81,6 +81,7 @@
 %{mcpu=power7: -mpwr7} \
 %{mcpu=power8: -mpwr8} \
 %{mcpu=powerpc: -mppc} \
+%{mcpu=powerpc64le: -mpwr8} \
 %{mcpu=rs64a: -mppc} \
 %{mcpu=603: -m603} \
 %{mcpu=603e: -m603} \
Index: gcc/testsuite/gcc.target/powerpc/pr68872.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr68872.c	(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/pr68872.c	(working copy)
@@ -0,0 +1,14 @@
+/* PR target/68872 */
+/* { dg-do assemble { target { powerpc64le-*-* } } } */
+/* { dg-options "-mcpu=powerpc64le" } */
+
+/* Verify that -mcpu=powerpc64le passes -mpower8/-mpwr8 to the assembler.  */
+
+long
+bar (unsigned char *ptr, unsigned char val)
+{
+  long ret;
+  asm volatile ("stbcx. %0,0,%1" :: "r" (val), "r" (ptr));
+  asm volatile ("mfcr %0,8" : "=r" (ret) ::);
+  return ret;
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]