Update of /cvsroot/pure-data/externals/grill/flext/source
In directory sc8-pr-cvs1:/tmp/cvs-serv12950/source
Modified Files:
flcwpd-x-thr.h flcwpd-x.h flsimd.cpp
Log Message:
""
Index: flcwpd-x-thr.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flcwpd-x-thr.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** flcwpd-x-thr.h 28 Dec 2003 03:37:26 -0000 1.2
--- flcwpd-x-thr.h 30 Dec 2003 03:32:46 -0000 1.3
***************
*** 1 ****
! /*
flext - C++ layer for Max/MSP and pd (pure data) externals
Copyright (c) 2001-2003 Thomas Grill (xovo(a)gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
*/
/* This is the prefix file for CodeWarrior projects - OS X version */
#ifndef _FLEXT_CW_PD_X_THR_H
#define _FLEXT_CW_PD_X_THR_H
#define FLEXT_THREADS
#if 0
/*
old CodeWarrior version (<= 6) don't have sigset_t defined which
is needed for pthreads
*/
#if defined(__MWERKS__) && (__MWERKS__ <= 0x6000)
typedef unsigned int sigset_t;
#define _CW_NOPRECOMP // no precompiled headers
#endif
#endif
#include "flcwpd-x.h"
#endif
\ No newline at end of file
--- 1,31 ----
! /*
!
! flext - C++ layer for Max/MSP and pd (pure data) externals
!
! Copyright (c) 2001-2003 Thomas Grill (xovo(a)gmx.net)
! For information on usage and redistribution, and for a DISCLAIMER OF ALL
! WARRANTIES, see the file, "license.txt," in this distribution.
!
! */
!
! /* This is the prefix file for CodeWarrior projects - OS X version */
!
! #ifndef _FLEXT_CW_PD_X_THR_H
! #define _FLEXT_CW_PD_X_THR_H
!
! #define FLEXT_THREADS
!
! #if 0
! /*
! old CodeWarrior version (<= 6) don't have sigset_t defined which
! is needed for pthreads
! */
! #if defined(__MWERKS__) && (__MWERKS__ <= 0x6000)
! typedef unsigned int sigset_t;
! #define _CW_NOPRECOMP // no precompiled headers
! #endif
! #endif
!
! #include "flcwpd-x.h"
!
! #endif
Index: flcwpd-x.h
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flcwpd-x.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** flcwpd-x.h 28 Dec 2003 03:37:26 -0000 1.3
--- flcwpd-x.h 30 Dec 2003 03:32:46 -0000 1.4
***************
*** 1 ****
! /*
flext - C++ layer for Max/MSP and pd (pure data) externals
Copyright (c) 2001-2003 Thomas Grill (xovo(a)gmx.net)
For information on usage and redistribution, and for a DISCLAIMER OF ALL
WARRANTIES, see the file, "license.txt," in this distribution.
*/
/* This is the prefix file for CodeWarrior projects - OS X version */
#ifndef _FLEXT_CW_PD_X_H
#define _FLEXT_CW_PD_X_H
#ifndef __MWERKS__
#error "This header file is for CodeWarrior only."
#endif
#define FLEXT_SYS 2
#define FLEXT_USE_SIMD
#define TARGET_API_MAC_CARBON 1
#define _POSIX_C_SOURCE
#ifndef _CW_NOPRECOMP
// #include <MacHeadersMach-O.h>
// #include <MSL MacHeadersMach-O.h>
#endif
#if __option(sym) || !__option(opt_dead_code)
#define FLEXT_DEBUG
#endif
/* #define _LOG */
#endif
\ No newline at end of file
--- 1,37 ----
! /*
!
! flext - C++ layer for Max/MSP and pd (pure data) externals
!
! Copyright (c) 2001-2003 Thomas Grill (xovo(a)gmx.net)
! For information on usage and redistribution, and for a DISCLAIMER OF ALL
! WARRANTIES, see the file, "license.txt," in this distribution.
!
! */
!
! /* This is the prefix file for CodeWarrior projects - OS X version */
!
! #ifndef _FLEXT_CW_PD_X_H
! #define _FLEXT_CW_PD_X_H
!
! #ifndef __MWERKS__
! #error "This header file is for CodeWarrior only."
! #endif
!
! #define FLEXT_SYS 2
! #define FLEXT_USE_SIMD
!
! #define TARGET_API_MAC_CARBON 1
! #define _POSIX_C_SOURCE
!
! #ifndef _CW_NOPRECOMP
! // #include <MacHeadersMach-O.h>
! // #include <MSL MacHeadersMach-O.h>
! #endif
!
! #if __option(sym) || !__option(opt_dead_code)
! #define FLEXT_DEBUG
! #endif
!
! /* #define _LOG */
!
! #endif
Index: flsimd.cpp
===================================================================
RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsimd.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** flsimd.cpp 22 Jul 2003 02:32:51 -0000 1.10
--- flsimd.cpp 30 Dec 2003 03:32:46 -0000 1.11
***************
*** 38,44 ****
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__MWERKS__) && defined(__ALTIVEC__)
#if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH
! #include <sys/sysctl.h>
#else
! #include <Gestalt.h>
#endif
--- 38,45 ----
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__MWERKS__) && defined(__ALTIVEC__)
#if FLEXT_OSAPI == FLEXT_OSAPI_MAC_MACH
! #include <sys/sysctl.h>
! #include <vDSP.h>
#else
! #include <Gestalt.h>
#endif
***************
*** 46,55 ****
#include <altivec.h>
- // #include <vBasicOps.h>
#include <vectorOps.h>
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__GNUG__) && defined(__ALTIVEC__)
#include <sys/sysctl.h>
! // #include <vecLib/vBasicOps.h>
! #include <vecLib/vectorOps.h>
#endif
--- 47,54 ----
#include <altivec.h>
#include <vectorOps.h>
#elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__GNUG__) && defined(__ALTIVEC__)
#include <sys/sysctl.h>
! #include <vecLib/vecLib.h>
#endif
***************
*** 335,339 ****
}
! inline vector float LoadUnaligned(float *v )
{
return (vector float)LoadUnaligned((vector unsigned char *)v);
--- 334,338 ----
}
! inline vector float LoadUnaligned(const float *v )
{
return (vector float)LoadUnaligned((vector unsigned char *)v);
***************
*** 349,352 ****
--- 348,356 ----
return reinterpret_cast<unsigned long>(where)&(sizeof(vector float)-1) == 0;
}
+
+ inline vector float LoadValue(const float &f)
+ {
+ return IsVectorAligned(&f)?vec_splat(vec_ld(0,(vector float *)&f),0):LoadUnaligned(&f);
+ }
#endif
***************
*** 480,491 ****
}
else
! #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__) && defined(__VECTOROPS__)
! {
int n = cnt>>2,n4 = n<<2;
- cnt -= n4;
vScopy(n4,(vector float *)src,(vector float *)dst);
! src += n4,dst += n4;
while(cnt--) *(dst++) = *(src++);
}
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
--- 484,495 ----
}
else
! #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VECTOROPS__)
! if(true) {
int n = cnt>>2,n4 = n<<2;
vScopy(n4,(vector float *)src,(vector float *)dst);
! cnt -= n4,src += n4,dst += n4;
while(cnt--) *(dst++) = *(src++);
}
+ else
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
***************
*** 559,567 ****
}
else
! #elif 0 //FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(dst)) {
! vector float svec = IsVectorAligned(&s)?vec_splat(vec_ld(0,(vector float *)&s),0):LoadUnaligned(&s);
! int n = cnt>>4,n4 = n<<4;
! cnt -= n4;
while(n--) {
--- 563,571 ----
}
else
! #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(dst)) {
! vector float svec = LoadValue(s);
! int n = cnt>>4;
! cnt -= n<<4;
while(n--) {
***************
*** 570,574 ****
vec_st(svec,32,dst);
vec_st(svec,48,dst);
! dst += 64;
}
--- 574,578 ----
vec_st(svec,32,dst);
vec_st(svec,48,dst);
! dst += 16;
}
***************
*** 689,705 ****
}
else
! #elif 0 //FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(dst)) {
! vector float opvec = IsVectorAligned(&op)?vec_splat(vec_ld(0,(vector float *)&op),0):LoadUnaligned(&op);
! vector float addvec = (vector float)vec_splat_u32(0);
! int n = cnt>>4,n4 = n<<4;
! cnt -= n4;
! while(n--) {
! vec_st(vec_madd(vec_ld( 0,src),opvec,addvec), 0,dst);
! vec_st(vec_madd(vec_ld(16,src),opvec,addvec),16,dst);
! vec_st(vec_madd(vec_ld(32,src),opvec,addvec),32,dst);
! vec_st(vec_madd(vec_ld(48,src),opvec,addvec),48,dst);
! src += 64,dst += 64;
}
--- 693,723 ----
}
else
! #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VDSP__)
! if(true) {
! vsmul(src,1,&op,dst,1,cnt);
! }
! else
! #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(dst)) {
! const vector float arg = LoadValue(op);
! const vector float zero = (vector float)(0);
! int n = cnt>>4;
! cnt -= n<<4;
! for(; n--; src += 16,dst += 16) {
! vector float a1 = vec_ld( 0,src);
! vector float a2 = vec_ld(16,src);
! vector float a3 = vec_ld(32,src);
! vector float a4 = vec_ld(48,src);
!
! a1 = vec_madd(a1,arg,zero);
! a2 = vec_madd(a2,arg,zero);
! a3 = vec_madd(a3,arg,zero);
! a4 = vec_madd(a4,arg,zero);
!
! vec_st(a1, 0,dst);
! vec_st(a2,16,dst);
! vec_st(a3,32,dst);
! vec_st(a4,48,dst);
}
***************
*** 925,930 ****
}
else
! #elif 0 // FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
! if(GetSIMDCapabilities()&simd_sse) {
}
else
--- 943,974 ----
}
else
! #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VDSP__)
! if(true) {
! vmul(src,1,op,1,dst,1,cnt);
! }
! else
! #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
! if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(op) && IsVectorAligned(dst)) {
! const vector float zero = (vector float)(0);
! int n = cnt>>4;
! cnt -= n<<4;
!
! for(; n--; src += 16,op += 16,dst += 16) {
! vector float a1 = vec_ld( 0,src),b1 = vec_ld( 0,op);
! vector float a2 = vec_ld(16,src),b2 = vec_ld(16,op);
! vector float a3 = vec_ld(32,src),b3 = vec_ld(32,op);
! vector float a4 = vec_ld(48,src),b4 = vec_ld(48,op);
!
! a1 = vec_madd(a1,b1,zero);
! a2 = vec_madd(a2,b2,zero);
! a3 = vec_madd(a3,b3,zero);
! a4 = vec_madd(a4,b4,zero);
!
! vec_st(a1, 0,dst);
! vec_st(a2,16,dst);
! vec_st(a3,32,dst);
! vec_st(a4,48,dst);
! }
! while(cnt--) *(dst++) = *(src++) * *(op++);
}
else
***************
*** 1055,1060 ****
}
else
! #elif 0 //FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
! if(GetSIMDCapabilities()&simd_altivec) {
}
else
--- 1099,1126 ----
}
else
! #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
! if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(dst)) {
! const vector float arg = LoadValue(op);
! int n = cnt>>4;
! cnt -= n<<4;
!
! for(; n--; src += 16,dst += 16) {
! vector float a1 = vec_ld( 0,src);
! vector float a2 = vec_ld(16,src);
! vector float a3 = vec_ld(32,src);
! vector float a4 = vec_ld(48,src);
!
! a1 = vec_add(a1,arg);
! a2 = vec_add(a2,arg);
! a3 = vec_add(a3,arg);
! a4 = vec_add(a4,arg);
!
! vec_st(a1, 0,dst);
! vec_st(a2,16,dst);
! vec_st(a3,32,dst);
! vec_st(a4,48,dst);
! }
!
! while(cnt--) *(dst++) = *(src++)+op;
}
else
***************
*** 1278,1284 ****
}
else
! #elif 0 //FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
! {
}
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
--- 1344,1376 ----
}
else
! #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__VDSP__)
! if(true) {
! vadd(src,1,op,1,dst,1,cnt);
}
+ else
+ #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
+ if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(op) && IsVectorAligned(dst)) {
+ int n = cnt>>4;
+ cnt -= n<<4;
+
+ for(; n--; src += 16,op += 16,dst += 16) {
+ vector float a1 = vec_ld( 0,src),b1 = vec_ld( 0,op);
+ vector float a2 = vec_ld(16,src),b2 = vec_ld(16,op);
+ vector float a3 = vec_ld(32,src),b3 = vec_ld(32,op);
+ vector float a4 = vec_ld(48,src),b4 = vec_ld(48,op);
+
+ a1 = vec_add(a1,b1);
+ a2 = vec_add(a2,b2);
+ a3 = vec_add(a3,b3);
+ a4 = vec_add(a4,b4);
+
+ vec_st(a1, 0,dst);
+ vec_st(a2,16,dst);
+ vec_st(a3,32,dst);
+ vec_st(a4,48,dst);
+ }
+ while(cnt--) *(dst++) = *(src++) + *(op++);
+ }
+ else
#endif // _MSC_VER
#endif // FLEXT_USE_SIMD
***************
*** 1419,1424 ****
}
else
! #elif 0 //FLEXT_CPU == FLEXT_CPU_PPC && defined(__VEC__)
! if(GetSIMDCapabilities()&simd_altivec) {
}
else
--- 1511,1539 ----
}
else
! #elif FLEXT_CPU == FLEXT_CPU_PPC && defined(__ALTIVEC__)
! if(GetSIMDCapabilities()&simd_altivec && IsVectorAligned(src) && IsVectorAligned(dst)) {
! const vector float argmul = LoadValue(opmul);
! const vector float argadd = LoadValue(opadd);
! int n = cnt>>4;
! cnt -= n<<4;
!
! for(; n--; src += 16,dst += 16) {
! vector float a1 = vec_ld( 0,src);
! vector float a2 = vec_ld(16,src);
! vector float a3 = vec_ld(32,src);
! vector float a4 = vec_ld(48,src);
!
! a1 = vec_madd(a1,argmul,argadd);
! a2 = vec_madd(a2,argmul,argadd);
! a3 = vec_madd(a3,argmul,argadd);
! a4 = vec_madd(a4,argmul,argadd);
!
! vec_st(a1, 0,dst);
! vec_st(a2,16,dst);
! vec_st(a3,32,dst);
! vec_st(a4,48,dst);
! }
!
! while(cnt--) *(dst++) = *(src++)*opmul+opadd;
}
else