changeset 734:bab1d9b1056a

K7 3dnow-dsp detection
author nickols_k
date Wed, 09 May 2001 07:54:56 +0000
parents 97a4bb050fae
children 7fc213046812
files configure mp3lib/d_cpu.s
diffstat 2 files changed, 44 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Wed May 09 05:52:59 2001 +0000
+++ b/configure	Wed May 09 07:54:56 2001 +0000
@@ -81,6 +81,7 @@
         --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 @@
 _mmx=no
 _mmx2=no
 _3dnow=no
+_3dnowex=no
 _mtrr=no
 _sse=no
 
@@ -238,6 +240,11 @@
         _3dnow=yes
         _mpg123=yes
         ;;
+  3dnowext)
+        _3dnow=yes
+        _3dnowex=yes
+        _mpg123=yes
+        ;;
   mmx)
         _mmx=yes
         ;;
@@ -531,6 +538,10 @@
   --enable-3dnow)
         _3dnow=yes
         ;;
+  --enable-3dnowex)
+        _3dnow=yes
+        _3dnowex=yes
+        ;;
   --enable-mmx)
         _mmx=yes
         ;;
@@ -605,6 +616,10 @@
         ;;
   --disable-3dnow)
         _3dnow=no
+        _3dnowex=no
+        ;;
+  --disable-3dnowex)
+        _3dnowex=no
         ;;
   --disable-mmx)
         _mmx=no
@@ -703,6 +718,7 @@
 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 @@
  _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 @@
 /* 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 @@
 
 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 @@
  _3dnowobjectsrcs=
  _3dnowobjectobjs=
 fi
+fi
 
 cat > mp3lib/config.mak << EOF
 
--- a/mp3lib/d_cpu.s	Wed May 09 05:52:59 2001 +0000
+++ b/mp3lib/d_cpu.s	Wed May 09 07:54:56 2001 +0000
@@ -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 @@
 
 / ---------------------------------------------------------------------------
 /  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 @@
 
 
         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
+        xorl   %eax,%eax
         testl  $0x80000000,%edx
-        jz     no_3dnow
-        movl   $1,%eax
-        jmp    exit2
-no_3dnow:
-        xorl   %eax,%eax
+        jz     exit2
+/// eax=1 - K6 3DNow!
+        inc    %eax
+        testl  $0x40000000,%edx
+        jz     exit2
+/// eax=2 - K7 3DNowEx!	
+        inc    %eax
 exit2:
 
         popl   %ecx