1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-24 15:52:25 +00:00

K7 3dnow-dsp detection

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@735 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
nickols_k 2001-05-09 07:54:56 +00:00
parent e3ca3ab054
commit 0870efee94
2 changed files with 44 additions and 11 deletions

28
configure vendored
View File

@ -81,6 +81,7 @@ params:
--enable-mmx build with mmx support [autodetect]
--enable-mmx2 build with mmx2 support (PIII, Athlon) [autodetect]
--enable-3dnow build with 3dnow! support [autodetect]
--enable-3dnowex build with 3dnow-dsp! support (K7) [autodetect]
--enable-sse build with sse support [autodetect]
--enable-gl build with OpenGL render support [autodetect]
--enable-dga build with DGA support [autodetect]
@ -196,6 +197,7 @@ pstepping=`cat /proc/cpuinfo | grep 'stepping' | cut -d ':' -f 2 | cut -d ' ' -f
_mmx=no
_mmx2=no
_3dnow=no
_3dnowex=no
_mtrr=no
_sse=no
@ -238,6 +240,11 @@ for i in `echo $pparam`; do
_3dnow=yes
_mpg123=yes
;;
3dnowext)
_3dnow=yes
_3dnowex=yes
_mpg123=yes
;;
mmx)
_mmx=yes
;;
@ -531,6 +538,10 @@ do
--enable-3dnow)
_3dnow=yes
;;
--enable-3dnowex)
_3dnow=yes
_3dnowex=yes
;;
--enable-mmx)
_mmx=yes
;;
@ -605,6 +616,10 @@ do
;;
--disable-3dnow)
_3dnow=no
_3dnowex=no
;;
--disable-3dnowex)
_3dnowex=no
;;
--disable-mmx)
_mmx=no
@ -703,6 +718,7 @@ echo "Optimizing to ... $proc"
echo "Checking for mmx support ... $_mmx"
echo "Checking for mmx2 support ... $_mmx2"
echo "Checking for 3dnow support ... $_3dnow"
echo "Checking for 3dnowex support ... $_3dnowex"
echo "Checking for sse support ... $_sse"
echo "Checking for mtrr support ... $_mtrr"
echo "Screen size ... ${_x}x${_y}"
@ -870,6 +886,12 @@ else
_3dnowm='#undef HAVE_3DNOW'
fi
if [ $_3dnowex = yes ]; then
_3dnowexm='#define HAVE_3DNOWEX'
else
_3dnowexm='#undef HAVE_3DNOWEX'
fi
if [ $_sse = yes ]; then
_ssem='#define HAVE_SSE'
else
@ -1081,6 +1103,7 @@ $_png
/* Extension defines */
$_mlib // available only on solaris
$_3dnowm // only define if you have 3DNOW (AMD k6-2, AMD Athlon, iDT WinChip, etc.)
$_3dnowexm // only define if you have 3DNOWEX (AMD Athlon, etc.)
$_mmx // only define if you have MMX
$_mmx2 // only define if you have MMX2
$_ssem // only define if you have SSE (Intel Pentium III or Celeron II)
@ -1154,6 +1177,10 @@ EOF
echo "Creating mp3lib/config.mak"
if [ $_3dnowex = yes ]; then
_3dnowobjectsrcs='dct36_k7.s dct64_k7.s decode_k7.s dct36_3dnow.s dct64_3dnow.s decode_3dnow.s'
_3dnowobjectobjs='dct36_k7.o dct64_k7.o decode_k7.o dct36_3dnow.o dct64_3dnow.o decode_3dnow.o'
else
if [ $_3dnow = yes ]; then
_3dnowobjectsrcs='dct36_3dnow.s dct64_3dnow.s decode_3dnow.s'
_3dnowobjectobjs='dct36_3dnow.o dct64_3dnow.o decode_3dnow.o'
@ -1161,6 +1188,7 @@ else
_3dnowobjectsrcs=
_3dnowobjectobjs=
fi
fi
cat > mp3lib/config.mak << EOF

View File

@ -1,7 +1,7 @@
/ ---------------------------------------------------------------------------
/ Cpu function detect by Pontscho/fresh!mindworkz
/ (c) 2000 - 2000
/ Cpu function detect by Pontscho/fresh!mindworkz (c) 2000 - 2000
/ 3dnow-dsp detection by Nick Kurshev (C) 2001
/ ---------------------------------------------------------------------------
.text
@ -62,7 +62,9 @@ exit:
/ ---------------------------------------------------------------------------
/ in C: unsigned long a3dnow( void );
/ return: 0 if this processor not requiment 3dnow! else above 1.
/ return: 0 if this processor does not support 3dnow!
/ 1 otherwise
/ 2 if this cpu supports 3dnow-dsp extension
/ ---------------------------------------------------------------------------
a3dnow:
pushl %ebx
@ -71,21 +73,24 @@ a3dnow:
call ipentium
shrl $1,%eax
jnc no_3dnow
testl %eax,%eax
jz exit2
movl $0x80000000,%eax
cpuid
cmpl $0x80000000,%eax
jbe no_3dnow
jbe exit2
movl $0x80000001,%eax
cpuid
testl $0x80000000,%edx
jz no_3dnow
movl $1,%eax
jmp exit2
no_3dnow:
xorl %eax,%eax
testl $0x80000000,%edx
jz exit2
/// eax=1 - K6 3DNow!
inc %eax
testl $0x40000000,%edx
jz exit2
/// eax=2 - K7 3DNowEx!
inc %eax
exit2:
popl %ecx