Skip to content

Latest commit

 

History

History
394 lines (368 loc) · 7.85 KB

dct36_x86_64.S

File metadata and controls

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