Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26704
Modified Files: Tag: devel_0_38 d_delay.c Log Message: simd optimized delwrite~
Index: d_delay.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/d_delay.c,v retrieving revision 1.2.4.2 retrieving revision 1.2.4.3 diff -C2 -d -r1.2.4.2 -r1.2.4.3 *** d_delay.c 7 Jan 2005 12:22:58 -0000 1.2.4.2 --- d_delay.c 7 Jan 2005 15:14:36 -0000 1.2.4.3 *************** *** 8,11 **** --- 8,12 ----
#include "m_simd.h" + #define DEL_SIMD
extern int ugen_getsortno(void); *************** *** 67,70 **** --- 68,74 ---- nsamps += ((- nsamps) & (SAMPBLK - 1)); nsamps += DEFDELVS; + #ifdef DEL_SIMD + nsamps += (SIMD_BYTEALIGN - nsamps) % SIMD_BYTEALIGN; + #endif x->x_cspace.c_n = nsamps; x->x_cspace.c_vec = *************** *** 106,114 ****
static void sigdelwrite_dsp(t_sigdelwrite *x, t_signal **sp) { dsp_add(sigdelwrite_perform, 3, sp[0]->s_vec, &x->x_cspace, sp[0]->s_n); !
x->x_sortno = ugen_getsortno(); --- 110,189 ----
+ static t_int *sigdelwrite_perf8(t_int *w) + { + t_float *in = (t_float *)(w[1]); + t_delwritectl *c = (t_delwritectl *)(w[2]); + int n = (int)(w[3]); + int phase = c->c_phase, nsamps = c->c_n; + float *vp = c->c_vec, *bp = vp + phase, *ep = vp + (c->c_n + XTRASAMPS); + phase += n; + if (phase > nsamps ) + while (n--) + { + float f = *in++; + if (PD_BIGORSMALL(f)) + f = 0; + *bp++ = f; + if (bp == ep) + { + vp[0] = ep[-4]; + vp[1] = ep[-3]; + vp[2] = ep[-2]; + vp[3] = ep[-1]; + bp = vp + XTRASAMPS; + phase -= nsamps; + } + } + else + copyvec_8(bp, in, n); + c->c_phase = phase; + return (w+4); + } + + static t_int *sigdelwrite_perfsimd(t_int *w) + { + t_float *in = (t_float *)(w[1]); + t_delwritectl *c = (t_delwritectl *)(w[2]); + int n = (int)(w[3]); + int phase = c->c_phase, nsamps = c->c_n; + float *vp = c->c_vec, *bp = vp + phase, *ep = vp + (c->c_n + XTRASAMPS); + phase += n; + if (phase > nsamps ) + while (n--) + { + float f = *in++; + if (PD_BIGORSMALL(f)) + f = 0; + *bp++ = f; + if (bp == ep) + { + vp[0] = ep[-4]; + vp[1] = ep[-3]; + vp[2] = ep[-2]; + vp[3] = ep[-1]; + bp = vp + XTRASAMPS; + phase -= nsamps; + } + } + else + copyvec_simd(bp, in, n); + c->c_phase = phase; + return (w+4); + } +
static void sigdelwrite_dsp(t_sigdelwrite *x, t_signal **sp) { + #ifdef DEL_SIMD + if (sp[0]->s_n & 7) + dsp_add(sigdelwrite_perform, 3, sp[0]->s_vec, &x->x_cspace, sp[0]->s_n); + else + if (SIMD_CHECK1(sp[0]->s_n, sp[0]->s_vec)) + dsp_add(sigdelwrite_perfsimd, 3, sp[0]->s_vec, &x->x_cspace, sp[0]->s_n); + else + dsp_add(sigdelwrite_perf8, 3, sp[0]->s_vec, &x->x_cspace, sp[0]->s_n); + #else dsp_add(sigdelwrite_perform, 3, sp[0]->s_vec, &x->x_cspace, sp[0]->s_n); ! #endif
x->x_sortno = ugen_getsortno(); *************** *** 176,180 **** x->x_delsamps = delwriter->x_cspace.c_n - DEFDELVS; } ! x->x_delsamps += (16 - x->x_delsamps) % 16; }
--- 251,257 ---- x->x_delsamps = delwriter->x_cspace.c_n - DEFDELVS; } ! #ifdef DEL_SIMD ! x->x_delsamps += (SIMD_BYTEALIGN - x->x_delsamps) % SIMD_BYTEALIGN; ! #endif }
*************** *** 198,202 **** }
- #include "assert.h" static t_int *sigdelread_perf8(t_int *w) { --- 275,278 ---- *************** *** 242,246 **** else { - assert( SIMD_CHKALIGN (bp) != 0 ); /* tb: are we sure to have aligned pointers??? */ copyvec_simd(out, bp, n); } --- 318,321 ---- *************** *** 260,263 **** --- 335,339 ---- 0 : delwriter->x_vecsize); sigdelread_float(x, x->x_deltime); + #ifdef DEL_SIMD if (sp[0]->s_n & 7) dsp_add(sigdelread_perform, 4, *************** *** 270,273 **** --- 346,353 ---- dsp_add(sigdelread_perf8, 4, sp[0]->s_vec, &delwriter->x_cspace, &x->x_delsamps, sp[0]->s_n); + #else + dsp_add(sigdelread_perform, 4, + sp[0]->s_vec, &delwriter->x_cspace, &x->x_delsamps, sp[0]->s_n); + #endif } else if (*x->x_sym->s_name)