aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-08-30 12:00:32 -0400
committerJack Lloyd <[email protected]>2016-08-30 12:00:32 -0400
commit394876f1332b3c351eb3a6a643fcafdad54fa5b4 (patch)
tree5fc45d971521870ecd5324cfbed1a5a122653b53 /src
parent9b62714cc500e438fda8399374fd6a793f3f325e (diff)
Fix some problems on ppc64le
Altivec code assumed big-endian.
Diffstat (limited to 'src')
-rw-r--r--src/lib/utils/simd/simd_32.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/utils/simd/simd_32.h b/src/lib/utils/simd/simd_32.h
index 0b4ca8f03..c29c55c7a 100644
--- a/src/lib/utils/simd/simd_32.h
+++ b/src/lib/utils/simd/simd_32.h
@@ -100,7 +100,9 @@ class SIMD_4x32
__vector unsigned char perm = vec_lvsl(0, in_32);
- perm = vec_xor(perm, vec_splat_u8(3));
+#if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN)
+ perm = vec_xor(perm, vec_splat_u8(3)); // bswap vector
+#endif
R0 = vec_perm(R0, R1, perm);
@@ -124,6 +126,10 @@ class SIMD_4x32
__vector unsigned char perm = vec_lvsl(0, in_32);
+#if defined(BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN)
+ perm = vec_xor(perm, vec_splat_u8(3)); // bswap vector
+#endif
+
R0 = vec_perm(R0, R1, perm);
return SIMD_4x32(R0);
@@ -142,7 +148,9 @@ class SIMD_4x32
#elif defined(BOTAN_SIMD_USE_ALTIVEC)
__vector unsigned char perm = vec_lvsl(0, static_cast<u32bit*>(nullptr));
+#if defined(BOTAN_TARGET_CPU_IS_BIG_ENDIAN)
perm = vec_xor(perm, vec_splat_u8(3)); // bswap vector
+#endif
union {
__vector unsigned int V;