Mercurial > mplayer.hg
annotate mp3lib/decode_i586.c @ 10737:af906af4cf18
1000l
author | rfelker |
---|---|
date | Sun, 31 Aug 2003 19:18:21 +0000 |
parents | 1320f1b3229d |
children | 114f3d149324 |
rev | line source |
---|---|
4147 | 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 */ | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
26 #include "../mangle.h" |
4147 | 27 #define real float /* ugly - but only way */ |
28 | |
29 static long buffs[1088]; | |
30 static long bo=1; | |
8543 | 31 static long saved_ebp; |
4147 | 32 |
33 int synth_1to1_pent(real *bandPtr, int channel, short *samples) | |
34 { | |
35 real tmp[3]; | |
36 register int retval; | |
37 __asm __volatile( | |
8543 | 38 " movl %%ebp,"MANGLE(saved_ebp)"\n\t" |
4147 | 39 " movl %1,%%eax\n\t"/*bandPtr*/ |
40 " movl %3,%%esi\n\t" | |
41 " xorl %%edi,%%edi\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
42 " movl "MANGLE(bo)",%%ebp\n\t" |
4147 | 43 " cmpl %%edi,%2\n\t" |
44 " jne .L48\n\t" | |
45 " decl %%ebp\n\t" | |
46 " andl $15,%%ebp\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
47 " movl %%ebp,"MANGLE(bo)"\n\t" |
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
48 " movl $"MANGLE(buffs)",%%ecx\n\t" |
4147 | 49 " jmp .L49\n\t" |
50 ".L48:\n\t" | |
51 " addl $2,%%esi\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
52 " movl $"MANGLE(buffs)"+2176,%%ecx\n\t" |
4147 | 53 ".L49:\n\t" |
54 " testl $1,%%ebp\n\t" | |
55 " je .L50\n\t" | |
56 " movl %%ecx,%%ebx\n\t" | |
57 " movl %%ebp,%4\n\t" | |
58 " pushl %%eax\n\t" | |
59 " movl 4+%4,%%edx\n\t" | |
60 " leal (%%ebx,%%edx,4),%%eax\n\t" | |
61 " pushl %%eax\n\t" | |
62 " movl 8+%4,%%eax\n\t" | |
63 " incl %%eax\n\t" | |
64 " andl $15,%%eax\n\t" | |
65 " leal 1088(,%%eax,4),%%eax\n\t" | |
66 " addl %%ebx,%%eax\n\t" | |
67 " jmp .L74\n\t" | |
68 ".L50:\n\t" | |
69 " leal 1088(%%ecx),%%ebx\n\t" | |
70 " leal 1(%%ebp),%%edx\n\t" | |
71 " movl %%edx,%4\n\t" | |
72 " pushl %%eax\n\t" | |
73 " leal 1092(%%ecx,%%ebp,4),%%eax\n\t" | |
74 " pushl %%eax\n\t" | |
75 " leal (%%ecx,%%ebp,4),%%eax\n\t" | |
76 ".L74:\n\t" | |
77 " pushl %%eax\n\t" | |
4246
3f677202418b
mangling in mp3lib + stdcall undefined fix with cygwin
atmos4
parents:
4147
diff
changeset
|
78 " call "MANGLE(dct64)"\n\t" |
4147 | 79 " addl $12,%%esp\n\t" |
80 " movl %4,%%edx\n\t" | |
81 " leal 0(,%%edx,4),%%edx\n\t" | |
8560
1320f1b3229d
fixing that f*cking linker 'bug' e.g. naming config with libmp3lame
alex
parents:
8543
diff
changeset
|
82 " movl $"MANGLE(mp3lib_decwin)"+64,%%eax\n\t" |
4147 | 83 " movl %%eax,%%ecx\n\t" |
84 " subl %%edx,%%ecx\n\t" | |
85 " movl $16,%%ebp\n\t" | |
86 ".L55:\n\t" | |
87 " flds (%%ecx)\n\t" | |
88 " fmuls (%%ebx)\n\t" | |
89 " flds 4(%%ecx)\n\t" | |
90 " fmuls 4(%%ebx)\n\t" | |
91 " fxch %%st(1)\n\t" | |
92 " flds 8(%%ecx)\n\t" | |
93 " fmuls 8(%%ebx)\n\t" | |
94 " fxch %%st(2)\n\t" | |
95 " fsubrp %%st,%%st(1)\n\t" | |
96 " flds 12(%%ecx)\n\t" | |
97 " fmuls 12(%%ebx)\n\t" | |
98 " fxch %%st(2)\n\t" | |
99 " faddp %%st,%%st(1)\n\t" | |
100 " flds 16(%%ecx)\n\t" | |
101 " fmuls 16(%%ebx)\n\t" | |
102 " fxch %%st(2)\n\t" | |
103 " fsubrp %%st,%%st(1)\n\t" | |
104 " flds 20(%%ecx)\n\t" | |
105 " fmuls 20(%%ebx)\n\t" | |
106 " fxch %%st(2)\n\t" | |
107 " faddp %%st,%%st(1)\n\t" | |
108 " flds 24(%%ecx)\n\t" | |
109 " fmuls 24(%%ebx)\n\t" | |
110 " fxch %%st(2)\n\t" | |
111 " fsubrp %%st,%%st(1)\n\t" | |
112 " flds 28(%%ecx)\n\t" | |
113 " fmuls 28(%%ebx)\n\t" | |
114 " fxch %%st(2)\n\t" | |
115 " faddp %%st,%%st(1)\n\t" | |
116 " flds 32(%%ecx)\n\t" | |
117 " fmuls 32(%%ebx)\n\t" | |
118 " fxch %%st(2)\n\t" | |
119 " fsubrp %%st,%%st(1)\n\t" | |
120 " flds 36(%%ecx)\n\t" | |
121 " fmuls 36(%%ebx)\n\t" | |
122 " fxch %%st(2)\n\t" | |
123 " faddp %%st,%%st(1)\n\t" | |
124 " flds 40(%%ecx)\n\t" | |
125 " fmuls 40(%%ebx)\n\t" | |
126 " fxch %%st(2)\n\t" | |
127 " fsubrp %%st,%%st(1)\n\t" | |
128 " flds 44(%%ecx)\n\t" | |
129 " fmuls 44(%%ebx)\n\t" | |
130 " fxch %%st(2)\n\t" | |
131 " faddp %%st,%%st(1)\n\t" | |
132 " flds 48(%%ecx)\n\t" | |
133 " fmuls 48(%%ebx)\n\t" | |
134 " fxch %%st(2)\n\t" | |
135 " fsubrp %%st,%%st(1)\n\t" | |
136 " flds 52(%%ecx)\n\t" | |
137 " fmuls 52(%%ebx)\n\t" | |
138 " fxch %%st(2)\n\t" | |
139 " faddp %%st,%%st(1)\n\t" | |
140 " flds 56(%%ecx)\n\t" | |
141 " fmuls 56(%%ebx)\n\t" | |
142 " fxch %%st(2)\n\t" | |
143 " fsubrp %%st,%%st(1)\n\t" | |
144 " flds 60(%%ecx)\n\t" | |
145 " fmuls 60(%%ebx)\n\t" | |
146 " fxch %%st(2)\n\t" | |
147 " subl $4,%%esp\n\t" | |
148 " faddp %%st,%%st(1)\n\t" | |
149 " fxch %%st(1)\n\t" | |
150 " fsubrp %%st,%%st(1)\n\t" | |
151 " fistpl (%%esp)\n\t" | |
152 " popl %%eax\n\t" | |
153 " cmpl $32767,%%eax\n\t" | |
154 " jg 1f\n\t" | |
155 " cmpl $-32768,%%eax\n\t" | |
156 " jl 2f\n\t" | |
157 " movw %%ax,(%%esi)\n\t" | |
158 " jmp 4f\n\t" | |
159 "1: movw $32767,(%%esi)\n\t" | |
160 " jmp 3f\n\t" | |
161 "2: movw $-32768,(%%esi)\n\t" | |
162 "3: incl %%edi\n\t" | |
163 "4:\n\t" | |
164 ".L54:\n\t" | |
165 " addl $64,%%ebx\n\t" | |
166 " subl $-128,%%ecx\n\t" | |
167 " addl $4,%%esi\n\t" | |
168 " decl %%ebp\n\t" | |
169 " jnz .L55\n\t" | |
170 " flds (%%ecx)\n\t" | |
171 " fmuls (%%ebx)\n\t" | |
172 " flds 8(%%ecx)\n\t" | |
173 " fmuls 8(%%ebx)\n\t" | |
174 " flds 16(%%ecx)\n\t" | |
175 " fmuls 16(%%ebx)\n\t" | |
176 " fxch %%st(2)\n\t" | |
177 " faddp %%st,%%st(1)\n\t" | |
178 " flds 24(%%ecx)\n\t" | |
179 " fmuls 24(%%ebx)\n\t" | |
180 " fxch %%st(2)\n\t" | |
181 " faddp %%st,%%st(1)\n\t" | |
182 " flds 32(%%ecx)\n\t" | |
183 " fmuls 32(%%ebx)\n\t" | |
184 " fxch %%st(2)\n\t" | |
185 " faddp %%st,%%st(1)\n\t" | |
186 " flds 40(%%ecx)\n\t" | |
187 " fmuls 40(%%ebx)\n\t" | |
188 " fxch %%st(2)\n\t" | |
189 " faddp %%st,%%st(1)\n\t" | |
190 " flds 48(%%ecx)\n\t" | |
191 " fmuls 48(%%ebx)\n\t" | |
192 " fxch %%st(2)\n\t" | |
193 " faddp %%st,%%st(1)\n\t" | |
194 " flds 56(%%ecx)\n\t" | |
195 " fmuls 56(%%ebx)\n\t" | |
196 " fxch %%st(2)\n\t" | |
197 " subl $4,%%esp\n\t" | |
198 " faddp %%st,%%st(1)\n\t" | |
199 " fxch %%st(1)\n\t" | |
200 " faddp %%st,%%st(1)\n\t" | |
201 " fistpl (%%esp)\n\t" | |
202 " popl %%eax\n\t" | |
203 " cmpl $32767,%%eax\n\t" | |
204 " jg 1f\n\t" | |
205 " cmpl $-32768,%%eax\n\t" | |
206 " jl 2f\n\t" | |
207 " movw %%ax,(%%esi)\n\t" | |
208 " jmp 4f\n\t" | |
209 "1: movw $32767,(%%esi)\n\t" | |
210 " jmp 3f\n\t" | |
211 "2: movw $-32768,(%%esi)\n\t" | |
212 "3: incl %%edi\n\t" | |
213 "4:\n\t" | |
214 ".L62:\n\t" | |
215 " addl $-64,%%ebx\n\t" | |
216 " addl $4,%%esi\n\t" | |
217 " movl %4,%%edx\n\t" | |
218 " leal -128(%%ecx,%%edx,8),%%ecx\n\t" | |
219 " movl $15,%%ebp\n\t" | |
220 ".L68:\n\t" | |
221 " flds -4(%%ecx)\n\t" | |
222 " fchs\n\t" | |
223 " fmuls (%%ebx)\n\t" | |
224 " flds -8(%%ecx)\n\t" | |
225 " fmuls 4(%%ebx)\n\t" | |
226 " fxch %%st(1)\n\t" | |
227 " flds -12(%%ecx)\n\t" | |
228 " fmuls 8(%%ebx)\n\t" | |
229 " fxch %%st(2)\n\t" | |
230 " fsubrp %%st,%%st(1)\n\t" | |
231 " flds -16(%%ecx)\n\t" | |
232 " fmuls 12(%%ebx)\n\t" | |
233 " fxch %%st(2)\n\t" | |
234 " fsubrp %%st,%%st(1)\n\t" | |
235 " flds -20(%%ecx)\n\t" | |
236 " fmuls 16(%%ebx)\n\t" | |
237 " fxch %%st(2)\n\t" | |
238 " fsubrp %%st,%%st(1)\n\t" | |
239 " flds -24(%%ecx)\n\t" | |
240 " fmuls 20(%%ebx)\n\t" | |
241 " fxch %%st(2)\n\t" | |
242 " fsubrp %%st,%%st(1)\n\t" | |
243 " flds -28(%%ecx)\n\t" | |
244 " fmuls 24(%%ebx)\n\t" | |
245 " fxch %%st(2)\n\t" | |
246 " fsubrp %%st,%%st(1)\n\t" | |
247 " flds -32(%%ecx)\n\t" | |
248 " fmuls 28(%%ebx)\n\t" | |
249 " fxch %%st(2)\n\t" | |
250 " fsubrp %%st,%%st(1)\n\t" | |
251 " flds -36(%%ecx)\n\t" | |
252 " fmuls 32(%%ebx)\n\t" | |
253 " fxch %%st(2)\n\t" | |
254 " fsubrp %%st,%%st(1)\n\t" | |
255 " flds -40(%%ecx)\n\t" | |
256 " fmuls 36(%%ebx)\n\t" | |
257 " fxch %%st(2)\n\t" | |
258 " fsubrp %%st,%%st(1)\n\t" | |
259 " flds -44(%%ecx)\n\t" | |
260 " fmuls 40(%%ebx)\n\t" | |
261 " fxch %%st(2)\n\t" | |
262 " fsubrp %%st,%%st(1)\n\t" | |
263 " flds -48(%%ecx)\n\t" | |
264 " fmuls 44(%%ebx)\n\t" | |
265 " fxch %%st(2)\n\t" | |
266 " fsubrp %%st,%%st(1)\n\t" | |
267 " flds -52(%%ecx)\n\t" | |
268 " fmuls 48(%%ebx)\n\t" | |
269 " fxch %%st(2)\n\t" | |
270 " fsubrp %%st,%%st(1)\n\t" | |
271 " flds -56(%%ecx)\n\t" | |
272 " fmuls 52(%%ebx)\n\t" | |
273 " fxch %%st(2)\n\t" | |
274 " fsubrp %%st,%%st(1)\n\t" | |
275 " flds -60(%%ecx)\n\t" | |
276 " fmuls 56(%%ebx)\n\t" | |
277 " fxch %%st(2)\n\t" | |
278 " fsubrp %%st,%%st(1)\n\t" | |
279 " flds (%%ecx)\n\t" | |
280 " fmuls 60(%%ebx)\n\t" | |
281 " fxch %%st(2)\n\t" | |
282 " subl $4,%%esp\n\t" | |
283 " fsubrp %%st,%%st(1)\n\t" | |
284 " fxch %%st(1)\n\t" | |
285 " fsubrp %%st,%%st(1)\n\t" | |
286 " fistpl (%%esp)\n\t" | |
287 " popl %%eax\n\t" | |
288 " cmpl $32767,%%eax\n\t" | |
289 " jg 1f\n\t" | |
290 " cmpl $-32768,%%eax\n\t" | |
291 " jl 2f\n\t" | |
292 " movw %%ax,(%%esi)\n\t" | |
293 " jmp 4f\n\t" | |
294 "1: movw $32767,(%%esi)\n\t" | |
295 " jmp 3f\n\t" | |
296 "2: movw $-32768,(%%esi)\n\t" | |
297 "3: incl %%edi\n\t" | |
298 "4:\n\t" | |
299 ".L67:\n\t" | |
300 " addl $-64,%%ebx\n\t" | |
301 " addl $-128,%%ecx\n\t" | |
302 " addl $4,%%esi\n\t" | |
303 " decl %%ebp\n\t" | |
304 " jnz .L68\n\t" | |
305 " movl %%edi,%%eax\n\t" | |
8543 | 306 " movl "MANGLE(saved_ebp)",%%ebp\n\t" |
4147 | 307 :"=a"(retval) |
308 :"m"(bandPtr),"m"(channel),"m"(samples),"m"(tmp[0]) | |
8543 | 309 :"memory","%edi","%esi","%ebx"); |
4147 | 310 return retval; |
311 } |