summaryrefslogtreecommitdiff
path: root/gf2n_simd.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2019-06-08 11:00:11 -0400
committerJeffrey Walton <noloader@gmail.com>2019-06-08 11:00:11 -0400
commit43b01973b1dc0c50cd394502f7475e2c1039ad35 (patch)
tree76b7ef5d59d709e765e4dfa5f68a4757e2f30fce /gf2n_simd.cpp
parentafffba7b7bc81e135ca0d10e3ee97774a6574361 (diff)
downloadcryptopp-git-43b01973b1dc0c50cd394502f7475e2c1039ad35.tar.gz
Clear lgtm findings
We did some refactoring and added sse_simd.h. Over time more SSE functions will likely move into sse_simd.h
Diffstat (limited to 'gf2n_simd.cpp')
-rw-r--r--gf2n_simd.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/gf2n_simd.cpp b/gf2n_simd.cpp
index 1d4d933f..3bd3cd0e 100644
--- a/gf2n_simd.cpp
+++ b/gf2n_simd.cpp
@@ -28,6 +28,7 @@
#if (CRYPTOPP_CLMUL_AVAILABLE)
# include <emmintrin.h>
# include <wmmintrin.h>
+# include "sse_simd.h"
#endif
#if (CRYPTOPP_ARM_PMULL_AVAILABLE)
@@ -465,36 +466,31 @@ NAMESPACE_BEGIN(CryptoPP)
void
GF2NT_233_Multiply_Reduce_CLMUL(const word* pA, const word* pB, word* pC)
{
- const __m128i* pAA = reinterpret_cast<const __m128i*>(pA);
- const __m128i* pBB = reinterpret_cast<const __m128i*>(pB);
- __m128i a0 = _mm_loadu_si128(pAA+0);
- __m128i a1 = _mm_loadu_si128(pAA+1);
- __m128i b0 = _mm_loadu_si128(pBB+0);
- __m128i b1 = _mm_loadu_si128(pBB+1);
+ __m128i a0 = load_m128i<0>(pA);
+ __m128i a1 = load_m128i<1>(pA);
+ __m128i b0 = load_m128i<0>(pB);
+ __m128i b1 = load_m128i<1>(pB);
__m128i c0, c1, c2, c3;
F2N_Multiply_256x256_CLMUL(c3, c2, c1, c0, a1, a0, b1, b0);
GF2NT_233_Reduce_CLMUL(c3, c2, c1, c0);
- __m128i* pCC = reinterpret_cast<__m128i*>(pC);
- _mm_storeu_si128(pCC+0, c0);
- _mm_storeu_si128(pCC+1, c1);
+ store_m128i<0>(pC, c0);
+ store_m128i<1>(pC, c1);
}
void
GF2NT_233_Square_Reduce_CLMUL(const word* pA, word* pC)
{
- const __m128i* pAA = reinterpret_cast<const __m128i*>(pA);
- __m128i a0 = _mm_loadu_si128(pAA+0);
- __m128i a1 = _mm_loadu_si128(pAA+1);
+ __m128i a0 = load_m128i<0>(pA);
+ __m128i a1 = load_m128i<1>(pA);
__m128i c0, c1, c2, c3;
F2N_Square_256_CLMUL(c3, c2, c1, c0, a1, a0);
GF2NT_233_Reduce_CLMUL(c3, c2, c1, c0);
- __m128i* pCC = reinterpret_cast<__m128i*>(pC);
- _mm_storeu_si128(pCC+0, c0);
- _mm_storeu_si128(pCC+1, c1);
+ store_m128i<0>(pC, c0);
+ store_m128i<1>(pC, c1);
}
#elif (CRYPTOPP_ARM_PMULL_AVAILABLE)