Patchwork [i386] : Also pass mmx, 3dnow and sseX options with -march=native

login
register
mail settings
Submitter Uros Bizjak
Date May 17, 2013, 8:13 p.m.
Message ID <CAFULd4YVvUS020QV0T1Z5GFukjEq0URLCwL05YWu1iscGHqgMQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/244699/
State New
Headers show

Comments

Uros Bizjak - May 17, 2013, 8:13 p.m.
Hello!

For some reason we didn't pass mmx, 3dnow and sseX options to cc1 with
-march=native. Passing these options will help older processors that
doesn't get detected through architecture recognition functionality to
get all their ISAs enabled.

2013-05-17  Uros Bizjak  <ubizjak@gmail.com>

    * config/i386/driver-i386.c (host_detect_local_cpu): Pass mmx, 3dnow,
    sse, sse2, sse3, ssse3 and sse4a flags to options.

Tested on x86_64-pc-linux-gnu {,-m32} and committed to mainline.

Uros.

Patch

Index: config/i386/driver-i386.c
===================================================================
--- config/i386/driver-i386.c	(revision 198989)
+++ config/i386/driver-i386.c	(working copy)
@@ -786,10 +786,17 @@  const char *host_detect_local_cpu (int argc, const
 
   if (arch)
     {
+      const char *mmx = has_mmx ? " -mmmx" : " -mno-mmx";
+      const char *mmx3dnow = has_3dnow ? " -m3dnow" : " -mno-3dnow";
+      const char *sse = has_sse ? " -msse" : " -mno-sse";
+      const char *sse2 = has_sse2 ? " -msse2" : " -mno-sse2";
+      const char *sse3 = has_sse3 ? " -msse3" : " -mno-sse3";
+      const char *ssse3 = has_ssse3 ? " -mssse3" : " -mno-ssse3";
+      const char *sse4a = has_sse4a ? " -msse4a" : " -mno-sse4a";
       const char *cx16 = has_cmpxchg16b ? " -mcx16" : " -mno-cx16";
       const char *sahf = has_lahf_lm ? " -msahf" : " -mno-sahf";
       const char *movbe = has_movbe ? " -mmovbe" : " -mno-movbe";
-      const char *ase = has_aes ? " -maes" : " -mno-aes";
+      const char *aes = has_aes ? " -maes" : " -mno-aes";
       const char *pclmul = has_pclmul ? " -mpclmul" : " -mno-pclmul";
       const char *popcnt = has_popcnt ? " -mpopcnt" : " -mno-popcnt";
       const char *abm = has_abm ? " -mabm" : " -mno-abm";
@@ -817,7 +824,8 @@  const char *host_detect_local_cpu (int argc, const
       const char *xsave = has_xsave ? " -mxsave" : " -mno-xsave";
       const char *xsaveopt = has_xsaveopt ? " -mxsaveopt" : " -mno-xsaveopt";
 
-      options = concat (options, cx16, sahf, movbe, ase, pclmul,
+      options = concat (options, mmx, mmx3dnow, sse, sse2, sse3, ssse3,
+			sse4a, cx16, sahf, movbe, aes, pclmul,
 			popcnt, abm, lwp, fma, fma4, xop, bmi, bmi2,
 			tbm, avx, avx2, sse4_2, sse4_1, lzcnt, rtm,
 			hle, rdrnd, f16c, fsgsbase, rdseed, prfchw, adx,