aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-09-13 06:30:46 -0400
committerJack Lloyd <[email protected]>2019-09-13 06:30:46 -0400
commitfef0808f2d5b7f64f72025c547c8fef00dbe3764 (patch)
tree525ca8e394fce9f7f3538532a133cacf3780aed6
parent5b4d3a53a4b33a03085a45f3a2bae68a5f761389 (diff)
parent6be172654ec5f4f15208845ba57fb8e5667a907e (diff)
Merge GH #2103 Fix AES vperm in single amalgmation mode
-rw-r--r--src/lib/block/aes/aes_vperm/aes_vperm.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/block/aes/aes_vperm/aes_vperm.cpp b/src/lib/block/aes/aes_vperm/aes_vperm.cpp
index 811dc10b5..24470bda3 100644
--- a/src/lib/block/aes/aes_vperm/aes_vperm.cpp
+++ b/src/lib/block/aes/aes_vperm/aes_vperm.cpp
@@ -18,11 +18,19 @@
#include <tmmintrin.h>
#endif
+#if defined(BOTAN_SIMD_USE_SSE2)
+ #define BOTAN_VPERM_ISA "ssse3"
+#elif defined(BOTAN_SIMD_USE_NEON)
+ #define BOTAN_VPERM_ISA "+simd"
+#elif defined(BOTAN_SIMD_USE_ALTIVEC)
+ #define BOTAN_VPERM_ISA "altivec"
+#endif
+
namespace Botan {
namespace {
-inline SIMD_4x32 shuffle(SIMD_4x32 a, SIMD_4x32 b)
+inline SIMD_4x32 BOTAN_FUNC_ISA(BOTAN_VPERM_ISA) shuffle(SIMD_4x32 a, SIMD_4x32 b)
{
#if defined(BOTAN_SIMD_USE_SSE2)
return SIMD_4x32(_mm_shuffle_epi8(a.raw(), b.raw()));
@@ -56,7 +64,7 @@ inline SIMD_4x32 shuffle(SIMD_4x32 a, SIMD_4x32 b)
}
template<size_t I>
-inline SIMD_4x32 shift_elems_left(SIMD_4x32 x)
+inline SIMD_4x32 BOTAN_FUNC_ISA(BOTAN_VPERM_ISA) shift_elems_left(SIMD_4x32 x)
{
#if defined(BOTAN_SIMD_USE_SSE2)
return SIMD_4x32(_mm_slli_si128(x.raw(), 4*I));
@@ -77,7 +85,7 @@ inline SIMD_4x32 shift_elems_left(SIMD_4x32 x)
#endif
}
-inline SIMD_4x32 alignr8(SIMD_4x32 a, SIMD_4x32 b)
+inline SIMD_4x32 BOTAN_FUNC_ISA(BOTAN_VPERM_ISA) alignr8(SIMD_4x32 a, SIMD_4x32 b)
{
#if defined(BOTAN_SIMD_USE_SSE2)
return SIMD_4x32(_mm_alignr_epi8(a.raw(), b.raw(), 8));