[MPlayer-dev-eng] [PATCH] 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 02:55:12 CEST 2002
> Your test lacks detection of gcc 3.1, because with older gcc those flags to
> compiler won't work.
If some flags don't work, configure will try earlier processors until it
finds a supported one (or realizes that gcc doesn't even support a 386).
There is no need to test for gcc-3.1.
> Also Pentium3/4 detection etc. should be made by cpuid
> not by grepping proc output. Check main/cputable.h for a pretty complete list
> of cpuids.
OK. Done in the following patch, which also includes support for Pentium
MMX, 2, K6s and Athlons. It also changes the default processor to the
most advanced one under the assumption that newer processors will be
both better and compatible with older ones.
Also, k6 now falls back to pentium2 rather than k5 (since it has MMX and
is a 686) and pentium2 falls back to pentium-mmx if pentiumpro is not
available (this is only for completeness since AFAIK all GCCs that
support pentium-mmx also support pentium2).
Any suggestions for the TODOs?
--- /usr/local/src/MPlayer-0.90pre5/configure Sat Jun 8 00:41:25 2002
+++ MPlayer-0.90pre5/configure Tue Jun 11 02:44:54 2002
@@ -573,19 +573,60 @@
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=k5
+ 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=pentium
+ fi
+ ;;
+ 6) iproc=686
+ if test "$pmodel" -ge 7; then
+ proc=pentium3
+ elif test "$pmodel" -ge 3; then
+ proc=pentium2
+ else
+ proc=pentiumpro
+ fi
+ ;;
+ 15) proc=pentium4 iproc=686 ;;
+ *) proc=pentium4 iproc=686 ;;
esac
;;
unknown)
@@ -608,24 +649,53 @@
int main(void) { return 0; }
EOF
if test "$_runtime_cpudetection" = no ; then
- if test "$proc" = "k7" ; then
+ if test "$proc" = "athlon-xp" ; then
+ cc_check -march=$proc -mcpu=$proc || proc=athlon-4
+ fi
+ if test "$proc" = "athlon-4" ; then
+ cc_check -march=$proc -mcpu=$proc || proc=athlon-tbird
+ fi
+ if 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
+ cc_check -march=$proc -mcpu=$proc || proc=k6-3
+ fi
+ if test "$proc" = "k6-3" ; then
+ cc_check -march=$proc -mcpu=$proc || proc=k6-2
+ fi
+ if 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
+ cc_check -march=$proc -mcpu=$proc || proc=pentium2
fi
if test "$proc" = "k5" ; then
cc_check -march=$proc -mcpu=$proc || proc=pentium
fi
+ if test "$proc" = "pentium4" ; then
+ cc_check -march=$proc -mcpu=$proc || proc=pentium3
+ fi
+ if test "$proc" = "pentium3" ; then
+ cc_check -march=$proc -mcpu=$proc || proc=pentium2
+ fi
+ if test "$proc" = "pentium2" ; then
+ # The Pentium2 has MMX so we want to prevent pentium2->pentiumpro->pentium
+ if cc_check -march=pentiumpro -mcpu=pentiumpro; then
+ proc=pentiumpro
+ else
+ proc=pentium-mmx
+ fi
+ 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-mmx" ; then
+ cc_check -march=$proc -mcpu=$proc || proc=pentium
+ fi
if test "$proc" = "pentium" ; then
cc_check -march=$proc -mcpu=$proc || proc=i486
fi
-------------- 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/dd3e0bf6/attachment.pgp>
More information about the MPlayer-dev-eng
mailing list