--- caps-0.1.1/dsp/Eq.h Mon Feb 16 16:58:56 2004 +++ dsp/Eq.h Wed Feb 18 21:45:38 2004 @@ -10,10 +10,6 @@ #ifndef _DSP_EQ_H_ #define _DSP_EQ_H_ -#ifndef __i386__ -# undef USE_SSE -#endif - namespace DSP { /* BANDS must be a multiple of 4 to enable the use of SSE instructions. @@ -101,7 +97,6 @@ a[i] = b[i] = c[i] = 0; } -#ifndef USE_SSE /* per-band recursion: * y = 2 * (a * (x - x[-2]) + c * y[-1] - b * y[-2]) */ @@ -127,86 +122,6 @@ return r; } -#else /* do USE_SSE */ - /* parallelized version of above. - * - * FIXME: make asm work with -funroll-loops and the BANDS parameter - * - * per-band recursion: - * y = 2 * (a * (x - x[-2]) - b * y[-2] + c * y[-1]) - */ - d_sample process (d_sample s) - { - int z1 = h, z2 = h ^ 1; - - float * y1 = y + z1 * BANDS; - float * y2 = y + z2 * BANDS; - - /* load 0,0,0,0 into xmm4, holding the total sum */ - asm ("xorps %xmm4, %xmm4"); - - /* load 2,2,2,2 into xmm3 */ - asm ("movaps (%0), %%xmm3" : : "p" (two)); - - /* likewise, load (x - x[-2]) into xmm0 */ - float x_x2 = s - x[z2]; - asm ("movss %0, %%xmm0" : : "m" (x_x2)); - asm ("shufps $0, %xmm0, %xmm0"); - - x[z2] = s; - h = z2; - - /* this fails to compile with -funroll-loops */ - for (int i = 0; i < BANDS; i += 4) - { - /* esi = y2 + i (we need it later) */ - asm ("mov %0, %%esi" : : "p" (y2 + i) : "%esi"); - /* edi = y1 + i (we need it later) */ - asm ("mov %0, %%edi" : : "p" (y1 + i) : "%edi"); - - asm (" - movaps %%xmm0, %%xmm1 /* x - x[-2] into xmm1 */ - movl %0, %%eax /* a + i into eax */ - mulps (%%eax), %%xmm1 /* accu *= (x - x[-2]) */ - addl %1, %%eax /* eax += BANDS * sizeof (float) */ - movaps (%%esi), %%xmm2 /* y[-2] into xmm2 */ - mulps (%%eax), %%xmm2 /* xmm2 *= b */ - addl %1, %%eax /* eax += BANDS * sizeof (float) */ - subps %%xmm2, %%xmm1 /* accu -= xmm2 */ - movaps (%%edi), %%xmm2 /* y[-1] into xmm2 */ - mulps (%%eax), %%xmm2 /* xmm2 *= c + i */ - addps %%xmm2, %%xmm1 /* accu += xmm2 */ - mulps %%xmm3, %%xmm1 /* accu *= 2 */ - movaps %%xmm1, (%%esi) /* store accu into y */ - " : - : "p" (a + i), "i" (BANDS * sizeof (float)) - : "%eax", "%esi", "%edi"); - - asm (" - mov %0, %%eax /* eax = gain + i */ - mov %%eax, %%ebx /* ebx = eax */ - movaps (%%eax), %%xmm2 /* xmm2 = gain */ - addl %1, %%eax /* eax += BANDS * sizeof (float) = gf + i */ - mulps %%xmm2, %%xmm1 /* accu *= gain */ - mulps (%%eax), %%xmm2 /* gain *= gf */ - movaps %%xmm2, (%%ebx) /* store gain */ - addps %%xmm1, %%xmm4 /* sum += accu */ - " : - : "p" (gain + i), "i" (BANDS * sizeof (float)) - : "%eax", "%ebx"); - } - - asm (" - movaps %%xmm4, (%0) - flds (%0) - fadds 4(%0) - fadds 8(%0) - fadds 12(%0) - fstps (%0)" : : "p" (temp) : "%st"); - - return temp[0]; - } -#endif /* USE_SSE */ }; } /* namespace DSP */