diff options
author | Jeffrey Walton <noloader@gmail.com> | 2018-08-09 00:06:42 -0400 |
---|---|---|
committer | Jeffrey Walton <noloader@gmail.com> | 2018-08-09 00:06:42 -0400 |
commit | 5b89e774cc89b00bae587aa21abf2be42840c3fa (patch) | |
tree | 2a67d9f67bbdfc7f0d7fe303f8f2452675a336bd /ppc-simd.h | |
parent | 13b6dac31d3f90c4b2930bcba6a90cc6cc6d4b32 (diff) | |
download | cryptopp-git-5b89e774cc89b00bae587aa21abf2be42840c3fa.tar.gz |
Add Altivec vector extraction tests
Diffstat (limited to 'ppc-simd.h')
-rw-r--r-- | ppc-simd.h | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -58,7 +58,7 @@ typedef __vector unsigned long long uint64x2_p; #endif // POWER8 datatypes
#endif // ALTIVEC datatypes
-// ALTIVEC and above
+// Applies to all POWER machines
#if defined(CRYPTOPP_ALTIVEC_AVAILABLE) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
/// \brief Reverse a vector
@@ -269,6 +269,22 @@ inline uint64x2_p VectorShiftRight<0, uint64x2_p>(const uint64x2_p& vec) }
#endif
+template <class T>
+inline T VectorGetLow(const T& val)
+{
+ const T zero = {0};
+ const uint8x16_p mask = {16,16,16,16, 16,16,16,16, 8,9,10,11, 12,13,14,15 };
+ return (T)vec_perm(val, zero, mask);
+}
+
+template <class T>
+inline T VectorGetHigh(const T& val)
+{
+ const T zero = {0};
+ const uint8x16_p mask = {16,16,16,16, 16,16,16,16, 0,1,2,3, 4,5,6,7 };
+ return (T)vec_perm(val, zero, mask);
+}
+
/// \brief Compare two vectors
/// \tparam T1 vector type
/// \tparam T2 vector type
|