[MPlayer-dev-eng] [PATCH] configure: use -march=native when available

Zuxy Meng zuxy.meng at gmail.com
Thu Aug 16 10:04:48 CEST 2007


Hi,

gcc 4.2 supports 'native' as an option to 'march' and 'mtune'. And gcc
will translate it into the most appropriate march and mtune options
for the host machine. It's similar to what mplayer's configure's
doing, but refrains us from making the script longer and longer as new
CPUs appears in market. What's more, it provides support for CPUs not
yet covered by existing -march options (for example, it'll choose
-march=prescott -mtune=generic for Yonah).

-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
-------------- next part --------------
Index: configure
===================================================================
--- configure	?????? 24074??
+++ configure	????????????
@@ -1700,6 +1700,7 @@
 	else
 		proc=pentium4
 	fi
+	test $_fast_cmov = "auto" && _fast_cmov=no
 	;;
     *) proc=prescott iproc=686 ;;
     esac
@@ -1756,6 +1757,7 @@
 int main(void) { return 0; }
 EOF
   if test "$_runtime_cpudetection" = no ; then
+    cc_check -march=native && proc=native
     if test "$proc" = "k8"; then
       cc_check -march=$proc $cpuopt=$proc || proc=athlon-xp
     fi
@@ -1843,10 +1845,6 @@
 
     if test $_cmov = "yes" && test $_fast_cmov = "auto" ; then
         _fast_cmov="yes"
-        case "$proc" in
-            pentium4|prescott|nocona)
-                _fast_cmov="no"
-        esac
     else
         _fast_cmov="no"
     fi
@@ -1887,7 +1885,9 @@
         *)
           # 64-bit prescotts exist, but as far as GCC is concerned they
           # have the same capabilities as a nocona.
-          proc=nocona;;
+          proc=nocona
+          test $_fast_cmov = "auto" && _fast_cmov=no
+          ;;
         esac
         ;;
       *)
@@ -1901,6 +1901,7 @@
 EOF
     # This is a stripped-down version of the i386 fallback.
     if test "$_runtime_cpudetection" = no ; then
+      cc_check -march=native && proc=native
       # --- AMD processors ---
       if test "$proc" = "k8"; then
         cc_check -march=$proc $cpuopt=$proc || proc=athlon-xp


More information about the MPlayer-dev-eng mailing list