Update of /cvsroot/pure-data/externals/tb/volctl~
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1607
Modified Files:
volctl~.c
Log Message:
simd code for msvc ...
Index: volctl~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/tb/volctl~/volctl~.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** volctl~.c 29 Apr 2005 16:29:40 -0000 1.5
--- volctl~.c 29 Apr 2005 19:04:37 -0000 1.6
***************
*** 178,189 ****
t_float *in = (t_float *)(w[2]);
t_float *out = (t_float *)(w[3]);
if (x->x_ticksleft)
! {
! int n = (int)(w[4]);
!
! x->x_ticksleft--;
!
! #if defined(__GNUC__) && (defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__) )
asm(
".set T_FLOAT,4 \n"
--- 178,186 ----
t_float *in = (t_float *)(w[2]);
t_float *out = (t_float *)(w[3]);
+ int n = (int)(w[4]);
if (x->x_ticksleft)
! {
! #if defined(__GNUC__) && (defined(_X86_) || defined(__i386__) || defined(__i586__) || defined(__i686__))
asm(
".set T_FLOAT,4 \n"
***************
*** 227,312 ****
"r"((t_float*)x->x_slopes), "r"(&(t_float)(x->x_slope_step))
:"%xmm0", "%xmm1", "%xmm2");
-
- x->x_value += n*(x->x_slope);
- }
- else
- {
- switch(x->x_target)
- {
- case 0:
- asm(
- ".set T_FLOAT,4 \n"
-
- "xorps %%xmm0, %%xmm0 \n"
- "shrl $4, %1 \n"
-
- "1: \n"
- "movaps %%xmm0, (%0) \n"
- "movaps %%xmm0, 4*T_FLOAT(%0) \n"
- "movaps %%xmm0, 8*T_FLOAT(%0) \n"
- "movaps %%xmm0, 12*T_FLOAT(%0) \n"
- "addl $16*T_FLOAT, %0 \n"
- "loop 1b \n"
- :
- :"r"(out),
- "c"(w[4])
- : "%xmm0");
- break;
! case 1:
! if (in != out)
! asm(
! ".set T_FLOAT,4 \n"
!
! "shrl $4, %1 \n"
! "1: \n"
! "movaps (%1), %%xmm0 \n"
! "movaps 4*T_FLOAT(%1), %%xmm1 \n"
! "movaps 8*T_FLOAT(%1), %%xmm2 \n"
! "movaps 12*T_FLOAT(%1), %%xmm3 \n"
! "movaps %%xmm0, (%2) \n"
! "movaps %%xmm1, 4*T_FLOAT(%2) \n"
! "movaps %%xmm2, 8*T_FLOAT(%2) \n"
! "movaps %%xmm3, 12*T_FLOAT(%2) \n"
!
! "addl $16*T_FLOAT,%1 \n"
! "addl $16*T_FLOAT,%2 \n"
! "loop 1b \n"
! :
! :"c"(w[4]),"r"(in),"r"(out)
! :"%xmm0","%xmm1","%xmm2","%xmm3");
! break;
! default:
! asm(
! ".set T_FLOAT,4 \n"
!
! "movss (%3), %%xmm0 \n"
! "shufps $0, %%xmm0, %%xmm0 \n"
! "shrl $4, %2 \n"
! "1: \n"
! "movaps (%0), %%xmm1 \n"
! "mulps %%xmm0, %%xmm1 \n"
! "movaps %%xmm1, (%1) \n"
! "movaps 4*T_FLOAT(%0), %%xmm2 \n"
! "mulps %%xmm0, %%xmm2 \n"
! "movaps %%xmm2, 4*T_FLOAT(%1) \n"
! "movaps 8*T_FLOAT(%0), %%xmm3 \n"
! "mulps %%xmm0, %%xmm3 \n"
! "movaps %%xmm3, 8*T_FLOAT(%1) \n"
! "movaps 12*T_FLOAT(%0), %%xmm4 \n"
! "mulps %%xmm0, %%xmm4 \n"
! "movaps %%xmm4, 12*T_FLOAT(%1) \n"
! "addl $16*T_FLOAT, %0 \n"
! "addl $16*T_FLOAT, %1 \n"
! "loop 1b \n"
! :
! : "r"(in), "r"(out),
! "c"(w[4]),"r"(&(t_float)(x->x_target))
! : "%xmm0", "%xmm1","%xmm2","%xmm3","%xmm4");
}
! }
return (w+5);
}
--- 224,320 ----
"r"((t_float*)x->x_slopes), "r"(&(t_float)(x->x_slope_step))
:"%xmm0", "%xmm1", "%xmm2");
! #elif defined(NT) && defined(_MSC_VER)
! __asm {
! mov ecx,n
! mov ebx,in
! mov edx,out
! movss xmm0,xmmword prt [x->x_value]
! shufps xmm0,xmm0,0
! movaps xmm1,xmmword prt [x->x_slopes]
! addps xmm1,xmm0
! movss xmm0,xmmword prt [x->x_slope_step]
! shufps xmm0,xmm0,0
! shr ecx,4
!
! loopa:
! movaps xmm2,xmmword ptr[ebx]
! mulps xmm2,xmm1
! movaps xmmword prt[edx],xmm2
! addps xmm1,xmm0
!
! movaps xmm2,xmmword ptr[ebx+4*TYPE t_float]
! mulps xmm2,xmm1
! movaps xmmword prt[edx+4*TYPE t_float],xmm2
! addps xmm1,xmm0
!
! movaps xmm2,xmmword ptr[ebx+8*TYPE t_float]
! mulps xmm2,xmm1
! movaps xmmword prt[edx+8*TYPE t_float],xmm2
! addps xmm1,xmm0
!
! movaps xmm2,xmmword ptr[ebx+12*TYPE t_float]
! mulps xmm2,xmm1
! movaps xmmword prt[edx+12*TYPE t_float],xmm2
! addps xmm1,xmm0
!
! add ebx,16*TYPE t_float
! add edx,16*TYPE t_float
! loop loopa
}
!
! #else /* not yet implemented ... */
! t_float f = x->x_value;
! t_float x_slope = x->x_slope;
!
! n = n>>3;
! while (n--)
! {
! *out++ = *in++ * f;
! f+=x_slope;
! *out++ = *in++ * f;
! f+=x_slope;
! *out++ = *in++ * f;
! f+=x_slope;
! *out++ = *in++ * f;
! f+=x_slope;
! *out++ = *in++ * f;
! f+=x_slope;
! *out++ = *in++ * f;
! f+=x_slope;
! *out++ = *in++ * f;
! f+=x_slope;
! *out++ = *in++ * f;
! f+=x_slope;
! }
! #endif
!
! x->x_ticksleft--;
! x->x_value += n*(x->x_slope);
! }
! else
! {
! if (x->x_target == 0.f)
! zerovec_simd(out, n);
! else
! if (x->x_target == 1.f)
! {
! if (in != out)
! copyvec_simd(out, in, n);
! }
! else
! {
! t_int args[6]={0,
! (t_int)in,
! (t_int)&x->x_target,
! (t_int)out,
! n,
! 0};
! scalartimes_perf_simd(args);
! }
! }
return (w+5);
}