[MPlayer-dev-eng] [PATCH] cpu detection for core2

Loren Merritt lorenm at u.washington.edu
Sun Jun 3 07:33:46 CEST 2007


The configure code to detect core2 in 64bit mode was different from 32bit 
mode, and didn't work on my core2. This changes it to be the same as 
32-bit mode, which works.

Also, -march=k8 is faster than -march=nocona when run on a core2. Or 
should it be -mtune=k8 with no -march, to avoid amd-specific instructions? 
-march=k8 works for me, but that doesn't mean it's theoretically correct.
(Of course -march=core2 is the most appropriate, but that's only in gcc 
>=4.2)

--Loren Merritt
-------------- next part --------------
--- configure   (revision 23457)
+++ configure   (working copy)
 -1845,13 +1845,13 @@
       AuthenticAMD)
         proc=k8;;
       GenuineIntel)
-        case "$pmodel" in
-        6) proc=core2;;
-        *)
+       if test "$pfamily" -eq 6 -a "$pmodel" -ge 15; then
+         proc=core2
+        else
           # 64-bit prescotts exist, but as far as GCC is concerned they
           # have the same capabilities as a nocona.
-          proc=nocona;;
-        esac
+          proc=nocona
+        fi
         ;;
       *)
         proc=error;;
@@ -1876,6 +1876,9 @@
       fi
       # --- Intel processors ---
       if test "$proc" = "core2"; then
+        cc_check -march=$proc $cpuopt=$proc || proc=k8
+      fi
+      if test "$proc" = "k8"; then
         cc_check -march=$proc $cpuopt=$proc || proc=nocona
       fi
       if test "$proc" = "nocona"; then


More information about the MPlayer-dev-eng mailing list