[PATCH] Pass -mtune and -march options to assembler.

Valdimir Volynsky vvv@ru.ru
Thu Jun 4 15:56:00 GMT 2009


  "Joseph S. Myers" <joseph@codesourcery.com> wrote:
> If you ignore feedback on your patches and send patches 
> with the same problems as before and no explanation of
> why you are ignoring the feedback, people are just going
> to ignore your submissions in future.  
> Specifically, see Richard Earnshaw's message 
> <http://gcc.gnu.org/ml/gcc-patches/2009-05/msg01809.html>; 
> you have to understand how target dependencies are
> encapsulated in GCC and put target-dependent code in
> target-dependent files, not in generic files such as gcc.c.

Good. Let's use specs.How about this patch?

2009-06-04  Vladimir Volynsky  <vvv@ru.ru>

	PR target/40171
	* config/i386/linux64.h (ASM_SPEC): Pass -mtune to the 
GNU assembler.
	* config/i386/mingw-w64.h (ASM_SPEC): Likewise.
	* config/i386/sol2-10.h (ASM_SPEC): Likewise.
	* config/i386/x86-64.h (ASM_SPEC): Likewise.

--- gcc/config/i386/linux64.h	2009-06-03 
23:52:24.000000000 +0400
+++ gcc/config/i386/linux64.h.vv	2009-06-04 
00:57:07.000000000 +0400
@@ -62,9 +62,21 @@ see the files COPYING3 and 
COPYING.RUNTI
  #define GLIBC_DYNAMIC_LINKER64 
"/lib64/ld-linux-x86-64.so.2"
  
  #undef ASM_SPEC
+#ifdef HAVE_GNU_AS
+#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} 
%{Ym,*} %{Yd,*} \
+ %{Wa,*:%*} %{m32:--32} %{m64:--64} \
+ %{!mno-sse2avx:%{mavx:-msse2avx}} 
%{msse2avx:%{!mavx:-msse2avx}} \
+ %{mtune=i386} %{mtune=i486} \
+ %{mtune=pentium} %{mtune=pentiumpro} %{mtune=pentium4} \
+ %{mtune=prescott} %{mtune=nocona} %{mtune=core2} \
+ %{mtune=k6} %{mtune=k8} %{mtune=athlon} 
%{mtune=amdfam10} \
+ %{mtune=pentium2:-mtune=pentiumii} 
%{mtune=pentium3:-mtune=pentiumiii} \
+ %{mtune=k6-2:-mtune=k6_2}"
+#else
  #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} 
%{Ym,*} %{Yd,*} \
   %{Wa,*:%*} %{m32:--32} %{m64:--64} \
   %{!mno-sse2avx:%{mavx:-msse2avx}} 
%{msse2avx:%{!mavx:-msse2avx}}"
+#endif
  
  #if TARGET_64BIT_DEFAULT
  #define SPEC_32 "m32"

--- gcc/config/i386/mingw-w64.h	2009-06-04 
19:17:12.000000000 +0400
+++ gcc/config/i386/mingw-w64.h.vv	2009-06-04 
01:00:01.000000000 +0400
@@ -40,8 +40,19 @@ along with GCC; see the file COPYING3.
  /* Enable multilib.  */
  
  #undef ASM_SPEC
+#ifdef HAVE_GNU_AS
+#define ASM_SPEC "%{v:-V} %{n} %{T} %{Ym,*} %{Yd,*} \
+ %{Wa,*:%*} %{m32:--32} %{m64:--64} \
+ %{mtune=i386} %{mtune=i486} \
+ %{mtune=pentium} %{mtune=pentiumpro} %{mtune=pentium4} \
+ %{mtune=prescott} %{mtune=nocona} %{mtune=core2} \
+ %{mtune=k6} %{mtune=k8} %{mtune=athlon} 
%{mtune=amdfam10} \
+ %{mtune=pentium2:-mtune=pentiumii} 
%{mtune=pentium3:-mtune=pentiumiii} \
+ %{mtune=k6-2:-mtune=k6_2}"
+#else
  #define ASM_SPEC "%{v:-V} %{n} %{T} %{Ym,*} %{Yd,*} \
   %{Wa,*:%*} %{m32:--32} %{m64:--64}"
+#endif
  
  #if TARGET_64BIT_DEFAULT
  #define SPEC_32 "m32"

--- gcc/config/i386/sol2-10.h	2009-06-04 
19:17:33.000000000 +0400
+++ gcc/config/i386/sol2-10.h.vv	2009-06-04 
01:03:17.000000000 +0400
@@ -26,7 +26,13 @@ along with GCC; see the file COPYING3.
  #undef ASM_SPEC
  #ifdef USE_GAS
  #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} 
%{Ym,*} %{Yd,*} " \
-		 "%{Wa,*:%*} %{m32:--32} %{m64:--64} -s %(asm_cpu)"
+		 "%{Wa,*:%*} %{m32:--32} %{m64:--64} -s %(asm_cpu) " \
+		 "%{mtune=i386} %{mtune=i486} " \
+		 "%{mtune=pentium} %{mtune=pentiumpro} 
%{mtune=pentium4} " \
+		 "%{mtune=prescott} %{mtune=nocona} %{mtune=core2} " \
+		 "%{mtune=k6} %{mtune=k8} %{mtune=athlon} 
%{mtune=amdfam10} " \
+		 "%{mtune=pentium2:-mtune=pentiumii} 
%{mtune=pentium3:-mtune=pentiumiii} " \
+		 "%{mtune=k6-2:-mtune=k6_2}"
  #else
  #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} 
%{Ym,*} %{Yd,*} " \
  		 "%{Wa,*:%*} %{m32:-xarch=generic} 
%{m64:-xarch=generic64} " \

--- gcc/config/i386/x86-64.h	2009-06-04 19:17:44.000000000 
+0400
+++ gcc/config/i386/x86-64.h.vv	2009-06-04 
00:59:44.000000000 +0400
@@ -52,8 +52,19 @@ see the files COPYING3 and 
COPYING.RUNTI
  #define CC1_SPEC "%(cc1_cpu) %{profile:-p}"
  
  #undef ASM_SPEC
+#ifdef HAVE_GNU_AS
+#define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} 
%{Ym,*} %{Yd,*} \
+ %{Wa,*:%*} %{m32:--32} %{m64:--64} \
+ %{mtune=i386} %{mtune=i486} \
+ %{mtune=pentium} %{mtune=pentiumpro} %{mtune=pentium4} \
+ %{mtune=prescott} %{mtune=nocona} %{mtune=core2} \
+ %{mtune=k6} %{mtune=k8} %{mtune=athlon} 
%{mtune=amdfam10} \
+ %{mtune=pentium2:-mtune=pentiumii} 
%{mtune=pentium3:-mtune=pentiumiii} \
+ %{mtune=k6-2:-mtune=k6_2}"
+#else
  #define ASM_SPEC "%{v:-V} %{Qy:} %{!Qn:-Qy} %{n} %{T} 
%{Ym,*} %{Yd,*} \
   %{Wa,*:%*} %{m32:--32} %{m64:--64}"
+#endif
  
  #undef ASM_OUTPUT_ALIGNED_BSS
  #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, 
ALIGN) \


Regards,
  Vladimir Volynsky

---
Professional hosting for everyone - http://www.host.ru



More information about the Gcc-patches mailing list