Commit 1e4ecf26 authored by Loren Merritt's avatar Loren Merritt

ff_fft_calc_3dn/3dn2/sse: convert intrinsics to inline asm.

2.5% faster fft, 0.5% faster vorbis.

Originally committed as revision 6023 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 57060f89
...@@ -58,7 +58,7 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) ...@@ -58,7 +58,7 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
s->exptab1 = NULL; s->exptab1 = NULL;
/* compute constant table for HAVE_SSE version */ /* compute constant table for HAVE_SSE version */
#if (defined(HAVE_MMX) && (defined(HAVE_BUILTIN_VECTOR) || defined(HAVE_MM3DNOW))) \ #if defined(HAVE_MMX) \
|| (defined(HAVE_ALTIVEC) && !defined(ALTIVEC_USE_REFERENCE_C_CODE)) || (defined(HAVE_ALTIVEC) && !defined(ALTIVEC_USE_REFERENCE_C_CODE))
{ {
int has_vectors = mm_support(); int has_vectors = mm_support();
...@@ -67,15 +67,12 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) ...@@ -67,15 +67,12 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
#if defined(HAVE_MMX) #if defined(HAVE_MMX)
if (has_vectors & MM_3DNOWEXT) if (has_vectors & MM_3DNOWEXT)
s->imdct_calc = ff_imdct_calc_3dn2; s->imdct_calc = ff_imdct_calc_3dn2;
#ifdef HAVE_MM3DNOW
if (has_vectors & MM_3DNOWEXT) if (has_vectors & MM_3DNOWEXT)
/* 3DNowEx for Athlon(XP) */ /* 3DNowEx for Athlon(XP) */
s->fft_calc = ff_fft_calc_3dn2; s->fft_calc = ff_fft_calc_3dn2;
else if (has_vectors & MM_3DNOW) else if (has_vectors & MM_3DNOW)
/* 3DNow! for K6-2/3 */ /* 3DNow! for K6-2/3 */
s->fft_calc = ff_fft_calc_3dn; s->fft_calc = ff_fft_calc_3dn;
#endif
#ifdef HAVE_BUILTIN_VECTOR
if (has_vectors & MM_SSE2) if (has_vectors & MM_SSE2)
/* SSE for P4/K8 */ /* SSE for P4/K8 */
s->fft_calc = ff_fft_calc_sse; s->fft_calc = ff_fft_calc_sse;
...@@ -83,7 +80,6 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse) ...@@ -83,7 +80,6 @@ int ff_fft_init(FFTContext *s, int nbits, int inverse)
s->fft_calc == ff_fft_calc_c) s->fft_calc == ff_fft_calc_c)
/* SSE for P3 */ /* SSE for P3 */
s->fft_calc = ff_fft_calc_sse; s->fft_calc = ff_fft_calc_sse;
#endif
#else /* HAVE_MMX */ #else /* HAVE_MMX */
if (has_vectors & MM_ALTIVEC) if (has_vectors & MM_ALTIVEC)
s->fft_calc = ff_fft_calc_altivec; s->fft_calc = ff_fft_calc_altivec;
......
/* /*
* FFT/MDCT transform with 3DNow! optimizations * FFT/MDCT transform with 3DNow! optimizations
* Copyright (c) 2006 Zuxy MENG Jie. * Copyright (c) 2006 Zuxy MENG Jie, Loren Merritt
* Based on fft_sse.c copyright (c) 2002 Fabrice Bellard. * Based on fft_sse.c copyright (c) 2002 Fabrice Bellard.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -18,11 +18,6 @@ ...@@ -18,11 +18,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "../dsputil.h" #include "../dsputil.h"
#include <math.h>
#ifdef HAVE_MM3DNOW
#include <mm3dnow.h>
static const int p1m1[2] __attribute__((aligned(8))) = static const int p1m1[2] __attribute__((aligned(8))) =
{ 0, 1 << 31 }; { 0, 1 << 31 };
...@@ -33,104 +28,96 @@ static const int m1p1[2] __attribute__((aligned(8))) = ...@@ -33,104 +28,96 @@ static const int m1p1[2] __attribute__((aligned(8))) =
void ff_fft_calc_3dn(FFTContext *s, FFTComplex *z) void ff_fft_calc_3dn(FFTContext *s, FFTComplex *z)
{ {
int ln = s->nbits; int ln = s->nbits;
int j, np, np2; long i, j;
int nblocks, nloops; long nblocks, nloops;
register FFTComplex *p, *q; FFTComplex *p, *cptr;
FFTComplex *cptr, *cptr1;
int k; asm volatile(
/* FEMMS is not a must here but recommended by AMD */
np = 1 << ln; "femms \n\t"
/* FEMMS not a must here but recommended by AMD */ "movq %0, %%mm7 \n\t"
_m_femms(); ::"m"(*(s->inverse ? m1p1 : p1m1))
);
{
__m64 *r, a0, a1, b0, b1, tmp, c; i = 8 << ln;
asm volatile(
r = (__m64 *)&z[0]; "1: \n\t"
if (s->inverse) "sub $32, %0 \n\t"
c = *(__m64 *)m1p1; "movq (%0,%1), %%mm0 \n\t"
else "movq 16(%0,%1), %%mm1 \n\t"
c = *(__m64 *)p1m1; "movq 8(%0,%1), %%mm2 \n\t"
"movq 24(%0,%1), %%mm3 \n\t"
j = (np >> 2); "movq %%mm0, %%mm4 \n\t"
do { "movq %%mm1, %%mm5 \n\t"
/* do the pass 0 butterfly */ "pfadd %%mm2, %%mm0 \n\t"
a0 = _m_pfadd(r[0], r[1]); "pfadd %%mm3, %%mm1 \n\t"
a1 = _m_pfsub(r[0], r[1]); "pfsub %%mm2, %%mm4 \n\t"
"pfsub %%mm3, %%mm5 \n\t"
/* do the pass 0 butterfly */ "movq %%mm0, %%mm2 \n\t"
b0 = _m_pfadd(r[2], r[3]); "punpckldq %%mm5, %%mm6 \n\t"
b1 = _m_pfsub(r[2], r[3]); "punpckhdq %%mm6, %%mm5 \n\t"
"movq %%mm4, %%mm3 \n\t"
/* multiply third by -i */ "pxor %%mm7, %%mm5 \n\t"
tmp = _m_punpckhdq(b1, b1); "pfadd %%mm1, %%mm0 \n\t"
b1 = _m_punpckldq(b1, b1); "pfadd %%mm5, %%mm4 \n\t"
b1 = _m_punpckldq(tmp, b1); "pfsub %%mm1, %%mm2 \n\t"
b1 = _m_pxor(b1, c); "pfsub %%mm5, %%mm3 \n\t"
"movq %%mm0, (%0,%1) \n\t"
/* do the pass 1 butterfly */ "movq %%mm4, 8(%0,%1) \n\t"
r[0] = _m_pfadd(a0, b0); "movq %%mm2, 16(%0,%1) \n\t"
r[1] = _m_pfadd(a1, b1); "movq %%mm3, 24(%0,%1) \n\t"
r[2] = _m_pfsub(a0, b0); "jg 1b \n\t"
r[3] = _m_pfsub(a1, b1); :"+r"(i)
r += 4; :"r"(z)
} while (--j != 0); );
}
/* pass 2 .. ln-1 */ /* pass 2 .. ln-1 */
nblocks = np >> 3; nblocks = 1 << (ln-3);
nloops = 1 << 2; nloops = 1 << 2;
np2 = np >> 1; cptr = s->exptab1;
cptr1 = s->exptab1;
do { do {
p = z; p = z;
q = z + nloops;
j = nblocks; j = nblocks;
do { do {
cptr = cptr1; i = nloops*8;
k = nloops >> 1; asm volatile(
do { "1: \n\t"
__m64 a0, a1, b0, b1, c0, c1, t10, t11, t20, t21; "sub $16, %0 \n\t"
"movq (%1,%0), %%mm0 \n\t"
a0 = *(__m64 *)&p[0]; "movq 8(%1,%0), %%mm1 \n\t"
a1 = *(__m64 *)&p[1]; "movq (%2,%0), %%mm2 \n\t"
b0 = *(__m64 *)&q[0]; "movq 8(%2,%0), %%mm3 \n\t"
b1 = *(__m64 *)&q[1]; "movq %%mm2, %%mm4 \n\t"
"movq %%mm3, %%mm5 \n\t"
/* complex mul */ "punpckldq %%mm2, %%mm2 \n\t"
c0 = *(__m64 *)&cptr[0]; "punpckldq %%mm3, %%mm3 \n\t"
c1 = *(__m64 *)&cptr[1]; "punpckhdq %%mm4, %%mm4 \n\t"
/* cre*re cim*re */ "punpckhdq %%mm5, %%mm5 \n\t"
t10 = _m_pfmul(c0, _m_punpckldq(b0, b0)); "pfmul (%3,%0,2), %%mm2 \n\t" // cre*re cim*re
t11 = _m_pfmul(c1, _m_punpckldq(b1, b1)); "pfmul 8(%3,%0,2), %%mm3 \n\t"
c0 = *(__m64 *)&cptr[2]; "pfmul 16(%3,%0,2), %%mm4 \n\t" // -cim*im cre*im
c1 = *(__m64 *)&cptr[3]; "pfmul 24(%3,%0,2), %%mm5 \n\t"
/* -cim*im cre*im */ "pfadd %%mm2, %%mm4 \n\t" // cre*re-cim*im cim*re+cre*im
t20 = _m_pfmul(c0, _m_punpckhdq(b0, b0)); "pfadd %%mm3, %%mm5 \n\t"
t21 = _m_pfmul(c1, _m_punpckhdq(b1, b1)); "movq %%mm0, %%mm2 \n\t"
b0 = _m_pfadd(t10, t20); "movq %%mm1, %%mm3 \n\t"
b1 = _m_pfadd(t11, t21); "pfadd %%mm4, %%mm0 \n\t"
"pfadd %%mm5, %%mm1 \n\t"
/* butterfly */ "pfsub %%mm4, %%mm2 \n\t"
*(__m64 *)&p[0] = _m_pfadd(a0, b0); "pfsub %%mm5, %%mm3 \n\t"
*(__m64 *)&p[1] = _m_pfadd(a1, b1); "movq %%mm0, (%1,%0) \n\t"
*(__m64 *)&q[0] = _m_pfsub(a0, b0); "movq %%mm1, 8(%1,%0) \n\t"
*(__m64 *)&q[1] = _m_pfsub(a1, b1); "movq %%mm2, (%2,%0) \n\t"
"movq %%mm3, 8(%2,%0) \n\t"
p += 2; "jg 1b \n\t"
q += 2; :"+r"(i)
cptr += 4; :"r"(p), "r"(p + nloops), "r"(cptr)
} while (--k); );
p += nloops*2;
p += nloops;
q += nloops;
} while (--j); } while (--j);
cptr1 += nloops * 2; cptr += nloops*2;
nblocks = nblocks >> 1; nblocks >>= 1;
nloops = nloops << 1; nloops <<= 1;
} while (nblocks != 0); } while (nblocks != 0);
_m_femms(); asm volatile("femms");
} }
#endif
...@@ -18,11 +18,6 @@ ...@@ -18,11 +18,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "../dsputil.h" #include "../dsputil.h"
#include <math.h>
#ifdef HAVE_MM3DNOW
#include <mm3dnow.h>
static const int p1m1[2] __attribute__((aligned(8))) = static const int p1m1[2] __attribute__((aligned(8))) =
{ 0, 1 << 31 }; { 0, 1 << 31 };
...@@ -33,108 +28,97 @@ static const int m1p1[2] __attribute__((aligned(8))) = ...@@ -33,108 +28,97 @@ static const int m1p1[2] __attribute__((aligned(8))) =
void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z) void ff_fft_calc_3dn2(FFTContext *s, FFTComplex *z)
{ {
int ln = s->nbits; int ln = s->nbits;
int j, np, np2; long i, j;
int nblocks, nloops; long nblocks, nloops;
register FFTComplex *p, *q; FFTComplex *p, *cptr;
FFTComplex *cptr, *cptr1;
int k;
np = 1 << ln; asm volatile(
/* FEMMS is not a must here but recommended by AMD */ /* FEMMS is not a must here but recommended by AMD */
_m_femms(); "femms \n\t"
"movq %0, %%mm7 \n\t"
{ ::"m"(*(s->inverse ? m1p1 : p1m1))
__m64 *r, a0, a1, b0, b1, c; );
r = (__m64 *)&z[0];
if (s->inverse)
c = *(__m64 *)m1p1;
else
c = *(__m64 *)p1m1;
j = (np >> 2);
do {
/* do the pass 0 butterfly */
a0 = _m_pfadd(r[0], r[1]);
a1 = _m_pfsub(r[0], r[1]);
/* do the pass 0 butterfly */
b0 = _m_pfadd(r[2], r[3]);
b1 = _m_pfsub(r[2], r[3]);
/* multiply third by -i */
b1 = _m_pswapd(b1);
b1 = _m_pxor(b1, c);
r[0] = _m_pfadd(a0, b0); i = 8 << ln;
r[1] = _m_pfadd(a1, b1); asm volatile(
r[2] = _m_pfsub(a0, b0); "1: \n\t"
r[3] = _m_pfsub(a1, b1); "sub $32, %0 \n\t"
r += 4; "movq (%0,%1), %%mm0 \n\t"
} while (--j != 0); "movq 16(%0,%1), %%mm1 \n\t"
} "movq 8(%0,%1), %%mm2 \n\t"
"movq 24(%0,%1), %%mm3 \n\t"
"movq %%mm0, %%mm4 \n\t"
"movq %%mm1, %%mm5 \n\t"
"pfadd %%mm2, %%mm0 \n\t"
"pfadd %%mm3, %%mm1 \n\t"
"pfsub %%mm2, %%mm4 \n\t"
"pfsub %%mm3, %%mm5 \n\t"
"movq %%mm0, %%mm2 \n\t"
"pswapd %%mm5, %%mm5 \n\t"
"movq %%mm4, %%mm3 \n\t"
"pxor %%mm7, %%mm5 \n\t"
"pfadd %%mm1, %%mm0 \n\t"
"pfadd %%mm5, %%mm4 \n\t"
"pfsub %%mm1, %%mm2 \n\t"
"pfsub %%mm5, %%mm3 \n\t"
"movq %%mm0, (%0,%1) \n\t"
"movq %%mm4, 8(%0,%1) \n\t"
"movq %%mm2, 16(%0,%1) \n\t"
"movq %%mm3, 24(%0,%1) \n\t"
"jg 1b \n\t"
:"+r"(i)
:"r"(z)
);
/* pass 2 .. ln-1 */ /* pass 2 .. ln-1 */
nblocks = np >> 3; nblocks = 1 << (ln-3);
nloops = 1 << 2; nloops = 1 << 2;
np2 = np >> 1; cptr = s->exptab1;
cptr1 = s->exptab1;
do { do {
p = z; p = z;
q = z + nloops;
j = nblocks; j = nblocks;
do { do {
cptr = cptr1; i = nloops*8;
k = nloops >> 1; asm volatile(
do { "1: \n\t"
__m64 a0, a1, b0, b1, c0, c1, t10, t11, t20, t21; "sub $16, %0 \n\t"
"movq (%1,%0), %%mm0 \n\t"
a0 = *(__m64 *)&p[0]; "movq 8(%1,%0), %%mm1 \n\t"
a1 = *(__m64 *)&p[1]; "movq (%2,%0), %%mm2 \n\t"
b0 = *(__m64 *)&q[0]; "movq 8(%2,%0), %%mm3 \n\t"
b1 = *(__m64 *)&q[1]; "movq (%3,%0,2), %%mm4 \n\t"
"movq 8(%3,%0,2), %%mm5 \n\t"
/* complex mul */ "pswapd %%mm4, %%mm6 \n\t" // no need for cptr[2] & cptr[3]
c0 = *(__m64 *)&cptr[0]; "pswapd %%mm5, %%mm7 \n\t"
c1 = *(__m64 *)&cptr[1]; "pfmul %%mm2, %%mm4 \n\t" // cre*re cim*im
/* cre*re cim*im */ "pfmul %%mm3, %%mm5 \n\t"
t10 = _m_pfmul(c0, b0); "pfmul %%mm2, %%mm6 \n\t" // cim*re cre*im
t11 = _m_pfmul(c1, b1); "pfmul %%mm3, %%mm7 \n\t"
/* no need to access cptr[2] & cptr[3] */ "pfpnacc %%mm6, %%mm4 \n\t" // cre*re-cim*im cim*re+cre*im
c0 = _m_pswapd(c0); "pfpnacc %%mm7, %%mm5 \n\t"
c1 = _m_pswapd(c1); "movq %%mm0, %%mm2 \n\t"
/* cim*re cre*im */ "movq %%mm1, %%mm3 \n\t"
t20 = _m_pfmul(c0, b0); "pfadd %%mm4, %%mm0 \n\t"
t21 = _m_pfmul(c1, b1); "pfadd %%mm5, %%mm1 \n\t"
"pfsub %%mm4, %%mm2 \n\t"
/* cre*re-cim*im cim*re+cre*im */ "pfsub %%mm5, %%mm3 \n\t"
b0 = _m_pfpnacc(t10, t20); "movq %%mm0, (%1,%0) \n\t"
b1 = _m_pfpnacc(t11, t21); "movq %%mm1, 8(%1,%0) \n\t"
"movq %%mm2, (%2,%0) \n\t"
/* butterfly */ "movq %%mm3, 8(%2,%0) \n\t"
*(__m64 *)&p[0] = _m_pfadd(a0, b0); "jg 1b \n\t"
*(__m64 *)&p[1] = _m_pfadd(a1, b1); :"+r"(i)
*(__m64 *)&q[0] = _m_pfsub(a0, b0); :"r"(p), "r"(p + nloops), "r"(cptr)
*(__m64 *)&q[1] = _m_pfsub(a1, b1); );
p += nloops*2;
p += 2;
q += 2;
cptr += 4;
} while (--k);
p += nloops;
q += nloops;
} while (--j); } while (--j);
cptr1 += nloops * 2; cptr += nloops*2;
nblocks = nblocks >> 1; nblocks >>= 1;
nloops = nloops << 1; nloops <<= 1;
} while (nblocks != 0); } while (nblocks != 0);
_m_femms(); asm volatile("femms");
} }
#endif
void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output, void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output,
const FFTSample *input, FFTSample *tmp) const FFTSample *input, FFTSample *tmp)
{ {
...@@ -221,3 +205,4 @@ void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output, ...@@ -221,3 +205,4 @@ void ff_imdct_calc_3dn2(MDCTContext *s, FFTSample *output,
} }
asm volatile("femms"); asm volatile("femms");
} }
...@@ -17,11 +17,6 @@ ...@@ -17,11 +17,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#include "../dsputil.h" #include "../dsputil.h"
#include <math.h>
#ifdef HAVE_BUILTIN_VECTOR
#include <xmmintrin.h>
static const int p1p1p1m1[4] __attribute__((aligned(16))) = static const int p1p1p1m1[4] __attribute__((aligned(16))) =
{ 0, 0, 0, 1 << 31 }; { 0, 0, 0, 1 << 31 };
...@@ -45,96 +40,81 @@ static void print_v4sf(const char *str, __m128 a) ...@@ -45,96 +40,81 @@ static void print_v4sf(const char *str, __m128 a)
void ff_fft_calc_sse(FFTContext *s, FFTComplex *z) void ff_fft_calc_sse(FFTContext *s, FFTComplex *z)
{ {
int ln = s->nbits; int ln = s->nbits;
int j, np, np2; long i, j;
int nblocks, nloops; long nblocks, nloops;
register FFTComplex *p, *q; FFTComplex *p, *cptr;
FFTComplex *cptr, *cptr1;
int k; asm volatile(
"movaps %0, %%xmm4 \n\t"
np = 1 << ln; "movaps %1, %%xmm5 \n\t"
::"m"(*p1p1m1m1),
{ "m"(*(s->inverse ? p1p1m1p1 : p1p1p1m1))
__m128 *r, a, b, a1, c1, c2; );
r = (__m128 *)&z[0]; i = 8 << ln;
c1 = *(__m128 *)p1p1m1m1; asm volatile(
if (s->inverse) "1: \n\t"
c2 = *(__m128 *)p1p1m1p1; "sub $32, %0 \n\t"
else
c2 = *(__m128 *)p1p1p1m1;
j = (np >> 2);
do {
a = r[0];
b = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2));
a = _mm_xor_ps(a, c1);
/* do the pass 0 butterfly */ /* do the pass 0 butterfly */
a = _mm_add_ps(a, b); "movaps (%0,%1), %%xmm0 \n\t"
"movaps %%xmm0, %%xmm1 \n\t"
a1 = r[1]; "shufps $0x4E, %%xmm0, %%xmm0 \n\t"
b = _mm_shuffle_ps(a1, a1, _MM_SHUFFLE(1, 0, 3, 2)); "xorps %%xmm4, %%xmm1 \n\t"
a1 = _mm_xor_ps(a1, c1); "addps %%xmm1, %%xmm0 \n\t"
/* do the pass 0 butterfly */ "movaps 16(%0,%1), %%xmm2 \n\t"
b = _mm_add_ps(a1, b); "movaps %%xmm2, %%xmm3 \n\t"
"shufps $0x4E, %%xmm2, %%xmm2 \n\t"
"xorps %%xmm4, %%xmm3 \n\t"
"addps %%xmm3, %%xmm2 \n\t"
/* multiply third by -i */ /* multiply third by -i */
/* by toggling the sign bit */ /* by toggling the sign bit */
b = _mm_shuffle_ps(b, b, _MM_SHUFFLE(2, 3, 1, 0)); "shufps $0xB4, %%xmm2, %%xmm2 \n\t"
b = _mm_xor_ps(b, c2); "xorps %%xmm5, %%xmm2 \n\t"
/* do the pass 1 butterfly */ /* do the pass 1 butterfly */
r[0] = _mm_add_ps(a, b); "movaps %%xmm0, %%xmm1 \n\t"
r[1] = _mm_sub_ps(a, b); "addps %%xmm2, %%xmm0 \n\t"
r += 2; "subps %%xmm2, %%xmm1 \n\t"
} while (--j != 0); "movaps %%xmm0, (%0,%1) \n\t"
} "movaps %%xmm1, 16(%0,%1) \n\t"
"jg 1b \n\t"
:"+r"(i)
:"r"(z)
);
/* pass 2 .. ln-1 */ /* pass 2 .. ln-1 */
nblocks = np >> 3; nblocks = 1 << (ln-3);
nloops = 1 << 2; nloops = 1 << 2;
np2 = np >> 1; cptr = s->exptab1;
cptr1 = s->exptab1;
do { do {
p = z; p = z;
q = z + nloops;
j = nblocks; j = nblocks;
do { do {
cptr = cptr1; i = nloops*8;
k = nloops >> 1; asm volatile(
do { "1: \n\t"
__m128 a, b, c, t1, t2; "sub $16, %0 \n\t"
"movaps (%2,%0), %%xmm1 \n\t"
a = *(__m128 *)p; "movaps (%1,%0), %%xmm0 \n\t"
b = *(__m128 *)q; "movaps %%xmm1, %%xmm2 \n\t"
"shufps $0xA0, %%xmm1, %%xmm1 \n\t"
/* complex mul */ "shufps $0xF5, %%xmm2, %%xmm2 \n\t"
c = *(__m128 *)cptr; "mulps (%3,%0,2), %%xmm1 \n\t" // cre*re cim*re
/* cre*re cim*re */ "mulps 16(%3,%0,2), %%xmm2 \n\t" // -cim*im cre*im
t1 = _mm_mul_ps(c, "addps %%xmm2, %%xmm1 \n\t"
_mm_shuffle_ps(b, b, _MM_SHUFFLE(2, 2, 0, 0))); "movaps %%xmm0, %%xmm3 \n\t"
c = *(__m128 *)(cptr + 2); "addps %%xmm1, %%xmm0 \n\t"
/* -cim*im cre*im */ "subps %%xmm1, %%xmm3 \n\t"
t2 = _mm_mul_ps(c, "movaps %%xmm0, (%1,%0) \n\t"
_mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 3, 1, 1))); "movaps %%xmm3, (%2,%0) \n\t"
b = _mm_add_ps(t1, t2); "jg 1b \n\t"
:"+r"(i)
/* butterfly */ :"r"(p), "r"(p + nloops), "r"(cptr)
*(__m128 *)p = _mm_add_ps(a, b); );
*(__m128 *)q = _mm_sub_ps(a, b); p += nloops*2;
p += 2;
q += 2;
cptr += 4;
} while (--k);
p += nloops;
q += nloops;
} while (--j); } while (--j);
cptr1 += nloops * 2; cptr += nloops*2;
nblocks = nblocks >> 1; nblocks >>= 1;
nloops = nloops << 1; nloops <<= 1;
} while (nblocks != 0); } while (nblocks != 0);
} }
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment