diff mp3lib/d_cpu.s @ 734:bab1d9b1056a

K7 3dnow-dsp detection
author nickols_k
date Wed, 09 May 2001 07:54:56 +0000
parents 3b5f5d1c5041
children 7705b51ab518
line wrap: on
line diff
--- 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