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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
|
/*
* This code was taken from http://www.mpg123.org
* See ChangeLog of mpg123-0.59s-pre.1 for detail
* Applied to mplayer by Nick Kurshev <nickols_k@mail.ru>
* Partial 3dnowex-DSP! optimization by Nick Kurshev
*
* TODO: optimize scalar 3dnow! code
* Warning: Phases 7 & 8 are not tested
*/
#define real float /* ugly - but only way */
#include "../mangle.h"
static unsigned long long int __attribute__((aligned(8))) x_plus_minus_3dnow = 0x8000000000000000ULL;
static float plus_1f = 1.0;
void __attribute__ (( __stdcall__ )) dct64_MMX_3dnowex(real *a,real *b,real *c)
{
char tmp[256];
__asm __volatile(
" movl %2,%%eax\n\t"
" leal 128+%3,%%edx\n\t"
" movl %0,%%esi\n\t"
" movl %1,%%edi\n\t"
" movl $"MANGLE(costab_mmx)",%%ebx\n\t"
" leal %3,%%ecx\n\t"
/* Phase 1*/
" movq (%%eax), %%mm0\n\t"
" movq 8(%%eax), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 120(%%eax), %%mm1\n\t"
" movq 112(%%eax), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, (%%edx)\n\t"
" movq %%mm4, 8(%%edx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsub %%mm5, %%mm7\n\t"
" pfmul (%%ebx), %%mm3\n\t"
" pfmul 8(%%ebx), %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 120(%%edx)\n\t"
" movq %%mm7, 112(%%edx)\n\t"
" movq 16(%%eax), %%mm0\n\t"
" movq 24(%%eax), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 104(%%eax), %%mm1\n\t"
" movq 96(%%eax), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 16(%%edx)\n\t"
" movq %%mm4, 24(%%edx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsub %%mm5, %%mm7\n\t"
" pfmul 16(%%ebx), %%mm3\n\t"
" pfmul 24(%%ebx), %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 104(%%edx)\n\t"
" movq %%mm7, 96(%%edx)\n\t"
" movq 32(%%eax), %%mm0\n\t"
" movq 40(%%eax), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 88(%%eax), %%mm1\n\t"
" movq 80(%%eax), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 32(%%edx)\n\t"
" movq %%mm4, 40(%%edx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsub %%mm5, %%mm7\n\t"
" pfmul 32(%%ebx), %%mm3\n\t"
" pfmul 40(%%ebx), %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 88(%%edx)\n\t"
" movq %%mm7, 80(%%edx)\n\t"
" movq 48(%%eax), %%mm0\n\t"
" movq 56(%%eax), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 72(%%eax), %%mm1\n\t"
" movq 64(%%eax), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 48(%%edx)\n\t"
" movq %%mm4, 56(%%edx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsub %%mm5, %%mm7\n\t"
" pfmul 48(%%ebx), %%mm3\n\t"
" pfmul 56(%%ebx), %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 72(%%edx)\n\t"
" movq %%mm7, 64(%%edx)\n\t"
/* Phase 2*/
" movq (%%edx), %%mm0\n\t"
" movq 8(%%edx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 56(%%edx), %%mm1\n\t"
" movq 48(%%edx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, (%%ecx)\n\t"
" movq %%mm4, 8(%%ecx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsub %%mm5, %%mm7\n\t"
" pfmul 64(%%ebx), %%mm3\n\t"
" pfmul 72(%%ebx), %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 56(%%ecx)\n\t"
" movq %%mm7, 48(%%ecx)\n\t"
" movq 16(%%edx), %%mm0\n\t"
" movq 24(%%edx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 40(%%edx), %%mm1\n\t"
" movq 32(%%edx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 16(%%ecx)\n\t"
" movq %%mm4, 24(%%ecx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsub %%mm5, %%mm7\n\t"
" pfmul 80(%%ebx), %%mm3\n\t"
" pfmul 88(%%ebx), %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 40(%%ecx)\n\t"
" movq %%mm7, 32(%%ecx)\n\t"
/* Phase 3*/
" movq 64(%%edx), %%mm0\n\t"
" movq 72(%%edx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 120(%%edx), %%mm1\n\t"
" movq 112(%%edx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 64(%%ecx)\n\t"
" movq %%mm4, 72(%%ecx)\n\t"
" pfsubr %%mm1, %%mm3\n\t"
" pfsubr %%mm5, %%mm7\n\t"
" pfmul 64(%%ebx), %%mm3\n\t"
" pfmul 72(%%ebx), %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 120(%%ecx)\n\t"
" movq %%mm7, 112(%%ecx)\n\t"
" movq 80(%%edx), %%mm0\n\t"
" movq 88(%%edx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 104(%%edx), %%mm1\n\t"
" movq 96(%%edx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 80(%%ecx)\n\t"
" movq %%mm4, 88(%%ecx)\n\t"
" pfsubr %%mm1, %%mm3\n\t"
" pfsubr %%mm5, %%mm7\n\t"
" pfmul 80(%%ebx), %%mm3\n\t"
" pfmul 88(%%ebx), %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 104(%%ecx)\n\t"
" movq %%mm7, 96(%%ecx)\n\t"
/* Phase 4*/
" movq 96(%%ebx), %%mm2\n\t"
" movq 104(%%ebx), %%mm6\n\t"
" movq (%%ecx), %%mm0\n\t"
" movq 8(%%ecx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 24(%%ecx), %%mm1\n\t"
" movq 16(%%ecx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, (%%edx)\n\t"
" movq %%mm4, 8(%%edx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsub %%mm5, %%mm7\n\t"
" pfmul %%mm2, %%mm3\n\t"
" pfmul %%mm6, %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 24(%%edx)\n\t"
" movq %%mm7, 16(%%edx)\n\t"
" movq 32(%%ecx), %%mm0\n\t"
" movq 40(%%ecx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 56(%%ecx), %%mm1\n\t"
" movq 48(%%ecx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 32(%%edx)\n\t"
" movq %%mm4, 40(%%edx)\n\t"
" pfsubr %%mm1, %%mm3\n\t"
" pfsubr %%mm5, %%mm7\n\t"
" pfmul %%mm2, %%mm3\n\t"
" pfmul %%mm6, %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 56(%%edx)\n\t"
" movq %%mm7, 48(%%edx)\n\t"
" movq 64(%%ecx), %%mm0\n\t"
" movq 72(%%ecx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 88(%%ecx), %%mm1\n\t"
" movq 80(%%ecx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 64(%%edx)\n\t"
" movq %%mm4, 72(%%edx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsub %%mm5, %%mm7\n\t"
" pfmul %%mm2, %%mm3\n\t"
" pfmul %%mm6, %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 88(%%edx)\n\t"
" movq %%mm7, 80(%%edx)\n\t"
" movq 96(%%ecx), %%mm0\n\t"
" movq 104(%%ecx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 120(%%ecx), %%mm1\n\t"
" movq 112(%%ecx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 96(%%edx)\n\t"
" movq %%mm4, 104(%%edx)\n\t"
" pfsubr %%mm1, %%mm3\n\t"
" pfsubr %%mm5, %%mm7\n\t"
" pfmul %%mm2, %%mm3\n\t"
" pfmul %%mm6, %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 120(%%edx)\n\t"
" movq %%mm7, 112(%%edx)\n\t"
/* Phase 5 */
" movq 112(%%ebx), %%mm2\n\t"
" movq (%%edx), %%mm0\n\t"
" movq 16(%%edx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 8(%%edx), %%mm1\n\t"
" movq 24(%%edx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, (%%ecx)\n\t"
" movq %%mm4, 16(%%ecx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsubr %%mm5, %%mm7\n\t"
" pfmul %%mm2, %%mm3\n\t"
" pfmul %%mm2, %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 8(%%ecx)\n\t"
" movq %%mm7, 24(%%ecx)\n\t"
" movq 32(%%edx), %%mm0\n\t"
" movq 48(%%edx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 40(%%edx), %%mm1\n\t"
" movq 56(%%edx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 32(%%ecx)\n\t"
" movq %%mm4, 48(%%ecx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsubr %%mm5, %%mm7\n\t"
" pfmul %%mm2, %%mm3\n\t"
" pfmul %%mm2, %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 40(%%ecx)\n\t"
" movq %%mm7, 56(%%ecx)\n\t"
" movq 64(%%edx), %%mm0\n\t"
" movq 80(%%edx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 72(%%edx), %%mm1\n\t"
" movq 88(%%edx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 64(%%ecx)\n\t"
" movq %%mm4, 80(%%ecx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsubr %%mm5, %%mm7\n\t"
" pfmul %%mm2, %%mm3\n\t"
" pfmul %%mm2, %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 72(%%ecx)\n\t"
" movq %%mm7, 88(%%ecx)\n\t"
" movq 96(%%edx), %%mm0\n\t"
" movq 112(%%edx), %%mm4\n\t"
" movq %%mm0, %%mm3\n\t"
" movq %%mm4, %%mm7\n\t"
" movq 104(%%edx), %%mm1\n\t"
" movq 120(%%edx), %%mm5\n\t"
" pswapd %%mm1, %%mm1\n\t"
" pswapd %%mm5, %%mm5\n\t"
" pfadd %%mm1, %%mm0\n\t"
" pfadd %%mm5, %%mm4\n\t"
" movq %%mm0, 96(%%ecx)\n\t"
" movq %%mm4, 112(%%ecx)\n\t"
" pfsub %%mm1, %%mm3\n\t"
" pfsubr %%mm5, %%mm7\n\t"
" pfmul %%mm2, %%mm3\n\t"
" pfmul %%mm2, %%mm7\n\t"
" pswapd %%mm3, %%mm3\n\t"
" pswapd %%mm7, %%mm7\n\t"
" movq %%mm3, 104(%%ecx)\n\t"
" movq %%mm7, 120(%%ecx)\n\t"
/* Phase 6. This is the end of easy road. */
/* Code below is coded in scalar mode. Should be optimized */
" movd "MANGLE(plus_1f)", %%mm6\n\t"
" punpckldq 120(%%ebx), %%mm6\n\t" /* mm6 = 1.0 | 120(%%ebx)*/
" movq x_plus_minus_3dnow, %%mm7\n\t" /* mm7 = +1 | -1 */
" movq 32(%%ecx), %%mm0\n\t"
" movq 64(%%ecx), %%mm2\n\t"
" movq %%mm0, %%mm1\n\t"
" movq %%mm2, %%mm3\n\t"
" pxor %%mm7, %%mm1\n\t"
" pxor %%mm7, %%mm3\n\t"
" pfacc %%mm1, %%mm0\n\t"
" pfacc %%mm3, %%mm2\n\t"
" pfmul %%mm6, %%mm0\n\t"
" pfmul %%mm6, %%mm2\n\t"
" movq %%mm0, 32(%%edx)\n\t"
" movq %%mm2, 64(%%edx)\n\t"
" movd 44(%%ecx), %%mm0\n\t"
" movd 40(%%ecx), %%mm2\n\t"
" movd 120(%%ebx), %%mm3\n\t"
" punpckldq 76(%%ecx), %%mm0\n\t"
" punpckldq 72(%%ecx), %%mm2\n\t"
" punpckldq %%mm3, %%mm3\n\t"
" movq %%mm0, %%mm4\n\t"
" movq %%mm2, %%mm5\n\t"
" pfsub %%mm2, %%mm0\n\t"
" pfmul %%mm3, %%mm0\n\t"
" movq %%mm0, %%mm1\n\t"
" pfadd %%mm5, %%mm0\n\t"
" pfadd %%mm4, %%mm0\n\t"
" movq %%mm0, %%mm2\n\t"
" punpckldq %%mm1, %%mm0\n\t"
" punpckhdq %%mm1, %%mm2\n\t"
" movq %%mm0, 40(%%edx)\n\t"
" movq %%mm2, 72(%%edx)\n\t"
" movd 48(%%ecx), %%mm3\n\t"
" movd 60(%%ecx), %%mm2\n\t"
" pfsub 52(%%ecx), %%mm3\n\t"
" pfsub 56(%%ecx), %%mm2\n\t"
" pfmul 120(%%ebx), %%mm3\n\t"
" pfmul 120(%%ebx), %%mm2\n\t"
" movq %%mm2, %%mm1\n\t"
" pfadd 56(%%ecx), %%mm1\n\t"
" pfadd 60(%%ecx), %%mm1\n\t"
" movq %%mm1, %%mm0\n\t"
" pfadd 48(%%ecx), %%mm0\n\t"
" pfadd 52(%%ecx), %%mm0\n\t"
" pfadd %%mm3, %%mm1\n\t"
" punpckldq %%mm2, %%mm1\n\t"
" pfadd %%mm3, %%mm2\n\t"
" punpckldq %%mm2, %%mm0\n\t"
" movq %%mm1, 56(%%edx)\n\t"
" movq %%mm0, 48(%%edx)\n\t"
/*---*/
" movd 92(%%ecx), %%mm1\n\t"
" pfsub 88(%%ecx), %%mm1\n\t"
" pfmul 120(%%ebx), %%mm1\n\t"
" movd %%mm1, 92(%%edx)\n\t"
" pfadd 92(%%ecx), %%mm1\n\t"
" pfadd 88(%%ecx), %%mm1\n\t"
" movq %%mm1, %%mm0\n\t"
" pfadd 80(%%ecx), %%mm0\n\t"
" pfadd 84(%%ecx), %%mm0\n\t"
" movd %%mm0, 80(%%edx)\n\t"
" movd 80(%%ecx), %%mm0\n\t"
" pfsub 84(%%ecx), %%mm0\n\t"
" pfmul 120(%%ebx), %%mm0\n\t"
" pfadd %%mm0, %%mm1\n\t"
" pfadd 92(%%edx), %%mm0\n\t"
" punpckldq %%mm1, %%mm0\n\t"
" movq %%mm0, 84(%%edx)\n\t"
" movq 96(%%ecx), %%mm0\n\t"
" movq %%mm0, %%mm1\n\t"
" pxor %%mm7, %%mm1\n\t"
" pfacc %%mm1, %%mm0\n\t"
" pfmul %%mm6, %%mm0\n\t"
" movq %%mm0, 96(%%edx)\n\t"
" movd 108(%%ecx), %%mm0\n\t"
" pfsub 104(%%ecx), %%mm0\n\t"
" pfmul 120(%%ebx), %%mm0\n\t"
" movd %%mm0, 108(%%edx)\n\t"
" pfadd 104(%%ecx), %%mm0\n\t"
" pfadd 108(%%ecx), %%mm0\n\t"
" movd %%mm0, 104(%%edx)\n\t"
" movd 124(%%ecx), %%mm1\n\t"
" pfsub 120(%%ecx), %%mm1\n\t"
" pfmul 120(%%ebx), %%mm1\n\t"
" movd %%mm1, 124(%%edx)\n\t"
" pfadd 120(%%ecx), %%mm1\n\t"
" pfadd 124(%%ecx), %%mm1\n\t"
" movq %%mm1, %%mm0\n\t"
" pfadd 112(%%ecx), %%mm0\n\t"
" pfadd 116(%%ecx), %%mm0\n\t"
" movd %%mm0, 112(%%edx)\n\t"
" movd 112(%%ecx), %%mm0\n\t"
" pfsub 116(%%ecx), %%mm0\n\t"
" pfmul 120(%%ebx), %%mm0\n\t"
" pfadd %%mm0,%%mm1\n\t"
" pfadd 124(%%edx), %%mm0\n\t"
" punpckldq %%mm1, %%mm0\n\t"
" movq %%mm0, 116(%%edx)\n\t"
" jnz .L01\n\t"
/* Phase 7*/
/* Code below is coded in scalar mode. Should be optimized */
" movd (%%ecx), %%mm0\n\t"
" pfadd 4(%%ecx), %%mm0\n\t"
" movd %%mm0, 1024(%%esi)\n\t"
" movd (%%ecx), %%mm0\n\t"
" pfsub 4(%%ecx), %%mm0\n\t"
" pfmul 120(%%ebx), %%mm0\n\t"
" movd %%mm0, (%%esi)\n\t"
" movd %%mm0, (%%edi)\n\t"
" movd 12(%%ecx), %%mm0\n\t"
" pfsub 8(%%ecx), %%mm0\n\t"
" pfmul 120(%%ebx), %%mm0\n\t"
" movd %%mm0, 512(%%edi)\n\t"
" pfadd 12(%%ecx), %%mm0\n\t"
" pfadd 8(%%ecx), %%mm0\n\t"
" movd %%mm0, 512(%%esi)\n\t"
" movd 16(%%ecx), %%mm0\n\t"
" pfsub 20(%%ecx), %%mm0\n\t"
" pfmul 120(%%ebx), %%mm0\n\t"
" movq %%mm0, %%mm3\n\t"
" movd 28(%%ecx), %%mm0\n\t"
" pfsub 24(%%ecx), %%mm0\n\t"
" pfmul 120(%%ebx), %%mm0\n\t"
" movd %%mm0, 768(%%edi)\n\t"
" movq %%mm0, %%mm2\n\t"
" pfadd 24(%%ecx), %%mm0\n\t"
" pfadd 28(%%ecx), %%mm0\n\t"
" movq %%mm0, %%mm1\n\t"
" pfadd 16(%%ecx), %%mm0\n\t"
" pfadd 20(%%ecx), %%mm0\n\t"
" movd %%mm0, 768(%%esi)\n\t"
" pfadd %%mm3, %%mm1\n\t"
" movd %%mm1, 256(%%esi)\n\t"
" pfadd %%mm3, %%mm2\n\t"
" movd %%mm2, 256(%%edi)\n\t"
/* Phase 8*/
" movq 32(%%edx), %%mm0\n\t"
" movq 48(%%edx), %%mm1\n\t"
" pfadd 48(%%edx), %%mm0\n\t"
" pfadd 40(%%edx), %%mm1\n\t"
" movd %%mm0, 896(%%esi)\n\t"
" movd %%mm1, 640(%%esi)\n\t"
" psrlq $32, %%mm0\n\t"
" psrlq $32, %%mm1\n\t"
" movd %%mm0, 128(%%edi)\n\t"
" movd %%mm1, 384(%%edi)\n\t"
" movd 40(%%edx), %%mm0\n\t"
" pfadd 56(%%edx), %%mm0\n\t"
" movd %%mm0, 384(%%esi)\n\t"
" movd 56(%%edx), %%mm0\n\t"
" pfadd 36(%%edx), %%mm0\n\t"
" movd %%mm0, 128(%%esi)\n\t"
" movd 60(%%edx), %%mm0\n\t"
" movd %%mm0, 896(%%edi)\n\t"
" pfadd 44(%%edx), %%mm0\n\t"
" movd %%mm0, 640(%%edi)\n\t"
" movq 96(%%edx), %%mm0\n\t"
" movq 112(%%edx), %%mm2\n\t"
" movq 104(%%edx), %%mm4\n\t"
" pfadd 112(%%edx), %%mm0\n\t"
" pfadd 104(%%edx), %%mm2\n\t"
" pfadd 120(%%edx), %%mm4\n\t"
" movq %%mm0, %%mm1\n\t"
" movq %%mm2, %%mm3\n\t"
" movq %%mm4, %%mm5\n\t"
" pfadd 64(%%edx), %%mm0\n\t"
" pfadd 80(%%edx), %%mm2\n\t"
" pfadd 72(%%edx), %%mm4\n\t"
" movd %%mm0, 960(%%esi)\n\t"
" movd %%mm2, 704(%%esi)\n\t"
" movd %%mm4, 448(%%esi)\n\t"
" psrlq $32, %%mm0\n\t"
" psrlq $32, %%mm2\n\t"
" psrlq $32, %%mm4\n\t"
" movd %%mm0, 64(%%edi)\n\t"
" movd %%mm2, 320(%%edi)\n\t"
" movd %%mm4, 576(%%edi)\n\t"
" pfadd 80(%%edx), %%mm1\n\t"
" pfadd 72(%%edx), %%mm3\n\t"
" pfadd 88(%%edx), %%mm5\n\t"
" movd %%mm1, 832(%%esi)\n\t"
" movd %%mm3, 576(%%esi)\n\t"
" movd %%mm5, 320(%%esi)\n\t"
" psrlq $32, %%mm1\n\t"
" psrlq $32, %%mm3\n\t"
" psrlq $32, %%mm5\n\t"
" movd %%mm1, 192(%%edi)\n\t"
" movd %%mm3, 448(%%edi)\n\t"
" movd %%mm5, 704(%%edi)\n\t"
" movd 120(%%edx), %%mm0\n\t"
" pfadd 100(%%edx), %%mm0\n\t"
" movq %%mm0, %%mm1\n\t"
" pfadd 88(%%edx), %%mm0\n\t"
" movd %%mm0, 192(%%esi)\n\t"
" pfadd 68(%%edx), %%mm1\n\t"
" movd %%mm1, 64(%%esi)\n\t"
" movd 124(%%edx), %%mm0\n\t"
" movd %%mm0, 960(%%edi)\n\t"
" pfadd 92(%%edx), %%mm0\n\t"
" movd %%mm0, 832(%%edi)\n\t"
" jmp .L_bye\n\t"
".L01: \n\t"
/* Phase 9*/
" movq (%%ecx), %%mm0\n\t"
" movq %%mm0, %%mm1\n\t"
" pxor %%mm7, %%mm1\n\t"
" pfacc %%mm1, %%mm0\n\t"
" pfmul %%mm6, %%mm0\n\t"
" pf2id %%mm0, %%mm0\n\t"
" movd %%mm0, %%eax\n\t"
" movw %%ax, 512(%%esi)\n\t"
" psrlq $32, %%mm0\n\t"
" movd %%mm0, %%eax\n\t"
" movw %%ax, (%%esi)\n\t"
" movd 12(%%ecx), %%mm0\n\t"
" pfsub 8(%%ecx), %%mm0\n\t"
" pfmul 120(%%ebx), %%mm0\n\t"
" pf2id %%mm0, %%mm7\n\t"
" movd %%mm7, %%eax\n\t"
" movw %%ax, 256(%%edi)\n\t"
" pfadd 12(%%ecx), %%mm0\n\t"
" pfadd 8(%%ecx), %%mm0\n\t"
" pf2id %%mm0, %%mm0\n\t"
" movd %%mm0, %%eax\n\t"
" movw %%ax, 256(%%esi)\n\t"
" movd 16(%%ecx), %%mm3\n\t"
" pfsub 20(%%ecx), %%mm3\n\t"
" pfmul 120(%%ebx), %%mm3\n\t"
" movq %%mm3, %%mm2\n\t"
" movd 28(%%ecx), %%mm2\n\t"
" pfsub 24(%%ecx), %%mm2\n\t"
" pfmul 120(%%ebx), %%mm2\n\t"
" movq %%mm2, %%mm1\n\t"
" pf2id %%mm2, %%mm7\n\t"
" movd %%mm7, %%eax\n\t"
" movw %%ax, 384(%%edi)\n\t"
" pfadd 24(%%ecx), %%mm1\n\t"
" pfadd 28(%%ecx), %%mm1\n\t"
" movq %%mm1, %%mm0\n\t"
" pfadd 16(%%ecx), %%mm0\n\t"
" pfadd 20(%%ecx), %%mm0\n\t"
" pf2id %%mm0, %%mm0\n\t"
" movd %%mm0, %%eax\n\t"
" movw %%ax, 384(%%esi)\n\t"
" pfadd %%mm3, %%mm1\n\t"
" pf2id %%mm1, %%mm1\n\t"
" movd %%mm1, %%eax\n\t"
" movw %%ax, 128(%%esi)\n\t"
" pfadd %%mm3, %%mm2\n\t"
" pf2id %%mm2, %%mm2\n\t"
" movd %%mm2, %%eax\n\t"
" movw %%ax, 128(%%edi)\n\t"
/* Phase 10*/
" movq 32(%%edx), %%mm0\n\t"
" movq 48(%%edx), %%mm1\n\t"
" pfadd 48(%%edx), %%mm0\n\t"
" pfadd 40(%%edx), %%mm1\n\t"
" pf2id %%mm0, %%mm0\n\t"
" pf2id %%mm1, %%mm1\n\t"
" movd %%mm0, %%eax\n\t"
" movd %%mm1, %%ecx\n\t"
" movw %%ax, 448(%%esi)\n\t"
" movw %%cx, 320(%%esi)\n\t"
" psrlq $32, %%mm0\n\t"
" psrlq $32, %%mm1\n\t"
" movd %%mm0, %%eax\n\t"
" movd %%mm1, %%ecx\n\t"
" movw %%ax, 64(%%edi)\n\t"
" movw %%cx, 192(%%edi)\n\t"
" movd 40(%%edx), %%mm3\n\t"
" movd 56(%%edx), %%mm4\n\t"
" movd 60(%%edx), %%mm0\n\t"
" movd 44(%%edx), %%mm2\n\t"
" movd 120(%%edx), %%mm5\n\t"
" punpckldq %%mm4, %%mm3\n\t"
" punpckldq 124(%%edx), %%mm0\n\t"
" pfadd 100(%%edx), %%mm5\n\t"
" punpckldq 36(%%edx), %%mm4\n\t"
" punpckldq 92(%%edx), %%mm2\n\t"
" movq %%mm5, %%mm6\n\t"
" pfadd %%mm4, %%mm3\n\t"
" pf2id %%mm0, %%mm1\n\t"
" pf2id %%mm3, %%mm3\n\t"
" pfadd 88(%%edx), %%mm5\n\t"
" movd %%mm1, %%eax\n\t"
" movd %%mm3, %%ecx\n\t"
" movw %%ax, 448(%%edi)\n\t"
" movw %%cx, 192(%%esi)\n\t"
" pf2id %%mm5, %%mm5\n\t"
" psrlq $32, %%mm1\n\t"
" psrlq $32, %%mm3\n\t"
" movd %%mm5, %%ebx\n\t"
" movd %%mm1, %%eax\n\t"
" movd %%mm3, %%ecx\n\t"
" movw %%bx, 96(%%esi)\n\t"
" movw %%ax, 480(%%edi)\n\t"
" movw %%cx, 64(%%esi)\n\t"
" pfadd %%mm2, %%mm0\n\t"
" pf2id %%mm0, %%mm0\n\t"
" movd %%mm0, %%eax\n\t"
" pfadd 68(%%edx), %%mm6\n\t"
" movw %%ax, 320(%%edi)\n\t"
" psrlq $32, %%mm0\n\t"
" pf2id %%mm6, %%mm6\n\t"
" movd %%mm0, %%eax\n\t"
" movd %%mm6, %%ebx\n\t"
" movw %%ax, 416(%%edi)\n\t"
" movw %%bx, 32(%%esi)\n\t"
" movq 96(%%edx), %%mm0\n\t"
" movq 112(%%edx), %%mm2\n\t"
" movq 104(%%edx), %%mm4\n\t"
" pfadd %%mm2, %%mm0\n\t"
" pfadd %%mm4, %%mm2\n\t"
" pfadd 120(%%edx), %%mm4\n\t"
" movq %%mm0, %%mm1\n\t"
" movq %%mm2, %%mm3\n\t"
" movq %%mm4, %%mm5\n\t"
" pfadd 64(%%edx), %%mm0\n\t"
" pfadd 80(%%edx), %%mm2\n\t"
" pfadd 72(%%edx), %%mm4\n\t"
" pf2id %%mm0, %%mm0\n\t"
" pf2id %%mm2, %%mm2\n\t"
" pf2id %%mm4, %%mm4\n\t"
" movd %%mm0, %%eax\n\t"
" movd %%mm2, %%ecx\n\t"
" movd %%mm4, %%ebx\n\t"
" movw %%ax, 480(%%esi)\n\t"
" movw %%cx, 352(%%esi)\n\t"
" movw %%bx, 224(%%esi)\n\t"
" psrlq $32, %%mm0\n\t"
" psrlq $32, %%mm2\n\t"
" psrlq $32, %%mm4\n\t"
" movd %%mm0, %%eax\n\t"
" movd %%mm2, %%ecx\n\t"
" movd %%mm4, %%ebx\n\t"
" movw %%ax, 32(%%edi)\n\t"
" movw %%cx, 160(%%edi)\n\t"
" movw %%bx, 288(%%edi)\n\t"
" pfadd 80(%%edx), %%mm1\n\t"
" pfadd 72(%%edx), %%mm3\n\t"
" pfadd 88(%%edx), %%mm5\n\t"
" pf2id %%mm1, %%mm1\n\t"
" pf2id %%mm3, %%mm3\n\t"
" pf2id %%mm5, %%mm5\n\t"
" movd %%mm1, %%eax\n\t"
" movd %%mm3, %%ecx\n\t"
" movd %%mm5, %%ebx\n\t"
" movw %%ax, 416(%%esi)\n\t"
" movw %%cx, 288(%%esi)\n\t"
" movw %%bx, 160(%%esi)\n\t"
" psrlq $32, %%mm1\n\t"
" psrlq $32, %%mm3\n\t"
" psrlq $32, %%mm5\n\t"
" movd %%mm1, %%eax\n\t"
" movd %%mm3, %%ecx\n\t"
" movd %%mm5, %%ebx\n\t"
" movw %%ax, 96(%%edi)\n\t"
" movw %%cx, 224(%%edi)\n\t"
" movw %%bx, 352(%%edi)\n\t"
" movsw\n\t"
".L_bye:\n\t"
" femms\n\t"
:
:"m"(a),"m"(b),"m"(c),"m"(tmp[0])
:"memory","%ebx","%esi","%edi");
}
|