[PD-cvs] pd/src d_global.c,1.1.1.2.8.3,1.1.1.2.8.4

Tim Blechmann timblech at users.sourceforge.net
Fri Sep 3 09:51:29 CEST 2004


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv916

Modified Files:
      Tag: devel_0_37
	d_global.c 
Log Message:
loop unrolling for catch~, receive~


Index: d_global.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_global.c,v
retrieving revision 1.1.1.2.8.3
retrieving revision 1.1.1.2.8.4
diff -C2 -d -r1.1.1.2.8.3 -r1.1.1.2.8.4
*** d_global.c	23 Jul 2004 08:46:40 -0000	1.1.1.2.8.3
--- d_global.c	3 Sep 2004 07:51:27 -0000	1.1.1.2.8.4
***************
*** 41,45 ****
      while (n--)
      {
!     	*out = (PD_BIGORSMALL(*in) ? 0 : *in);
  	out++;
  	in++;
--- 41,45 ----
      while (n--)
      {
! 	*out = (PD_BIGORSMALL(*in) ? 0 : *in);
  	out++;
  	in++;
***************
*** 110,113 ****
--- 110,139 ----
  }
  
+ /* tb: vectorized receive function */
+ static t_int *sigreceive_perf8(t_int *w)
+ {
+     t_sigreceive *x = (t_sigreceive *)(w[1]);
+     t_float *out = (t_float *)(w[2]);
+     int n = (int)(w[3]);
+     t_float *in = x->x_wherefrom;
+     if (in)
+     {
+ 	for (; n; n -= 8, in += 8, out += 8)
+ 	{
+ 	    out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; out[3] = in[3]; 
+ 	    out[4] = in[4]; out[5] = in[5]; out[6] = in[6]; out[7] = in[7]; 
+ 	}
+     }
+     else
+     {
+ 	for (; n; n -= 8, in += 8, out += 8)
+ 	{
+ 	    out[0] = 0; out[1] = 0; out[2] = 0; out[3] = 0; 
+ 	    out[4] = 0; out[5] = 0; out[6] = 0; out[7] = 0; 
+ 	}
+     }
+     return (w+4);
+ }
+ 
  static void sigreceive_set(t_sigreceive *x, t_symbol *s)
  {
***************
*** 140,145 ****
      {
      	sigreceive_set(x, x->x_sym);
!     	dsp_add(sigreceive_perform, 3,
!     	    x, sp[0]->s_vec, sp[0]->s_n);
      }
  }
--- 166,175 ----
      {
      	sigreceive_set(x, x->x_sym);
! 	if(sp[0]->s_n&7)
! 	    dsp_add(sigreceive_perform, 3,
! 		    x, sp[0]->s_vec, sp[0]->s_n);
! 	else
! 	    dsp_add(sigreceive_perf8, 3,
! 		    x, sp[0]->s_vec, sp[0]->s_n);
      }
  }
***************
*** 190,197 ****
  }
  
  static void sigcatch_dsp(t_sigcatch *x, t_signal **sp)
  {
      if (x->x_n == sp[0]->s_n)
!     	dsp_add(sigcatch_perform, 3, x->x_vec, sp[0]->s_vec, sp[0]->s_n);
      else error("sigcatch %s: unexpected vector size", x->x_sym->s_name);
  }
--- 220,249 ----
  }
  
+ /* tb: vectorized catch function */
+ static t_int *sigcatch_perf8(t_int *w)
+ {
+     t_float *in = (t_float *)(w[1]);
+     t_float *out = (t_float *)(w[2]);
+     int n = (int)(w[3]);
+     for (; n; n -= 8, in += 8, out += 8)
+     {
+ 	out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; out[3] = in[3]; 
+ 	out[4] = in[4]; out[5] = in[5]; out[6] = in[6]; out[7] = in[7]; 
+     
+ 	in[0] = 0; in[1] = 0; in[2] = 0; in[3] = 0; 
+ 	in[4] = 0; in[5] = 0; in[6] = 0; in[7] = 0; 
+     }
+     return (w+4);
+ }
+ 
  static void sigcatch_dsp(t_sigcatch *x, t_signal **sp)
  {
      if (x->x_n == sp[0]->s_n)
!     {
!     	if(sp[0]->s_n&7)
! 	dsp_add(sigcatch_perform, 3, x->x_vec, sp[0]->s_vec, sp[0]->s_n);
! 	else
! 	dsp_add(sigcatch_perf8, 3, x->x_vec, sp[0]->s_vec, sp[0]->s_n);
!     }
      else error("sigcatch %s: unexpected vector size", x->x_sym->s_name);
  }





More information about the Pd-cvs mailing list