From d84a9176de79fb62aa4e390969846d26728cf235 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 11 May 2020 22:38:33 -0400 Subject: Rename VecReverse to VecReverseLE --- ppc_simd.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'ppc_simd.h') diff --git a/ppc_simd.h b/ppc_simd.h index 9c264fe7..6fe1fe8c 100644 --- a/ppc_simd.h +++ b/ppc_simd.h @@ -230,18 +230,19 @@ inline uint32x4_p VecOne() /// \tparam T vector type /// \param data the vector /// \returns vector -/// \details VecReverse() reverses the bytes in a vector +/// \details VecReverseLE() reverses the bytes in a vector on +/// little-endian systems. /// \par Wraps -/// vec_revb on POWER9, vec_perm on POWER8 and below +/// vec_perm on POWER8 and below /// \since Crypto++ 6.0 template -inline T VecReverse(const T data) +inline T VecReverseLE(const T data) { -#if (_ARCH_PWR9) - return (T)vec_revb((uint8x16_p)data); -#else +#if defined(CRYPTOPP_LITTLE_ENDIAN) const uint8x16_p mask = {15,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0}; return (T)vec_perm(data, data, mask); +#else + return data; #endif } @@ -710,7 +711,7 @@ inline uint32x4_p VecLoadBE(const byte src[16]) #elif defined(CRYPTOPP_BIG_ENDIAN) return (uint32x4_p)VecLoad_ALTIVEC(0, CONST_V8_CAST(src)); #else - return (uint32x4_p)VecReverse(VecLoad_ALTIVEC(CONST_V8_CAST(src))); + return (uint32x4_p)VecReverseLE(VecLoad_ALTIVEC(CONST_V8_CAST(src))); #endif } @@ -744,7 +745,7 @@ inline uint32x4_p VecLoadBE(int off, const byte src[16]) #elif defined(CRYPTOPP_BIG_ENDIAN) return (uint32x4_p)VecLoad_ALTIVEC(CONST_V8_CAST(addr)); #else - return (uint32x4_p)VecReverse(VecLoad_ALTIVEC(CONST_V8_CAST(addr))); + return (uint32x4_p)VecReverseLE(VecLoad_ALTIVEC(CONST_V8_CAST(addr))); #endif } @@ -1198,7 +1199,7 @@ inline void VecStoreBE(const T data, byte dest[16]) #elif defined(CRYPTOPP_BIG_ENDIAN) VecStore((uint8x16_p)data, NCONST_V8_CAST(addr)); #else - VecStore((uint8x16_p)VecReverse(data), NCONST_V8_CAST(addr)); + VecStore((uint8x16_p)VecReverseLE(data), NCONST_V8_CAST(addr)); #endif } @@ -1234,7 +1235,7 @@ inline void VecStoreBE(const T data, int off, byte dest[16]) #elif defined(CRYPTOPP_BIG_ENDIAN) VecStore((uint8x16_p)data, NCONST_V8_CAST(addr)); #else - VecStore((uint8x16_p)VecReverse(data), NCONST_V8_CAST(addr)); + VecStore((uint8x16_p)VecReverseLE(data), NCONST_V8_CAST(addr)); #endif } @@ -1269,7 +1270,7 @@ inline void VecStoreBE(const T data, word32 dest[4]) #elif defined(CRYPTOPP_BIG_ENDIAN) VecStore((uint32x4_p)data, NCONST_V32_CAST(addr)); #else - VecStore((uint32x4_p)VecReverse(data), NCONST_V32_CAST(addr)); + VecStore((uint32x4_p)VecReverseLE(data), NCONST_V32_CAST(addr)); #endif } @@ -1305,7 +1306,7 @@ inline void VecStoreBE(const T data, int off, word32 dest[4]) #elif defined(CRYPTOPP_BIG_ENDIAN) VecStore((uint32x4_p)data, NCONST_V32_CAST(addr)); #else - VecStore((uint32x4_p)VecReverse(data), NCONST_V32_CAST(addr)); + VecStore((uint32x4_p)VecReverseLE(data), NCONST_V32_CAST(addr)); #endif } -- cgit v1.2.1