annotate mp3lib/d_cpu.s @ 988:c6f88600d409

Enable to avoid checking version of gcc. New tests of as
author nickols_k
date Mon, 04 Jun 2001 09:38:18 +0000
parents c0131b42214a
children 03b7e2955a20
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
2 / ---------------------------------------------------------------------------
734
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
3 / Cpu function detect by Pontscho/fresh!mindworkz (c) 2000 - 2000
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
4 / 3dnow-dsp detection by Nick Kurshev (C) 2001
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
5 / ---------------------------------------------------------------------------
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
6
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
7 .text
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
8
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
9 .globl CpuDetect
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
10 .globl ipentium
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
11 .globl a3dnow
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
12
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
13 / ---------------------------------------------------------------------------
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
14 / in C: unsigned long CpuDetect( void );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
15 / return: cpu ident number.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
16 / ---------------------------------------------------------------------------
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
17 CpuDetect:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
18 pushl %ebx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
19 pushl %ecx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
20 pushl %edx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
21
738
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
22 pushfl
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
23 popl %eax
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
24 movl %eax,%ebx
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
25 xorl $0x00200000,%eax
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
26 pushl %eax
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
27 popfl
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
28 pushfl
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
29 popl %eax
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
30 cmpl %eax,%ebx
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
31 jz no_cpuid_cpudetect
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
32
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
33 movl $1,%eax
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
34 cpuid
738
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
35
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
36 jmp exit_cpudetect
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
37 no_cpuid_cpudetect:
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
38 xorl %eax,%eax
7705b51ab518 cpuid bug fixed. remelem.
pontscho
parents: 734
diff changeset
39 exit_cpudetect:
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
40
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
41 popl %edx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
42 popl %ecx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
43 popl %ebx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
44 ret
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
45
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
46 / ---------------------------------------------------------------------------
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
47 / in C: unsigled long ipentium( void );
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
48 / return: 0 if the processor is not P5 or above else above 1.
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
49 / ---------------------------------------------------------------------------
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
50 ipentium:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
51 pushl %ebx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
52 pushl %ecx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
53 pushl %edx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
54 pushfl
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
55 popl %eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
56 movl %eax,%ebx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
57 xorl $0x00200000,%eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
58 pushl %eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
59 popfl
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
60 pushfl
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
61 popl %eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
62 cmpl %eax,%ebx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
63 jz no_cpuid
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
64 movl $1,%eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
65 cpuid
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
66 shrl $8,%eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
67 cmpl $5,%eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
68 jb no_cpuid
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
69 movl $1,%eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
70 jmp exit
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
71 no_cpuid:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
72 xorl %eax,%eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
73 exit:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
74 popl %edx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
75 popl %ecx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
76 popl %ebx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
77 ret
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
78
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
79 / ---------------------------------------------------------------------------
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
80 / in C: unsigned long a3dnow( void );
734
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
81 / return: 0 if this processor does not support 3dnow!
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
82 / 1 otherwise
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
83 / 2 if this cpu supports 3dnow-dsp extension
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
84 / ---------------------------------------------------------------------------
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
85 a3dnow:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
86 pushl %ebx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
87 pushl %edx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
88 pushl %ecx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
89
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
90
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
91 call ipentium
734
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
92 testl %eax,%eax
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
93 jz exit2
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
94
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
95 movl $0x80000000,%eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
96 cpuid
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
97 cmpl $0x80000000,%eax
734
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
98 jbe exit2
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
99 movl $0x80000001,%eax
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
100 cpuid
734
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
101 xorl %eax,%eax
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
102 testl $0x80000000,%edx
734
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
103 jz exit2
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
104 /// eax=1 - K6 3DNow!
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
105 inc %eax
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
106 testl $0x40000000,%edx
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
107 jz exit2
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
108 /// eax=2 - K7 3DNowEx!
bab1d9b1056a K7 3dnow-dsp detection
nickols_k
parents: 1
diff changeset
109 inc %eax
1
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
110 exit2:
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
111
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
112 popl %ecx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
113 popl %edx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
114 popl %ebx
3b5f5d1c5041 Initial revision
arpi_esp
parents:
diff changeset
115 ret