aboutsummaryrefslogtreecommitdiff
path: root/src/vectors-8-SSE2.h
diff options
context:
space:
mode:
authorsvn_bwardell <svn_bwardell@105869f7-3296-0410-a4ea-f4349344b45a>2011-08-07 12:41:50 +0000
committersvn_bwardell <svn_bwardell@105869f7-3296-0410-a4ea-f4349344b45a>2011-08-07 12:41:50 +0000
commit96caf45931a90c080adc8073762d72aa2a80ac76 (patch)
tree48ccb4894a0bdd3dbf62826e8c0e05641d1f4236 /src/vectors-8-SSE2.h
parent1d6878bcc13a1695043cb680f7ab83be28048419 (diff)
Fix definition of kifthen for architectures where blend instructions are not available.
git-svn-id: https://svn.cct.lsu.edu/repos/numrel/LSUThorns/Vectors/trunk@20 105869f7-3296-0410-a4ea-f4349344b45a
Diffstat (limited to 'src/vectors-8-SSE2.h')
-rw-r--r--src/vectors-8-SSE2.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/vectors-8-SSE2.h b/src/vectors-8-SSE2.h
index 15a45ed..3bd5753 100644
--- a/src/vectors-8-SSE2.h
+++ b/src/vectors-8-SSE2.h
@@ -225,6 +225,12 @@ static const union {
r; \
})
#else
+#include <math.h>
+#ifdef __cplusplus
+#define SGN(x) std::signbit(x)
+#else
+#define SGN(x) signbit(x)
+#endif
# define k8ifthen(x_,y_,z_) \
({ \
CCTK_REAL8_VEC const xx=(x_); \
@@ -233,8 +239,7 @@ static const union {
CCTK_REAL8_VEC const y=yy; \
CCTK_REAL8_VEC const zz=(z_); \
CCTK_REAL8_VEC const z=zz; \
- CCTK_REAL8_VEC const c = _mm_and_pd(x,k8sign_mask); \
- vec8_set(vec8_elt0(not vec8_elt0(c) ? y : z), \
- vec8_elt1(not vec8_elt1(c) ? y : z)); \
+ vec8_set(SGN(vec8_elt0(x)) ? vec8_elt0(z) : vec8_elt0(y), \
+ SGN(vec8_elt1(x)) ? vec8_elt1(z) : vec8_elt1(y)); \
})
#endif