[MPlayer-dev-eng] [PATCH] (vers. 3) Support GCC 3.1 flags for Pentium MMX,2,3,4, K6s, Athlons using model/stepping (was Re: [PATCH] Add support for -m{arch,cpu}=pentium{3,4} in GCC 3.1)

Luca Barbieri ldb at ldb.ods.org
Tue Jun 11 04:02:26 CEST 2002


> You use much to many fallbacks and some of them are nonsense, so please add 
> the new ones (which are all avaliable in the same gcc release, so no sense to 
> fallback from athlon-xp to athlon-4) and fall back to the now used ones, if 
> not available.
Which are nonsense? (apart from the redundant ones)
If you are referring to k6->pentium2, it seems more correct than falling
back to k5 (which doesn't exist) and then to pentium (that unlike the k6
is 586 and has no MMX).
Anyway, the attached patch directly falls back to GCC 3.0-supported
processors. k5 is removed because it isn't supported and pentium and
pentiumpro are renamed to i586 and i686 (that are equivalent, shorter
and consistent with i386 and i486).

> The current flags are well choosen and need no corrections.
Are you talking about optimization flags? If so, are they well choosen
among all the options available in GCC 3.1?

-------------- next part --------------
--- /usr/local/src/MPlayer-0.90pre5/configure	Sat Jun  8 00:41:25 2002
+++ MPlayer-0.90pre5/configure	Tue Jun 11 03:50:48 2002
@@ -565,41 +565,80 @@
   _def_arch="#define ARCH_X86 1"
   _target_arch="TARGET_ARCH_X86 = yes"
   _def_words_endian="#undef WORDS_BIGENDIAN"
-  iproc=586
-  proc=pentium
 
   case "$pvendor" in
   AuthenticAMD)
     case "$pfamily" in
     3) proc=i386 iproc=386 ;;
     4) proc=i486 iproc=486 ;;
-    5) proc=k5 iproc=586       # LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3
-       test "$pmodel" -ge 6 && proc=k6 ;;
-    6|7) proc=k7 iproc=686 ;;
-    *) proc=pentium iproc=586 ;;
+    5) iproc=686       # LGB: models are: K5/SSA5 K5 K5 K5 ? ? K6 K6 K6-2 K6-3
+	# TODO: how to determine if model 13 is a k6-2 or a k6-3? Couldn't find anything on amd.com
+	if test "$pmodel" == 9; then
+		proc=k6-3
+	elif test "$pmodel" -ge 8; then
+		proc=k6-2
+	elif test "$pmodel" -ge 6; then
+		proc=k6
+	else
+		proc=i586
+		iproc=586
+	fi
+	;;
+    6) iproc=686
+	if test "$pmodel" -ge 7; then
+		proc=athlon-xp # or MP, but it doesn't really matter
+	elif test "$pmodel" -ge 6; then
+		if test "$pstepping" -ge 2; then
+			proc=athlon-xp
+		else
+			proc=athlon-4
+		fi
+	elif test "$pmodel" -ge 4; then
+		proc=athlon-tbird
+	else
+		proc=athlon # TODO: should the Duron Spitfire be considered a Thunderbird instead?
+	fi
+	;;
+    
+    *) proc=athlon-xp iproc=686 ;;
     esac
     ;;
   GenuineIntel)
     case "$pfamily" in
     3) proc=i386 iproc=386 ;;
     4) proc=i486 iproc=486 ;;
-    5) proc=pentium iproc=586 ;;
-    6|15) proc=i686 iproc=686 ;;
-    *) proc=pentium iproc=586 ;;
+    5) iproc=586
+	if test "$pmodel" == 4 || test "$pmodel" == 8; then
+		proc=pentium-mmx # 4 is desktop, 8 is mobile
+	else
+		proc=i586
+	fi
+	;;
+    6) iproc=686
+	if test "$pmodel" -ge 7; then
+		proc=pentium3
+	elif test "$pmodel" -ge 3; then
+		proc=pentium2
+	else
+		proc=i686
+	fi
+	;;
+    15) proc=pentium4 iproc=686 ;;
+    *) proc=pentium4 iproc=686 ;;
     esac
     ;;
   unknown)
     case "$pfamily" in
     3) proc=i386 iproc=386 ;;
     4) proc=i486 iproc=486 ;;
-    *) proc=pentium iproc=586 ;;
+    *) proc=i586 iproc=586 ;;
     esac
     ;;
   *)
-    proc=pentium iproc=586 ;;
+    proc=i586 iproc=586 ;;
   esac
 
-    # check that gcc supports our cpu, if not, fallback to pentium
+    # check that gcc supports our cpu, if not, fallback to earlier ones
     # LGB: check -mcpu and -march swithing step by step with enabling
     # to fall back till 386.
 
@@ -608,25 +647,19 @@
 int main(void) { return 0; }
 EOF
   if test "$_runtime_cpudetection" = no ; then
-    if test "$proc" = "k7" ; then
+    if test "$proc" = "athlon-xp" || test "$proc" = "athlon-4" || test "$proc" = "athlon-tbird"; then
       cc_check -march=$proc -mcpu=$proc || proc=athlon
     fi
-    if test "$proc" = "athlon" ; then
-      cc_check -march=$proc -mcpu=$proc || proc=pentiumpro
+    if test "$proc" = "athlon" || test "$proc" = "k6-3" || test "$proc" = "k6-2"; then
+      cc_check -march=$proc -mcpu=$proc || proc=k6
     fi
-    if test "$proc" = "k6" ; then
-      cc_check -march=$proc -mcpu=$proc  || proc=k5
+    if test "$proc" = "pentium4" || test "$proc" = "pentium3" || test "$proc" = "pentium2" || test "$proc" = "k6"; then
+      cc_check -march=$proc -mcpu=$proc  || proc=i686
     fi
-    if test "$proc" = "k5" ; then
-      cc_check -march=$proc -mcpu=$proc  || proc=pentium
+    if test "$proc" = "i686" || test "$proc" = "pentium-mmx"; then
+      cc_check -march=$proc -mcpu=$proc  || proc=i586
     fi
-    if test "$proc" = "i686" ; then
-      cc_check -march=$proc -mcpu=$proc  || proc=pentiumpro
-    fi
-    if test "$proc" = "pentiumpro" ; then
-      cc_check -march=$proc -mcpu=$proc  || proc=pentium
-    fi
-    if test "$proc" = "pentium" ; then
+    if test "$proc" = "i586" ; then
       cc_check -march=$proc -mcpu=$proc  || proc=i486
     fi
     if test "$proc" = "i486" ; then
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20020611/3b04a578/attachment.pgp>


More information about the MPlayer-dev-eng mailing list