annotate i386/fft_3dn2.c @ 7542:a8a8205a9081 libavcodec

split-radix FFT c is 1.9x faster than previous c (on various x86 cpus), sse is 1.6x faster than previous sse.
author lorenm
date Tue, 12 Aug 2008 00:26:58 +0000
parents fc843d00867c
children ee1cb5ab9f99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3175
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
1 /*
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
2 * FFT/MDCT transform with Extended 3DNow! optimizations
3555
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
3 * Copyright (c) 2006 Zuxy MENG Jie, Loren Merritt
3175
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
4 * Based on fft_sse.c copyright (c) 2002 Fabrice Bellard.
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
5 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3748
diff changeset
6 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3748
diff changeset
7 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3748
diff changeset
8 * FFmpeg is free software; you can redistribute it and/or
3175
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
9 * modify it under the terms of the GNU Lesser General Public
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
10 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3748
diff changeset
11 * version 2.1 of the License, or (at your option) any later version.
3175
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
12 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3748
diff changeset
13 * FFmpeg is distributed in the hope that it will be useful,
3175
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
16 * Lesser General Public License for more details.
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
17 *
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
18 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3748
diff changeset
19 * License along with FFmpeg; if not, write to the Free Software
3175
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
21 */
6763
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6755
diff changeset
22
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6755
diff changeset
23 #include "libavutil/x86_cpu.h"
f7cbb7733146 Use full path for #includes from another directory.
diego
parents: 6755
diff changeset
24 #include "libavcodec/dsputil.h"
3175
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
25
7542
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
26 #ifdef EMULATE_3DNOWEXT
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
27 #define ff_fft_calc_3dn2 ff_fft_calc_3dn
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
28 #define ff_fft_dispatch_3dn2 ff_fft_dispatch_3dn
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
29 #define ff_fft_dispatch_interleave_3dn2 ff_fft_dispatch_interleave_3dn
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
30 #define ff_imdct_calc_3dn2 ff_imdct_calc_3dn
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
31 #define ff_imdct_half_3dn2 ff_imdct_half_3dn
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
32 #endif
3175
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
33
7542
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
34 void ff_fft_dispatch_3dn2(FFTComplex *z, int nbits);
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
35 void ff_fft_dispatch_interleave_3dn2(FFTComplex *z, int nbits);
3175
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
36
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
37 void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z)
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
38 {
7542
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
39 int n = 1<<s->nbits;
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
40 int i;
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
41 ff_fft_dispatch_interleave_3dn2(z, s->nbits);
3590
a3d97c60ea07 ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents: 3561
diff changeset
42 asm volatile("femms");
7542
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
43 if(n <= 8)
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
44 for(i=0; i<n; i+=2)
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
45 FFSWAP(FFTSample, z[i].im, z[i+1].re);
3175
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
46 }
c20c181e0eca 3DNow! & Extended 3DNow! versions of FFT
corey
parents:
diff changeset
47
7263
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
48 static void imdct_3dn2(MDCTContext *s, const FFTSample *input, FFTSample *tmp)
3555
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
49 {
7263
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
50 long n4, n2, n;
6755
33896780c612 Do not misuse long as the size of a register in x86.
ramiro
parents: 5010
diff changeset
51 x86_reg k;
3555
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
52 const uint16_t *revtab = s->fft.revtab;
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
53 const FFTSample *tcos = s->tcos;
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
54 const FFTSample *tsin = s->tsin;
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
55 const FFTSample *in1, *in2;
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
56 FFTComplex *z = (FFTComplex *)tmp;
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
57
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
58 n = 1 << s->nbits;
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
59 n2 = n >> 1;
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
60 n4 = n >> 2;
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
61
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
62 /* pre rotation */
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
63 in1 = input;
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
64 in2 = input + n2 - 1;
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
65 for(k = 0; k < n4; k++) {
3560
f1a16d793fc5 gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents: 3559
diff changeset
66 // FIXME a single block is faster, but gcc 2.95 and 3.4.x on 32bit can't compile it
3555
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
67 asm volatile(
3560
f1a16d793fc5 gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents: 3559
diff changeset
68 "movd %0, %%mm0 \n\t"
f1a16d793fc5 gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents: 3559
diff changeset
69 "movd %2, %%mm1 \n\t"
f1a16d793fc5 gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents: 3559
diff changeset
70 "punpckldq %1, %%mm0 \n\t"
f1a16d793fc5 gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents: 3559
diff changeset
71 "punpckldq %3, %%mm1 \n\t"
3555
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
72 "movq %%mm0, %%mm2 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
73 "pfmul %%mm1, %%mm0 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
74 "pswapd %%mm1, %%mm1 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
75 "pfmul %%mm1, %%mm2 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
76 "pfpnacc %%mm2, %%mm0 \n\t"
3560
f1a16d793fc5 gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents: 3559
diff changeset
77 ::"m"(in2[-2*k]), "m"(in1[2*k]),
f1a16d793fc5 gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents: 3559
diff changeset
78 "m"(tcos[k]), "m"(tsin[k])
f1a16d793fc5 gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents: 3559
diff changeset
79 );
f1a16d793fc5 gcc 2.95 and 3.4.x on x86 32bit without fomit-frame-pointer can't even find 5 registers for asm input.
lorenm
parents: 3559
diff changeset
80 asm volatile(
3555
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
81 "movq %%mm0, %0 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
82 :"=m"(z[revtab[k]])
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
83 );
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
84 }
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
85
7542
a8a8205a9081 split-radix FFT
lorenm
parents: 7263
diff changeset
86 ff_fft_calc_3dn2(&s->fft, z);
3555
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
87
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
88 /* post rotation + reordering */
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
89 for(k = 0; k < n4; k++) {
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
90 asm volatile(
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
91 "movq %0, %%mm0 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
92 "movd %1, %%mm1 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
93 "punpckldq %2, %%mm1 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
94 "movq %%mm0, %%mm2 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
95 "pfmul %%mm1, %%mm0 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
96 "pswapd %%mm1, %%mm1 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
97 "pfmul %%mm1, %%mm2 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
98 "pfpnacc %%mm2, %%mm0 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
99 "movq %%mm0, %0 \n\t"
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
100 :"+m"(z[k])
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
101 :"m"(tcos[k]), "m"(tsin[k])
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
102 );
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
103 }
7263
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
104 }
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
105
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
106 void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output,
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
107 const FFTSample *input, FFTSample *tmp)
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
108 {
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
109 x86_reg k;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
110 long n8, n2, n;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
111 FFTComplex *z = (FFTComplex *)tmp;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
112
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
113 n = 1 << s->nbits;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
114 n2 = n >> 1;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
115 n8 = n >> 3;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
116
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
117 imdct_3dn2(s, input, tmp);
3555
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
118
3747
ba1f57431c85 tweak ff_imdct_calc_3dn2
lorenm
parents: 3590
diff changeset
119 k = n-8;
3555
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
120 asm volatile("movd %0, %%mm7" ::"r"(1<<31));
3747
ba1f57431c85 tweak ff_imdct_calc_3dn2
lorenm
parents: 3590
diff changeset
121 asm volatile(
3748
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
122 "1: \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
123 "movq (%4,%0), %%mm0 \n\t" // z[n8+k]
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
124 "neg %0 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
125 "pswapd -8(%4,%0), %%mm1 \n\t" // z[n8-1-k]
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
126 "movq %%mm0, %%mm2 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
127 "pxor %%mm7, %%mm2 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
128 "punpckldq %%mm1, %%mm2 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
129 "pswapd %%mm2, %%mm3 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
130 "punpckhdq %%mm1, %%mm0 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
131 "pswapd %%mm0, %%mm4 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
132 "pxor %%mm7, %%mm0 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
133 "pxor %%mm7, %%mm4 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
134 "movq %%mm3, -8(%3,%0) \n\t" // output[n-2-2*k] = { z[n8-1-k].im, -z[n8+k].re }
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
135 "movq %%mm4, -8(%2,%0) \n\t" // output[n2-2-2*k]= { -z[n8-1-k].re, z[n8+k].im }
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
136 "neg %0 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
137 "movq %%mm0, (%1,%0) \n\t" // output[2*k] = { -z[n8+k].im, z[n8-1-k].re }
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
138 "movq %%mm2, (%2,%0) \n\t" // output[n2+2*k] = { -z[n8+k].re, z[n8-1-k].im }
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
139 "sub $8, %0 \n\t"
82d22b7e80ff cosmetics (indentation)
lorenm
parents: 3747
diff changeset
140 "jge 1b \n\t"
3747
ba1f57431c85 tweak ff_imdct_calc_3dn2
lorenm
parents: 3590
diff changeset
141 :"+r"(k)
ba1f57431c85 tweak ff_imdct_calc_3dn2
lorenm
parents: 3590
diff changeset
142 :"r"(output), "r"(output+n2), "r"(output+n), "r"(z+n8)
ba1f57431c85 tweak ff_imdct_calc_3dn2
lorenm
parents: 3590
diff changeset
143 :"memory"
ba1f57431c85 tweak ff_imdct_calc_3dn2
lorenm
parents: 3590
diff changeset
144 );
3561
97325fecd35a emms -> femms
lorenm
parents: 3560
diff changeset
145 asm volatile("femms");
3555
5ea82888103e 3dnow2 implementation of imdct.
lorenm
parents: 3175
diff changeset
146 }
3590
a3d97c60ea07 ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.
lorenm
parents: 3561
diff changeset
147
7263
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
148 void ff_imdct_half_3dn2(MDCTContext *s, FFTSample *output,
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
149 const FFTSample *input, FFTSample *tmp)
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
150 {
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
151 x86_reg j, k;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
152 long n8, n4, n;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
153 FFTComplex *z = (FFTComplex *)tmp;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
154
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
155 n = 1 << s->nbits;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
156 n4 = n >> 2;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
157 n8 = n >> 3;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
158
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
159 imdct_3dn2(s, input, tmp);
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
160
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
161 j = -n;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
162 k = n-8;
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
163 asm volatile("movd %0, %%mm7" ::"r"(1<<31));
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
164 asm volatile(
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
165 "1: \n\t"
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
166 "movq (%3,%1), %%mm0 \n\t" // z[n8+k]
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
167 "pswapd (%3,%0), %%mm1 \n\t" // z[n8-1-k]
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
168 "movq %%mm0, %%mm2 \n\t"
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
169 "punpckldq %%mm1, %%mm0 \n\t"
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
170 "punpckhdq %%mm2, %%mm1 \n\t"
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
171 "pxor %%mm7, %%mm0 \n\t"
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
172 "pxor %%mm7, %%mm1 \n\t"
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
173 "movq %%mm0, (%2,%1) \n\t" // output[n4+2*k] = { -z[n8+k].re, z[n8-1-k].im }
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
174 "movq %%mm1, (%2,%0) \n\t" // output[n4-2-2*k] = { -z[n8-1-k].re, z[n8+k].im }
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
175 "sub $8, %1 \n\t"
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
176 "add $8, %0 \n\t"
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
177 "jl 1b \n\t"
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
178 :"+r"(j), "+r"(k)
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
179 :"r"(output+n4), "r"(z+n8)
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
180 :"memory"
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
181 );
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
182 asm volatile("femms");
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
183 }
fc843d00867c exploit mdct symmetry
lorenm
parents: 6763
diff changeset
184