Debian Codegraph @

src/libmpg123/dct36_sse.S

raw
1 /*
2 dct36_sse: SSE optimized dct36
3
4 copyright 1995-2013 by the mpg123 project - free software under the terms of the LGPL 2.1
5 see COPYING and AUTHORS files in distribution or http://mpg123.org
6 initially written by Taihei Monma
7 */
8
9 #include "mangle.h"
10
11 #define in %edi
12 #define out1 %edi
13 #define out2 %edx
14 #define w %ecx
15 #define ts %eax
16 #define tmp %esi
17
18 /*
19 void dct36_sse(real *inbuf,real *o1,real *o2,real *wintab,real *tsbuf);
20 */
21
22 RODATA
23 ALIGN16
24 dct36_sse_COS9:
25 .long 0x3f5db3d7
26 .long 0x3f5db3d7
27 .long 0x3f000000
28 .long 0x3f000000
29 .long 0x3f7c1c5c
30 .long 0x3f7c1c5c
31 .long 0x3f708fb2
32 .long 0x3f708fb2
33 .long 0x3f248dbb
34 .long 0x3f248dbb
35 .long 0x3e31d0d4
36 .long 0x3e31d0d4
37 .long 0x3eaf1d44
38 .long 0x3eaf1d44
39 .long 0x3f441b7d
40 .long 0x3f441b7d
41 ALIGN16
42 dct36_sse_tfcos36:
43 .long 0x3f007d2b
44 .long 0x3f0483ee
45 .long 0x3f0d3b7d
46 .long 0x3f1c4257
47 .long 0x40b79454
48 .long 0x3ff746ea
49 .long 0x3f976fd9
50 .long 0x3f5f2944
51 .long 0x3f3504f3
52 ALIGN16
53 dct36_sse_mask:
54 .long 0,0xffffffff,0,0xffffffff
55 ALIGN16
56 dct36_sse_sign:
57 .long 0x80000000,0x80000000,0x80000000,0x80000000
58 .text
59 ALIGN16
60 .globl ASM_NAME(INT123_dct36_sse)
61 ASM_NAME(INT123_dct36_sse):
62 push %ebp
63 mov %esp, %ebp
64 and $-16, %esp
65 sub $80, %esp
66 push %ebx
67 push %esi
68 push %edi
69 lea 12(%esp), tmp
70 movl 8(%ebp), in
71
72 GET_GOT
73
74 lea LOCAL_VAR(dct36_sse_COS9), %eax
75 lea LOCAL_VAR(dct36_sse_tfcos36), %edx
76
77 xorps %xmm0, %xmm0
78 xorps %xmm5, %xmm5
79 movlps 64(in), %xmm5
80 movups 48(in), %xmm4
81 movups 32(in), %xmm3
82 movups 16(in), %xmm2
83 movups (in), %xmm1
84 movaps %xmm5, %xmm6
85 shufps $0xe1, %xmm6, %xmm6
86 movaps %xmm4, %xmm7
87 shufps $0x93, %xmm7, %xmm7
88 movss %xmm7, %xmm6
89 addps %xmm6, %xmm5
90 movaps %xmm3, %xmm6
91 shufps $0x93, %xmm6, %xmm6
92 movss %xmm6, %xmm7
93 addps %xmm7, %xmm4
94 movaps %xmm2, %xmm7
95 shufps $0x93, %xmm7, %xmm7
96 movss %xmm7, %xmm6
97 addps %xmm6, %xmm3
98 movaps %xmm1, %xmm6
99 shufps $0x93, %xmm6, %xmm6
100 movss %xmm6, %xmm7
101 addps %xmm7, %xmm2
102 movss %xmm0, %xmm6
103 addps %xmm6, %xmm1
104
105 movaps LOCAL_VAR(dct36_sse_mask), %xmm0
106 movaps %xmm4, %xmm6
107 shufps $0x4e, %xmm5, %xmm4
108 movaps %xmm3, %xmm7
109 shufps $0x4e, %xmm6, %xmm3
110 andps %xmm0, %xmm6
111 addps %xmm6, %xmm4
112 movaps %xmm2, %xmm6
113 shufps $0x4e, %xmm7, %xmm2
114 andps %xmm0, %xmm7
115 addps %xmm7, %xmm3
116 movaps %xmm1, %xmm7
117 shufps $0x4e, %xmm6, %xmm1
118 andps %xmm0, %xmm6
119 addps %xmm6, %xmm2
120 movaps %xmm7, %xmm6
121 andps %xmm0, %xmm7
122 xorps %xmm0, %xmm0
123 addps %xmm7, %xmm1
124 movlhps %xmm6, %xmm0
125
126 /*
127 xmm0 in[-,-,0,1]
128 xmm1 in[2,3,4,5]
129 xmm2 in[6,7,8,9]
130 xmm3 in[10,11,12,13]
131 xmm4 in[14,15,16,17]
132 */
133
134 movaps %xmm2, %xmm5
135 shufps $0xe4, %xmm3, %xmm5
136 shufps $0xe4, %xmm4, %xmm3
137 shufps $0xe4, %xmm2, %xmm4
138 movaps %xmm5, %xmm2
139
140 /*
141 xmm2 in[6,7,12,13]
142 xmm3 in[10,11,16,17]
143 xmm4 in[14,15,8,9]
144 */
145
146 mulps (%eax), %xmm5
147 addps %xmm0, %xmm5
148
149 movaps %xmm0, (tmp)
150 movaps %xmm2, 16(tmp)
151
152 /*
153 0(tmp) in[-,-,0,1]
154 xmm5 [ta33,tb33,ta66,tb66]
155 */
156
157 movaps %xmm1, %xmm6
158 subps %xmm3, %xmm6
159 subps %xmm4, %xmm6
160 xorps %xmm7, %xmm7
161 shufps $0xe0, %xmm2, %xmm7
162 mulps (%eax), %xmm6
163 subps %xmm7, %xmm0
164 addps %xmm0, %xmm6
165 movaps %xmm6, 48(tmp)
166
167 movaps 16(%eax), %xmm2
168
169 movaps %xmm1, %xmm0
170 movaps %xmm3, %xmm6
171 movaps %xmm4, %xmm7
172 mulps %xmm2, %xmm0
173 mulps 32(%eax), %xmm6
174 mulps 48(%eax), %xmm7
175 addps %xmm5, %xmm0
176 addps %xmm7, %xmm6
177 addps %xmm6, %xmm0
178 movaps %xmm0, 32(tmp)
179
180 movaps %xmm1, %xmm0
181 movaps %xmm3, %xmm6
182 movaps %xmm4, %xmm7
183 mulps 32(%eax), %xmm0
184 mulps 48(%eax), %xmm6
185 mulps %xmm2, %xmm7
186 subps %xmm5, %xmm0
187 subps %xmm6, %xmm7
188 addps %xmm7, %xmm0
189 movaps %xmm0, 64(tmp)
190
191 movaps %xmm1, %xmm6
192 movaps %xmm4, %xmm7
193 mulps 48(%eax), %xmm6
194 mulps %xmm3, %xmm2
195 mulps 32(%eax), %xmm7
196 subps %xmm5, %xmm6
197 subps %xmm7, %xmm2
198 addps %xmm2, %xmm6
199
200 movaps (tmp), %xmm0
201 movss 32(%edx), %xmm5
202 subps %xmm1, %xmm0
203 subps 16(tmp), %xmm4
204 addps %xmm3, %xmm0
205 addps %xmm4, %xmm0
206 shufps $0xaf, %xmm0, %xmm0
207 mulss %xmm5, %xmm0
208 movaps %xmm0, (tmp)
209
210 movaps 32(tmp), %xmm0
211 movaps 48(tmp), %xmm1
212 movaps 64(tmp), %xmm2
213
214 /*
215 xmm0 [1a-0,1b-0, 2a-0, 2b-0]
216 xmm1 [1a-1,1b-1, 2a-1, 2b-1]
217 xmm2 [1a-2,1b-2,-2a-2,-2b-2]
218 xmm6 [1a-3,1b-3,-2a-3,-2b-3]
219 */
220
221 movaps %xmm0, %xmm3
222 unpcklps %xmm1, %xmm0
223 unpckhps %xmm1, %xmm3
224 movaps %xmm2, %xmm5
225 unpcklps %xmm6, %xmm2
226 unpckhps %xmm6, %xmm5
227 xorps LOCAL_VAR(dct36_sse_sign), %xmm5
228
229 /*
230 xmm0 [1a-0,1a-1,1b-0,1b-1]
231 xmm3 [2a-0,2a-1,2b-0,2b-1]
232 xmm2 [1a-2,1a-3,1b-2,1b-3]
233 xmm5 [2a-2,2a-3,2b-2,2b-3]
234 */
235
236 movaps %xmm0, %xmm1
237 movlhps %xmm2, %xmm0
238 movhlps %xmm1, %xmm2
239 movaps %xmm3, %xmm4
240 movlhps %xmm5, %xmm3
241 movhlps %xmm4, %xmm5
242
243 /*
244 xmm0 tmp1a
245 xmm3 tmp2a
246 xmm2 tmp1b
247 xmm5 tmp2b
248 */
249
250 movaps (%edx), %xmm6
251 movaps 16(%edx), %xmm7
252 movaps %xmm5, %xmm1
253 addps %xmm2, %xmm5
254 subps %xmm2, %xmm1
255 movaps %xmm3, %xmm2
256 addps %xmm0, %xmm3
257 subps %xmm0, %xmm2
258 mulps %xmm6, %xmm5
259 mulps %xmm1, %xmm7
260
261 movaps %xmm2, 16(tmp)
262
263 /*
264 %xmm3 tmp[0,1,2,3]
265 %xmm5 tmp[17,16,15,14]
266 16(tmp) tmp[8,7,6,5]
267 %xmm7 tmp[9,10,11,12]
268 0(tmp) tmp[13,-,4,-]
269 */
270
271 movl 12(%ebp), out1
272 movl 16(%ebp), out2
273 movl 20(%ebp), w
274 movl 24(%ebp), ts
275
276 movaps %xmm3, %xmm0
277 movaps %xmm5, %xmm1
278 movups 108(w), %xmm2
279 movups 92(w), %xmm3
280 shufps $0x1b, %xmm3, %xmm3
281 movups 36(w), %xmm4
282 movups 20(w), %xmm5
283 shufps $0x1b, %xmm5, %xmm5
284 movaps %xmm0, %xmm6
285 addps %xmm1, %xmm0
286 subps %xmm1, %xmm6
287 mulps %xmm0, %xmm2
288 mulps %xmm3, %xmm0
289 mulps %xmm6, %xmm4
290 mulps %xmm5, %xmm6
291 movups 36(out1), %xmm1
292 movups 20(out1), %xmm3
293 shufps $0x1b, %xmm6, %xmm6
294 addps %xmm4, %xmm1
295 addps %xmm6, %xmm3
296 shufps $0x1b, %xmm0, %xmm0
297 movups %xmm2, 36(out2)
298 movups %xmm0, 20(out2)
299 movss %xmm1, 32*36(ts)
300 movss %xmm3, 32*20(ts)
301 movhlps %xmm1, %xmm2
302 movhlps %xmm3, %xmm4
303 movss %xmm2, 32*44(ts)
304 movss %xmm4, 32*28(ts)
305 shufps $0xb1, %xmm1, %xmm1
306 shufps $0xb1, %xmm3, %xmm3
307 movss %xmm1, 32*40(ts)
308 movss %xmm3, 32*24(ts)
309 movhlps %xmm1, %xmm2
310 movhlps %xmm3, %xmm4
311 movss %xmm2, 32*48(ts)
312 movss %xmm4, 32*32(ts)
313
314 movss 8(tmp), %xmm0
315 movss (tmp), %xmm1
316 movss 124(w), %xmm2
317 movss 88(w), %xmm3
318 movss 52(w), %xmm4
319 movss 16(w), %xmm5
320 movss %xmm0, %xmm6
321 addss %xmm1, %xmm0
322 subss %xmm1, %xmm6
323 mulss %xmm0, %xmm2
324 mulss %xmm3, %xmm0
325 mulss %xmm6, %xmm4
326 mulss %xmm5, %xmm6
327 addss 52(out1), %xmm4
328 addss 16(out1), %xmm6
329 movss %xmm2, 52(out2)
330 movss %xmm0, 16(out2)
331 movss %xmm4, 32*52(ts)
332 movss %xmm6, 32*16(ts)
333
334 movaps 16(tmp), %xmm0
335 movaps %xmm7, %xmm1
336 MOVUAPS 128(w), %xmm2
337 movups 72(w), %xmm3
338 shufps $0x1b, %xmm2, %xmm2
339 movlps 56(w), %xmm4
340 movhps 64(w), %xmm4
341 MOVUAPS (w), %xmm5
342 shufps $0x1b, %xmm4, %xmm4
343 movaps %xmm0, %xmm6
344 addps %xmm1, %xmm0
345 subps %xmm1, %xmm6
346 mulps %xmm0, %xmm2
347 mulps %xmm3, %xmm0
348 mulps %xmm6, %xmm4
349 mulps %xmm5, %xmm6
350 movlps 56(out1), %xmm1
351 movhps 64(out1), %xmm1
352 movups (out1), %xmm3
353 shufps $0x1b, %xmm4, %xmm4
354 addps %xmm6, %xmm3
355 addps %xmm4, %xmm1
356 shufps $0x1b, %xmm2, %xmm2
357 movups %xmm0, (out2)
358 movlps %xmm2, 56(out2)
359 movhps %xmm2, 64(out2)
360 movss %xmm1, 32*56(ts)
361 movss %xmm3, (ts)
362 movhlps %xmm1, %xmm2
363 movhlps %xmm3, %xmm4
364 movss %xmm2, 32*64(ts)
365 movss %xmm4, 32*8(ts)
366 shufps $0xb1, %xmm1, %xmm1
367 shufps $0xb1, %xmm3, %xmm3
368 movss %xmm1, 32*60(ts)
369 movss %xmm3, 32*4(ts)
370 movhlps %xmm1, %xmm2
371 movhlps %xmm3, %xmm4
372 movss %xmm2, 32*68(ts)
373 movss %xmm4, 32*12(ts)
374
375 pop %edi
376 pop %esi
377 pop %ebx
378 mov %ebp, %esp
379 pop %ebp
380
381 ret
382
383 NONEXEC_STACK