comparison 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
comparison
equal deleted inserted replaced
733:97a4bb050fae 734:bab1d9b1056a
1 1
2 / --------------------------------------------------------------------------- 2 / ---------------------------------------------------------------------------
3 / Cpu function detect by Pontscho/fresh!mindworkz 3 / Cpu function detect by Pontscho/fresh!mindworkz (c) 2000 - 2000
4 / (c) 2000 - 2000 4 / 3dnow-dsp detection by Nick Kurshev (C) 2001
5 / --------------------------------------------------------------------------- 5 / ---------------------------------------------------------------------------
6 6
7 .text 7 .text
8 8
9 .globl CpuDetect 9 .globl CpuDetect
60 popl %ebx 60 popl %ebx
61 ret 61 ret
62 62
63 / --------------------------------------------------------------------------- 63 / ---------------------------------------------------------------------------
64 / in C: unsigned long a3dnow( void ); 64 / in C: unsigned long a3dnow( void );
65 / return: 0 if this processor not requiment 3dnow! else above 1. 65 / return: 0 if this processor does not support 3dnow!
66 / 1 otherwise
67 / 2 if this cpu supports 3dnow-dsp extension
66 / --------------------------------------------------------------------------- 68 / ---------------------------------------------------------------------------
67 a3dnow: 69 a3dnow:
68 pushl %ebx 70 pushl %ebx
69 pushl %edx 71 pushl %edx
70 pushl %ecx 72 pushl %ecx
71 73
72 74
73 call ipentium 75 call ipentium
74 shrl $1,%eax 76 testl %eax,%eax
75 jnc no_3dnow 77 jz exit2
76 78
77 movl $0x80000000,%eax 79 movl $0x80000000,%eax
78 cpuid 80 cpuid
79 cmpl $0x80000000,%eax 81 cmpl $0x80000000,%eax
80 jbe no_3dnow 82 jbe exit2
81 movl $0x80000001,%eax 83 movl $0x80000001,%eax
82 cpuid 84 cpuid
85 xorl %eax,%eax
83 testl $0x80000000,%edx 86 testl $0x80000000,%edx
84 jz no_3dnow 87 jz exit2
85 movl $1,%eax 88 /// eax=1 - K6 3DNow!
86 jmp exit2 89 inc %eax
87 no_3dnow: 90 testl $0x40000000,%edx
88 xorl %eax,%eax 91 jz exit2
92 /// eax=2 - K7 3DNowEx!
93 inc %eax
89 exit2: 94 exit2:
90 95
91 popl %ecx 96 popl %ecx
92 popl %edx 97 popl %edx
93 popl %ebx 98 popl %ebx