diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2010-05-02 17:47:50 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2010-05-02 17:47:50 -0500 |
commit | 8e006230f24be02831d390eaad9b90b7a7c77d2c (patch) | |
tree | 64ca268c5a7083abfb36bf2b9dde53bd0d5eb769 /Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h | |
parent | 185f55f593a763a78497c31b8179290524ce88c1 (diff) |
Add support for vectorisation of generated code.
Vectorisation needs to be explicitly enabled by setting -DKRANC_VECTORS at build time.
Diffstat (limited to 'Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h')
-rw-r--r-- | Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h | 48 |
1 files changed, 15 insertions, 33 deletions
diff --git a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h index db74360..c9c9586 100644 --- a/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h +++ b/Auxiliary/Cactus/KrancNumericalTools/GenericFD/src/GenericFD.h @@ -27,7 +27,11 @@ along with Kranc; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - + +#ifdef __cplusplus +extern "C" { +#endif + #ifndef NOPRECOMPUTE #define PRECOMPUTE #endif @@ -673,6 +677,14 @@ int sgn(CCTK_REAL x); #define Dupwind3(gf,dir,i,j,k) ((dir * gf[CCTK_GFINDEX3D(cctkGH,i,j,k+dir)] \ - dir * gf[CCTK_GFINDEX3D(cctkGH,i,j,k)]) * dxi) +#ifdef __cplusplus +// Define the restrict qualifier +# ifdef CCTK_CXX_RESTRICT +# undef restrict +# define restrict CCTK_CXX_RESTRICT +# endif +#endif + void GenericFD_GetBoundaryInfo(cGH const * restrict cctkGH, int const * restrict cctk_lsh, int const * restrict cctk_lssh, @@ -788,38 +800,8 @@ void GenericFD_LoopOverInterior(cGH const * restrict cctkGH, Kranc_Calculation c -/* Vectorisation of memory accesses */ - -#include <stdlib.h> -#include <cctk.h> - -#if defined(__SSE2__) && defined(CCTK_REAL_PRECISION_8) - -#include <emmintrin.h> - -/* A vector type corresponding to CCTK_REAL */ -typedef __m128d CCTK_REAL_VEC; - -/* Really only SSE is required, but there doesn't seem to be a - preprocessing flag to check for this */ -#elif defined(__SSE2__) && defined(CCTK_REAL_PRECISION_4) - -#include <emmintrin.h> - -/* A vector type corresponding to CCTK_REAL */ -typedef __m128 CCTK_REAL_VEC; - -#else - -/* There is no vector type corresponding to CCTK_REAL */ -typedef CCTK_REAL CCTK_REAL_VEC; - +#ifdef __cplusplus +} /* extern "C" */ #endif -/* The number of vector elements in a CCTK_REAL_VEC */ -static -size_t const CCTK_REAL_VEC_SIZE = sizeof(CCTK_REAL_VEC) / sizeof(CCTK_REAL); - - - #endif |