diff mbox series

[build] Use -xbrace_comment=no with recent Solaris/x86 as

Message ID yddr2tq5hpd.fsf@CeBiTec.Uni-Bielefeld.DE
State New
Headers show
Series [build] Use -xbrace_comment=no with recent Solaris/x86 as | expand

Commit Message

Rainer Orth Oct. 26, 2017, 10:25 a.m. UTC
Recent versions of Solaris/x86 as (based on Studio 12.6 fbe) support
AVX512 insns, but with a caveat as explained in as(1):

       -xbrace_comment=yes

           The  assembler treats the text within the braces {} as comments. If
           you want the text within braces to be  treated  as  regular  AVX512
           instruction, place the text within double braces {{}}.

This was done for backwards compatibility reasons, it seems.  To have
full compatiblity with gas syntax, one needs to pass
-xbrace_comment=no.  The following patch checks if the assembler used
supports that option and passes it on if so.

Bootstrapped without regressions on i386-pc-solaris2.1[01].  Will
install shortly and backport to the gcc-7 and gcc-6 branches.

	Rainer
diff mbox series

Patch

# HG changeset patch
# Parent  bbb7e8e9e5d2b76cd92a4ae42703471b2a14f898
Use -xbrace_comment=no with recent Solaris/x86 as

diff --git a/gcc/config/i386/sol2.h b/gcc/config/i386/sol2.h
--- a/gcc/config/i386/sol2.h
+++ b/gcc/config/i386/sol2.h
@@ -65,8 +65,16 @@  along with GCC; see the file COPYING3.  
 #define ASM_CPU64_DEFAULT_SPEC "-xarch=generic64"
 #endif
 
+/* Since Studio 12.6, as needs -xbrace_comment=no so its AVX512 syntax is
+   fully compatible with gas.  */
+#ifdef HAVE_AS_XBRACE_COMMENT_OPTION
+#define ASM_XBRACE_COMMENT_SPEC "-xbrace_comment=no"
+#else
+#define ASM_XBRACE_COMMENT_SPEC ""
+#endif
+
 #undef ASM_CPU_SPEC
-#define ASM_CPU_SPEC "%(asm_cpu_default)"
+#define ASM_CPU_SPEC "%(asm_cpu_default) " ASM_XBRACE_COMMENT_SPEC
 
 /* Don't include ASM_PIC_SPEC.  While the Solaris 10+ assembler accepts -K PIC,
    it gives many warnings: 
diff --git a/gcc/configure.ac b/gcc/configure.ac
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -4033,6 +4033,11 @@  foo:	nop
 	;;
     esac
 
+    gcc_GAS_CHECK_FEATURE([-xbrace_comment], gcc_cv_as_ix86_xbrace_comment,,
+      [-xbrace_comment=no], [.text],,
+      [AC_DEFINE(HAVE_AS_XBRACE_COMMENT_OPTION, 1,
+		[Define if your assembler supports -xbrace_comment option.])])
+
     # Test if the assembler supports the section flag 'e' for specifying
     # an excluded section.
     gcc_GAS_CHECK_FEATURE([.section with e], gcc_cv_as_section_has_e,