summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <tpearson@raptorengineeringinc.com>2015-12-21 20:19:28 +0000
committerTimothy Pearson <tpearson@raptorengineeringinc.com>2015-12-21 21:57:32 +0000
commit8e8d284600c1b14bd8fdf659aa3ef0e16bc9a6d8 (patch)
tree79c5783562def5b5bdfa63527e37cd3dcb7ad472
parent477f9c85cf111e59a9042f230bb536d0765265fa (diff)
downloadvecmathlib-8e8d284600c1b14bd8fdf659aa3ef0e16bc9a6d8.zip
vecmathlib-8e8d284600c1b14bd8fdf659aa3ef0e16bc9a6d8.tar.gz
Initial fixes for POWER8 and GCC
-rw-r--r--floattypes.h2
-rw-r--r--vec_altivec_float4.h10
-rw-r--r--vec_pseudo.h4
-rw-r--r--vec_vsx_double2.h2
-rw-r--r--vecmathlib.h2
5 files changed, 12 insertions, 8 deletions
diff --git a/floattypes.h b/floattypes.h
index fa4cc44..a7c82ce 100644
--- a/floattypes.h
+++ b/floattypes.h
@@ -6,7 +6,7 @@
#include <cassert>
#include <cstdlib>
-#if !(defined __clang__ || defined __gcc__)
+#if !(defined __clang__ || defined __GNUC__ || defined __GNUG__)
#define __builtin_unreachable() (assert(0))
#define __builtin_expect(expr, val) (expr)
#endif
diff --git a/vec_altivec_float4.h b/vec_altivec_float4.h
index 55530b4..cf7e483 100644
--- a/vec_altivec_float4.h
+++ b/vec_altivec_float4.h
@@ -8,6 +8,7 @@
#include "vec_base.h"
#include <cmath>
+#include <endian.h>
// Altivec intrinsics
#include <altivec.h>
@@ -16,8 +17,7 @@
#define __vector vector
#define __pixel pixel
#define __bool bool
-#elif defined __gcc__
-#undef vector
+#elif defined __GNUC__ || defined __GNUG__
#undef pixel
#undef bool
#elif defined __xlC__
@@ -276,9 +276,13 @@ template <> struct realvec<float, 4> : floatprops<float> {
return vec_ld(0, p);
}
static realvec_t loadu(real_t const *p) {
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ return vec_vsx_ld(0, (real_t *)p);
+#else
realvec_t v0 = vec_ld(0, p);
realvec_t v1 = vec_ld(15, p);
- return vec_perm(v0.v, v1.v, vec_lvsl(0, p));
+ return vec_perm(v0.v, v1.v, p);
+#endif
}
static realvec_t loadu(real_t const *p, std::ptrdiff_t ioff) {
VML_ASSERT(intptr_t(p) % alignment == 0);
diff --git a/vec_pseudo.h b/vec_pseudo.h
index fa2895c..5901bb9 100644
--- a/vec_pseudo.h
+++ b/vec_pseudo.h
@@ -337,7 +337,7 @@ template <typename T, int N> struct intpseudovec : floatprops<T> {
intvec_t clz() const {
intvec_t res;
-#if defined __clang__ || defined __gcc__
+#if defined __clang__
for (int d = 0; d < size; ++d) {
if (v[d] == 0) {
res.v[d] = CHAR_BIT * sizeof v[d];
@@ -365,7 +365,7 @@ template <typename T, int N> struct intpseudovec : floatprops<T> {
}
intvec_t popcount() const {
intvec_t res;
-#if defined __clang__ || defined __gcc__
+#if defined __clang__ || defined __GNUC__ || defined __GNUG__
if (sizeof(int_t) == sizeof(long long)) {
for (int d = 0; d < size; ++d)
res.v[d] = __builtin_popcountll(v[d]);
diff --git a/vec_vsx_double2.h b/vec_vsx_double2.h
index fa43a6f..c9db42c 100644
--- a/vec_vsx_double2.h
+++ b/vec_vsx_double2.h
@@ -16,7 +16,7 @@
#define __vector vector
#define __pixel pixel
#define __bool bool
-#elif defined __gcc__
+#elif defined __GNUC__ || defined __GNUG__
#undef vector
#undef pixel
#undef bool
diff --git a/vecmathlib.h b/vecmathlib.h
index 5fe2832..c0e82b7 100644
--- a/vecmathlib.h
+++ b/vecmathlib.h
@@ -165,7 +165,7 @@ class type_info;
#else
#define VML_CONFIG_ALTIVEC
#endif
-#if defined __ALTIVEC__ && defined _ARCH_PWR7 // IBM VSX
+#if defined __ALTIVEC__ && defined _ARCH_PWR7 && !defined __GNUC__ && !defined __GNUG__ // IBM VSX
#include "vec_vsx_double2.h"
#define VML_CONFIG_VSX " VSX"
#else
OpenPOWER on IntegriCloud