summaryrefslogtreecommitdiffstats
path: root/vec_altivec_float4.h
diff options
context:
space:
mode:
Diffstat (limited to 'vec_altivec_float4.h')
-rw-r--r--vec_altivec_float4.h10
1 files changed, 7 insertions, 3 deletions
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);
OpenPOWER on IntegriCloud