Mercurial > mplayer.hg
comparison mp3lib/decode_i586.c @ 4147:4bbdda22003d
S->C
author | nick |
---|---|
date | Mon, 14 Jan 2002 09:32:51 +0000 |
parents | |
children | 3f677202418b |
comparison
equal
deleted
inserted
replaced
4146:925046ea34ec | 4147:4bbdda22003d |
---|---|
1 /* | |
2 * mpg123_synth_1to1 works the same way as the c version of this | |
3 * file. only two types of changes have been made: | |
4 * - reordered floating point instructions to | |
5 * prevent pipline stalls | |
6 * - made WRITE_SAMPLE use integer instead of | |
7 * (slower) floating point | |
8 * all kinds of x86 processors should benefit from these | |
9 * modifications. | |
10 * | |
11 * useful sources of information on optimizing x86 code include: | |
12 * | |
13 * Intel Architecture Optimization Manual | |
14 * http://www.intel.com/design/pentium/manuals/242816.htm | |
15 * | |
16 * Cyrix 6x86 Instruction Set Summary | |
17 * ftp://ftp.cyrix.com/6x86/6x-dbch6.pdf | |
18 * | |
19 * AMD-K5 Processor Software Development | |
20 * http://www.amd.com/products/cpg/techdocs/appnotes/20007e.pdf | |
21 * | |
22 * Stefan Bieschewski <stb@acm.org> | |
23 * | |
24 * $Id$ | |
25 */ | |
26 #define real float /* ugly - but only way */ | |
27 | |
28 static long buffs[1088]; | |
29 static long bo=1; | |
30 | |
31 int synth_1to1_pent(real *bandPtr, int channel, short *samples) | |
32 { | |
33 real tmp[3]; | |
34 register int retval; | |
35 __asm __volatile( | |
36 " movl %1,%%eax\n\t"/*bandPtr*/ | |
37 " movl %3,%%esi\n\t" | |
38 " xorl %%edi,%%edi\n\t" | |
39 " movl bo,%%ebp\n\t" | |
40 " cmpl %%edi,%2\n\t" | |
41 " jne .L48\n\t" | |
42 " decl %%ebp\n\t" | |
43 " andl $15,%%ebp\n\t" | |
44 " movl %%ebp,bo\n\t" | |
45 " movl $buffs,%%ecx\n\t" | |
46 " jmp .L49\n\t" | |
47 ".L48:\n\t" | |
48 " addl $2,%%esi\n\t" | |
49 " movl $buffs+2176,%%ecx\n\t" | |
50 ".L49:\n\t" | |
51 " testl $1,%%ebp\n\t" | |
52 " je .L50\n\t" | |
53 " movl %%ecx,%%ebx\n\t" | |
54 " movl %%ebp,%4\n\t" | |
55 " pushl %%eax\n\t" | |
56 " movl 4+%4,%%edx\n\t" | |
57 " leal (%%ebx,%%edx,4),%%eax\n\t" | |
58 " pushl %%eax\n\t" | |
59 " movl 8+%4,%%eax\n\t" | |
60 " incl %%eax\n\t" | |
61 " andl $15,%%eax\n\t" | |
62 " leal 1088(,%%eax,4),%%eax\n\t" | |
63 " addl %%ebx,%%eax\n\t" | |
64 " jmp .L74\n\t" | |
65 ".L50:\n\t" | |
66 " leal 1088(%%ecx),%%ebx\n\t" | |
67 " leal 1(%%ebp),%%edx\n\t" | |
68 " movl %%edx,%4\n\t" | |
69 " pushl %%eax\n\t" | |
70 " leal 1092(%%ecx,%%ebp,4),%%eax\n\t" | |
71 " pushl %%eax\n\t" | |
72 " leal (%%ecx,%%ebp,4),%%eax\n\t" | |
73 ".L74:\n\t" | |
74 " pushl %%eax\n\t" | |
75 " call dct64\n\t" | |
76 " addl $12,%%esp\n\t" | |
77 " movl %4,%%edx\n\t" | |
78 " leal 0(,%%edx,4),%%edx\n\t" | |
79 " movl $decwin+64,%%eax\n\t" | |
80 " movl %%eax,%%ecx\n\t" | |
81 " subl %%edx,%%ecx\n\t" | |
82 " movl $16,%%ebp\n\t" | |
83 ".L55:\n\t" | |
84 " flds (%%ecx)\n\t" | |
85 " fmuls (%%ebx)\n\t" | |
86 " flds 4(%%ecx)\n\t" | |
87 " fmuls 4(%%ebx)\n\t" | |
88 " fxch %%st(1)\n\t" | |
89 " flds 8(%%ecx)\n\t" | |
90 " fmuls 8(%%ebx)\n\t" | |
91 " fxch %%st(2)\n\t" | |
92 " fsubrp %%st,%%st(1)\n\t" | |
93 " flds 12(%%ecx)\n\t" | |
94 " fmuls 12(%%ebx)\n\t" | |
95 " fxch %%st(2)\n\t" | |
96 " faddp %%st,%%st(1)\n\t" | |
97 " flds 16(%%ecx)\n\t" | |
98 " fmuls 16(%%ebx)\n\t" | |
99 " fxch %%st(2)\n\t" | |
100 " fsubrp %%st,%%st(1)\n\t" | |
101 " flds 20(%%ecx)\n\t" | |
102 " fmuls 20(%%ebx)\n\t" | |
103 " fxch %%st(2)\n\t" | |
104 " faddp %%st,%%st(1)\n\t" | |
105 " flds 24(%%ecx)\n\t" | |
106 " fmuls 24(%%ebx)\n\t" | |
107 " fxch %%st(2)\n\t" | |
108 " fsubrp %%st,%%st(1)\n\t" | |
109 " flds 28(%%ecx)\n\t" | |
110 " fmuls 28(%%ebx)\n\t" | |
111 " fxch %%st(2)\n\t" | |
112 " faddp %%st,%%st(1)\n\t" | |
113 " flds 32(%%ecx)\n\t" | |
114 " fmuls 32(%%ebx)\n\t" | |
115 " fxch %%st(2)\n\t" | |
116 " fsubrp %%st,%%st(1)\n\t" | |
117 " flds 36(%%ecx)\n\t" | |
118 " fmuls 36(%%ebx)\n\t" | |
119 " fxch %%st(2)\n\t" | |
120 " faddp %%st,%%st(1)\n\t" | |
121 " flds 40(%%ecx)\n\t" | |
122 " fmuls 40(%%ebx)\n\t" | |
123 " fxch %%st(2)\n\t" | |
124 " fsubrp %%st,%%st(1)\n\t" | |
125 " flds 44(%%ecx)\n\t" | |
126 " fmuls 44(%%ebx)\n\t" | |
127 " fxch %%st(2)\n\t" | |
128 " faddp %%st,%%st(1)\n\t" | |
129 " flds 48(%%ecx)\n\t" | |
130 " fmuls 48(%%ebx)\n\t" | |
131 " fxch %%st(2)\n\t" | |
132 " fsubrp %%st,%%st(1)\n\t" | |
133 " flds 52(%%ecx)\n\t" | |
134 " fmuls 52(%%ebx)\n\t" | |
135 " fxch %%st(2)\n\t" | |
136 " faddp %%st,%%st(1)\n\t" | |
137 " flds 56(%%ecx)\n\t" | |
138 " fmuls 56(%%ebx)\n\t" | |
139 " fxch %%st(2)\n\t" | |
140 " fsubrp %%st,%%st(1)\n\t" | |
141 " flds 60(%%ecx)\n\t" | |
142 " fmuls 60(%%ebx)\n\t" | |
143 " fxch %%st(2)\n\t" | |
144 " subl $4,%%esp\n\t" | |
145 " faddp %%st,%%st(1)\n\t" | |
146 " fxch %%st(1)\n\t" | |
147 " fsubrp %%st,%%st(1)\n\t" | |
148 " fistpl (%%esp)\n\t" | |
149 " popl %%eax\n\t" | |
150 " cmpl $32767,%%eax\n\t" | |
151 " jg 1f\n\t" | |
152 " cmpl $-32768,%%eax\n\t" | |
153 " jl 2f\n\t" | |
154 " movw %%ax,(%%esi)\n\t" | |
155 " jmp 4f\n\t" | |
156 "1: movw $32767,(%%esi)\n\t" | |
157 " jmp 3f\n\t" | |
158 "2: movw $-32768,(%%esi)\n\t" | |
159 "3: incl %%edi\n\t" | |
160 "4:\n\t" | |
161 ".L54:\n\t" | |
162 " addl $64,%%ebx\n\t" | |
163 " subl $-128,%%ecx\n\t" | |
164 " addl $4,%%esi\n\t" | |
165 " decl %%ebp\n\t" | |
166 " jnz .L55\n\t" | |
167 " flds (%%ecx)\n\t" | |
168 " fmuls (%%ebx)\n\t" | |
169 " flds 8(%%ecx)\n\t" | |
170 " fmuls 8(%%ebx)\n\t" | |
171 " flds 16(%%ecx)\n\t" | |
172 " fmuls 16(%%ebx)\n\t" | |
173 " fxch %%st(2)\n\t" | |
174 " faddp %%st,%%st(1)\n\t" | |
175 " flds 24(%%ecx)\n\t" | |
176 " fmuls 24(%%ebx)\n\t" | |
177 " fxch %%st(2)\n\t" | |
178 " faddp %%st,%%st(1)\n\t" | |
179 " flds 32(%%ecx)\n\t" | |
180 " fmuls 32(%%ebx)\n\t" | |
181 " fxch %%st(2)\n\t" | |
182 " faddp %%st,%%st(1)\n\t" | |
183 " flds 40(%%ecx)\n\t" | |
184 " fmuls 40(%%ebx)\n\t" | |
185 " fxch %%st(2)\n\t" | |
186 " faddp %%st,%%st(1)\n\t" | |
187 " flds 48(%%ecx)\n\t" | |
188 " fmuls 48(%%ebx)\n\t" | |
189 " fxch %%st(2)\n\t" | |
190 " faddp %%st,%%st(1)\n\t" | |
191 " flds 56(%%ecx)\n\t" | |
192 " fmuls 56(%%ebx)\n\t" | |
193 " fxch %%st(2)\n\t" | |
194 " subl $4,%%esp\n\t" | |
195 " faddp %%st,%%st(1)\n\t" | |
196 " fxch %%st(1)\n\t" | |
197 " faddp %%st,%%st(1)\n\t" | |
198 " fistpl (%%esp)\n\t" | |
199 " popl %%eax\n\t" | |
200 " cmpl $32767,%%eax\n\t" | |
201 " jg 1f\n\t" | |
202 " cmpl $-32768,%%eax\n\t" | |
203 " jl 2f\n\t" | |
204 " movw %%ax,(%%esi)\n\t" | |
205 " jmp 4f\n\t" | |
206 "1: movw $32767,(%%esi)\n\t" | |
207 " jmp 3f\n\t" | |
208 "2: movw $-32768,(%%esi)\n\t" | |
209 "3: incl %%edi\n\t" | |
210 "4:\n\t" | |
211 ".L62:\n\t" | |
212 " addl $-64,%%ebx\n\t" | |
213 " addl $4,%%esi\n\t" | |
214 " movl %4,%%edx\n\t" | |
215 " leal -128(%%ecx,%%edx,8),%%ecx\n\t" | |
216 " movl $15,%%ebp\n\t" | |
217 ".L68:\n\t" | |
218 " flds -4(%%ecx)\n\t" | |
219 " fchs\n\t" | |
220 " fmuls (%%ebx)\n\t" | |
221 " flds -8(%%ecx)\n\t" | |
222 " fmuls 4(%%ebx)\n\t" | |
223 " fxch %%st(1)\n\t" | |
224 " flds -12(%%ecx)\n\t" | |
225 " fmuls 8(%%ebx)\n\t" | |
226 " fxch %%st(2)\n\t" | |
227 " fsubrp %%st,%%st(1)\n\t" | |
228 " flds -16(%%ecx)\n\t" | |
229 " fmuls 12(%%ebx)\n\t" | |
230 " fxch %%st(2)\n\t" | |
231 " fsubrp %%st,%%st(1)\n\t" | |
232 " flds -20(%%ecx)\n\t" | |
233 " fmuls 16(%%ebx)\n\t" | |
234 " fxch %%st(2)\n\t" | |
235 " fsubrp %%st,%%st(1)\n\t" | |
236 " flds -24(%%ecx)\n\t" | |
237 " fmuls 20(%%ebx)\n\t" | |
238 " fxch %%st(2)\n\t" | |
239 " fsubrp %%st,%%st(1)\n\t" | |
240 " flds -28(%%ecx)\n\t" | |
241 " fmuls 24(%%ebx)\n\t" | |
242 " fxch %%st(2)\n\t" | |
243 " fsubrp %%st,%%st(1)\n\t" | |
244 " flds -32(%%ecx)\n\t" | |
245 " fmuls 28(%%ebx)\n\t" | |
246 " fxch %%st(2)\n\t" | |
247 " fsubrp %%st,%%st(1)\n\t" | |
248 " flds -36(%%ecx)\n\t" | |
249 " fmuls 32(%%ebx)\n\t" | |
250 " fxch %%st(2)\n\t" | |
251 " fsubrp %%st,%%st(1)\n\t" | |
252 " flds -40(%%ecx)\n\t" | |
253 " fmuls 36(%%ebx)\n\t" | |
254 " fxch %%st(2)\n\t" | |
255 " fsubrp %%st,%%st(1)\n\t" | |
256 " flds -44(%%ecx)\n\t" | |
257 " fmuls 40(%%ebx)\n\t" | |
258 " fxch %%st(2)\n\t" | |
259 " fsubrp %%st,%%st(1)\n\t" | |
260 " flds -48(%%ecx)\n\t" | |
261 " fmuls 44(%%ebx)\n\t" | |
262 " fxch %%st(2)\n\t" | |
263 " fsubrp %%st,%%st(1)\n\t" | |
264 " flds -52(%%ecx)\n\t" | |
265 " fmuls 48(%%ebx)\n\t" | |
266 " fxch %%st(2)\n\t" | |
267 " fsubrp %%st,%%st(1)\n\t" | |
268 " flds -56(%%ecx)\n\t" | |
269 " fmuls 52(%%ebx)\n\t" | |
270 " fxch %%st(2)\n\t" | |
271 " fsubrp %%st,%%st(1)\n\t" | |
272 " flds -60(%%ecx)\n\t" | |
273 " fmuls 56(%%ebx)\n\t" | |
274 " fxch %%st(2)\n\t" | |
275 " fsubrp %%st,%%st(1)\n\t" | |
276 " flds (%%ecx)\n\t" | |
277 " fmuls 60(%%ebx)\n\t" | |
278 " fxch %%st(2)\n\t" | |
279 " subl $4,%%esp\n\t" | |
280 " fsubrp %%st,%%st(1)\n\t" | |
281 " fxch %%st(1)\n\t" | |
282 " fsubrp %%st,%%st(1)\n\t" | |
283 " fistpl (%%esp)\n\t" | |
284 " popl %%eax\n\t" | |
285 " cmpl $32767,%%eax\n\t" | |
286 " jg 1f\n\t" | |
287 " cmpl $-32768,%%eax\n\t" | |
288 " jl 2f\n\t" | |
289 " movw %%ax,(%%esi)\n\t" | |
290 " jmp 4f\n\t" | |
291 "1: movw $32767,(%%esi)\n\t" | |
292 " jmp 3f\n\t" | |
293 "2: movw $-32768,(%%esi)\n\t" | |
294 "3: incl %%edi\n\t" | |
295 "4:\n\t" | |
296 ".L67:\n\t" | |
297 " addl $-64,%%ebx\n\t" | |
298 " addl $-128,%%ecx\n\t" | |
299 " addl $4,%%esi\n\t" | |
300 " decl %%ebp\n\t" | |
301 " jnz .L68\n\t" | |
302 " movl %%edi,%%eax\n\t" | |
303 :"=a"(retval) | |
304 :"m"(bandPtr),"m"(channel),"m"(samples),"m"(tmp[0]) | |
305 :"memory","%ebp","%edi","%esi","%ebx"); | |
306 return retval; | |
307 } |