Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25230
Modified Files: Tag: devel_0_38 m_simd_sse_gcc.c m_simd_sse_vc.h m_simd_sse_gcc.h m_simd_ve_gcc.h m_simd.c d_ctl.c Log Message: oops ... reversed hanning ... this should work
Index: m_simd.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd.c,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.3 diff -C2 -d -r1.1.4.2 -r1.1.4.3 *** m_simd.c 8 Jan 2005 19:43:52 -0000 1.1.4.2 --- m_simd.c 8 Jan 2005 22:13:40 -0000 1.1.4.3 *************** *** 111,112 **** --- 111,161 ---- #endif /* DONTUSESIMD */
+ + float sumvec_8(t_float* in, t_int n) + { + int i; + float result = 0; + + n>>=3; + for (i = 0; i != n; ++i) + { + result += *in++; + result += *in++; + result += *in++; + result += *in++; + result += *in++; + result += *in++; + result += *in++; + result += *in++; + } + return result; + } + + float env_tilde_accum(t_float* in, t_float* hp, t_int n) + { + float ret = 0; + int i; + + n>>=3; + for (i = 0; i !=n; ++i) + { + in--; + ret += *hp++ * (*in * *in); + in--; + ret += *hp++ * (*in * *in); + in--; + ret += *hp++ * (*in * *in); + in--; + ret += *hp++ * (*in * *in); + in--; + ret += *hp++ * (*in * *in); + in--; + ret += *hp++ * (*in * *in); + in--; + ret += *hp++ * (*in * *in); + in--; + ret += *hp++ * (*in * *in); + } + + return ret; + }
Index: d_ctl.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/d_ctl.c,v retrieving revision 1.3.4.4 retrieving revision 1.3.4.5 diff -C2 -d -r1.3.4.4 -r1.3.4.5 *** d_ctl.c 8 Jan 2005 19:43:51 -0000 1.3.4.4 --- d_ctl.c 8 Jan 2005 22:13:40 -0000 1.3.4.5 *************** *** 653,658 **** float x_sumbuf[MAXOVERLAP]; /* summing buffer */ float x_f; - float *x_tmpbuf; /* tb: temporary buffer for simd */ - int x_blocksize; /* tb: only for freealignedbytes */ } t_sigenv;
--- 653,656 ---- *************** *** 689,694 **** x->x_outlet = outlet_new(&x->x_obj, gensym("float")); x->x_f = 0; - x->x_blocksize = 64; - x->x_tmpbuf = getalignedbytes(x->x_blocksize * sizeof(float)); return (x); } --- 687,690 ---- *************** *** 734,757 ****
/* tb: loop unrolling and simd */ ! float sumvec_8(t_float* in, t_int n) ! { ! int i; ! float result = 0; ! ! n>>=3; ! for (i = 0; i != n; ++i) ! { ! result += *in++; ! result += *in++; ! result += *in++; ! result += *in++; ! result += *in++; ! result += *in++; ! result += *in++; ! result += *in++; ! } ! return result; ! } !
static t_int *env_tilde_perf8(t_int *w) --- 730,734 ----
/* tb: loop unrolling and simd */ ! float env_tilde_accum(t_float* in, t_float* hp, t_int n);
static t_int *env_tilde_perf8(t_int *w) *************** *** 762,788 **** int count; float *sump; for (count = x->x_phase, sump = x->x_sumbuf; count < x->x_npoints; count += x->x_realperiod, sump++) { float *hp = x->x_buf + count; - float *fp = in; - float sum = *sump; - float *tmp = x->x_tmpbuf; - int i; - t_int sqrargs[4]; - t_int timesargs[5]; ! sqrargs[1] = (t_int)in; ! sqrargs[2] = (t_int)tmp; ! sqrargs[3] = (t_int) n; ! timesargs[1] = (t_int)tmp; ! timesargs[2] = (t_int)hp; ! timesargs[3] = (t_int)tmp; ! timesargs[4] = (t_int)n; ! ! sqr_perf8(sqrargs); ! times_perf8(timesargs); ! ! *sump += sumvec_8(tmp,n); } sump[0] = 0; --- 739,749 ---- int count; float *sump; + in += n; for (count = x->x_phase, sump = x->x_sumbuf; count < x->x_npoints; count += x->x_realperiod, sump++) { float *hp = x->x_buf + count; ! *sump += env_tilde_accum(in, hp, n); } sump[0] = 0; *************** *** 808,834 **** int count; float *sump; for (count = x->x_phase, sump = x->x_sumbuf; count < x->x_npoints; count += x->x_realperiod, sump++) { float *hp = x->x_buf + count; - float *fp = in; - float sum = *sump; - float *tmp = x->x_tmpbuf; - int i; - t_int sqrargs[4]; - t_int timesargs[5]; - - sqrargs[1] = (t_int)in; - sqrargs[2] = (t_int)tmp; - sqrargs[3] = (t_int) n; - timesargs[1] = (t_int)tmp; - timesargs[2] = (t_int)hp; - timesargs[3] = (t_int)tmp; - timesargs[4] = (t_int)n;
! sqr_perf_simd(sqrargs); ! times_perf_simd(timesargs); ! ! *sump += sumvec_simd(tmp,n); } sump[0] = 0; --- 769,779 ---- int count; float *sump; + in += n; for (count = x->x_phase, sump = x->x_sumbuf; count < x->x_npoints; count += x->x_realperiod, sump++) { float *hp = x->x_buf + count;
! *sump += env_tilde_accum_simd(in, hp, n); } sump[0] = 0; *************** *** 863,868 ****
if (sp[0]->s_n > MAXVSTAKEN) bug("env_tilde_dsp"); - - x->x_blocksize = sp[0]->s_n; }
--- 808,811 ----
Index: m_simd_sse_vc.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_sse_vc.h,v retrieving revision 1.1.4.4 retrieving revision 1.1.4.5 diff -C2 -d -r1.1.4.4 -r1.1.4.5 *** m_simd_sse_vc.h 8 Jan 2005 19:43:52 -0000 1.1.4.4 --- m_simd_sse_vc.h 8 Jan 2005 22:13:40 -0000 1.1.4.5 *************** *** 42,45 **** --- 42,46 ----
#define sum_vecsimd sumvec_8 + #define env_tilde_accum_simd env_tilde_accum #define sigwrap_perf_simd sigwrap_perform /* SIMD not implemented */
Index: m_simd_sse_gcc.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_sse_gcc.c,v retrieving revision 1.1.4.8 retrieving revision 1.1.4.9 diff -C2 -d -r1.1.4.8 -r1.1.4.9 *** m_simd_sse_gcc.c 8 Jan 2005 19:43:52 -0000 1.1.4.8 --- m_simd_sse_gcc.c 8 Jan 2005 22:13:40 -0000 1.1.4.9 *************** *** 815,819 **** float sumvec_simd(t_float* in, t_int n) { ! float ret = 0; asm( ".set T_FLOAT,4 \n" --- 815,819 ---- float sumvec_simd(t_float* in, t_int n) { ! float ret; asm( ".set T_FLOAT,4 \n" *************** *** 859,862 **** --- 859,929 ----
+ float env_tilde_accum_simd(t_float* in, t_float* hp, t_int n) + { + float ret; + asm( + ".set T_FLOAT,4 \n" + + "shrl $4, %2 \n" /* divide by 16 */ + "xorps %%xmm2, %%xmm2 \n" /* zero values */ + "xorps %%xmm3, %%xmm3 \n" + "xorps %%xmm4, %%xmm4 \n" + "xorps %0, %0 \n" + + "1: \n" + "movaps -4*T_FLOAT(%1), %%xmm0 \n" + "movhlps %%xmm0, %%xmm1 \n" /* reversing xmm0 CHECK!!!*/ + "shufps $68, %%xmm1, %%xmm0 \n" + "movaps (%3), %%xmm1 \n" + "mulps %%xmm0, %%xmm0 \n" + "mulps %%xmm1, %%xmm0 \n" + "addps %%xmm0, %%xmm2 \n" + + "movaps -8*T_FLOAT(%1), %%xmm0 \n" + "movhlps %%xmm0, %%xmm1 \n" /* reversing xmm0 */ + "shufps $68, %%xmm1, %%xmm0 \n" + "movaps 4*T_FLOAT(%3), %%xmm1 \n" + "mulps %%xmm0, %%xmm0 \n" + "mulps %%xmm1, %%xmm0 \n" + "addps %%xmm0, %%xmm2 \n" + + "movaps -12*T_FLOAT(%1), %%xmm0 \n" + "movhlps %%xmm0, %%xmm1 \n" /* reversing xmm0 */ + "shufps $68, %%xmm1, %%xmm0 \n" + "movaps 8*T_FLOAT(%3), %%xmm1 \n" + "mulps %%xmm0, %%xmm0 \n" + "mulps %%xmm1, %%xmm0 \n" + "addps %%xmm0, %%xmm2 \n" + + "movaps -16*T_FLOAT(%1), %%xmm0 \n" + "movhlps %%xmm0, %%xmm1 \n" /* reversing xmm0 */ + "shufps $68, %%xmm1, %%xmm0 \n" + "movaps 12*T_FLOAT(%3), %%xmm1 \n" + "mulps %%xmm0, %%xmm0 \n" + "mulps %%xmm1, %%xmm0 \n" + "addps %%xmm0, %%xmm2 \n" + + "addl $-16*T_FLOAT,%1 \n" + "addl $16*T_FLOAT,%3 \n" + "loop 1b \n" + + "movhlps %%xmm2, %%xmm3 \n" + "movups %%xmm2, %%xmm4 \n" + "movups %%xmm3, %0 \n" + "shufps $81, %%xmm4, %%xmm4 \n" + "shufps $81, %0, %0 \n" + + "addss %%xmm2, %%xmm3 \n" + "addss %%xmm3, %%xmm4 \n" + "addss %%xmm4, %0 \n" + + + :"=x"(ret) + :"r"(in),"c"(n), "r"(hp) + :"%xmm0","%xmm1","%xmm2","%xmm3", "%xmm4", "%xmm5"); + return ret; + } + + #endif
Index: m_simd_sse_gcc.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_sse_gcc.h,v retrieving revision 1.1.4.4 retrieving revision 1.1.4.5 diff -C2 -d -r1.1.4.4 -r1.1.4.5 *** m_simd_sse_gcc.h 8 Jan 2005 19:43:52 -0000 1.1.4.4 --- m_simd_sse_gcc.h 8 Jan 2005 22:13:40 -0000 1.1.4.5 *************** *** 19,22 **** --- 19,23 ---- /* functions in d_ctl.c */ t_int *sig_tilde_perf_simd(t_int *w); + float env_tilde_accum_simd(t_float* in, t_float* hp, t_int n);
/* functions in d_arithmetic.c */
Index: m_simd_ve_gcc.h =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_ve_gcc.h,v retrieving revision 1.1.4.2 retrieving revision 1.1.4.3 diff -C2 -d -r1.1.4.2 -r1.1.4.3 *** m_simd_ve_gcc.h 8 Jan 2005 19:43:52 -0000 1.1.4.2 --- m_simd_ve_gcc.h 8 Jan 2005 22:13:40 -0000 1.1.4.3 *************** *** 41,44 **** --- 41,45 ---- t_int *sigrsqrt_perf_simd(t_int *w);
+ #define env_tilde_accum_simdc env_tilde_accum #define sum_vecsimd sumvec_8 /* SIMD not implemented */