Clear unused variable warning under Visual Studio
parent
ca32b63038
commit
fbf0f62f4b
|
|
@ -154,7 +154,7 @@ LDLIBS =
|
||||||
# Debug build.
|
# Debug build.
|
||||||
# CXXFLAGS = $(CXXFLAGS) /DDEBUG /D_DEBUG /Oi /Oy- /Od /MTd
|
# CXXFLAGS = $(CXXFLAGS) /DDEBUG /D_DEBUG /Oi /Oy- /Od /MTd
|
||||||
# Release build. Add /OPT:REF to linker
|
# Release build. Add /OPT:REF to linker
|
||||||
CXXFLAGS = $(CXXFLAGS) /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT
|
CXXFLAGS = $(CXXFLAGS) /DNDEBUG /D_NDEBUG /Oi /Oy /O2 /MT /openmp
|
||||||
# Linker flags.
|
# Linker flags.
|
||||||
LDFLAGS = $(LDFLAGS) /OPT:REF
|
LDFLAGS = $(LDFLAGS) /OPT:REF
|
||||||
|
|
||||||
|
|
|
||||||
18
gf2n.cpp
18
gf2n.cpp
|
|
@ -42,8 +42,16 @@ ANONYMOUS_NAMESPACE_END
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if defined(CRYPTOPP_CLMUL_AVAILABLE) || defined(CRYPTOPP_ARM_PMULL_AVAILABLE) || defined(CRYPTOPP_POWER8_VMULL_AVAILABLE)
|
#if defined(CRYPTOPP_CLMUL_AVAILABLE)
|
||||||
extern void GF2NT_233_Multiply_Reduce(const word* pA, const word* pB, word* pC);
|
extern void GF2NT_233_Multiply_Reduce_CLMUL(const word* pA, const word* pB, word* pC);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CRYPTOPP_ARM_PMULL_AVAILABLE)
|
||||||
|
extern void GF2NT_233_Multiply_Reduce_ARMv8(const word* pA, const word* pB, word* pC);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CRYPTOPP_POWER8_VMULL_AVAILABLE)
|
||||||
|
extern void GF2NT_233_Multiply_Reduce_POWER8(const word* pA, const word* pB, word* pC);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PolynomialMod2::PolynomialMod2()
|
PolynomialMod2::PolynomialMod2()
|
||||||
|
|
@ -969,7 +977,7 @@ const GF2NT::Element& GF2NT233::Multiply(const Element &a, const Element &b) con
|
||||||
const word* pB = b.reg.begin();
|
const word* pB = b.reg.begin();
|
||||||
word* pR = result.reg.begin();
|
word* pR = result.reg.begin();
|
||||||
|
|
||||||
GF2NT_233_Multiply_Reduce(pA, pB, pR);
|
GF2NT_233_Multiply_Reduce_CLMUL(pA, pB, pR);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -984,7 +992,7 @@ const GF2NT::Element& GF2NT233::Multiply(const Element &a, const Element &b) con
|
||||||
const word* pB = b.reg.begin();
|
const word* pB = b.reg.begin();
|
||||||
word* pR = result.reg.begin();
|
word* pR = result.reg.begin();
|
||||||
|
|
||||||
GF2NT_233_Multiply_Reduce(pA, pB, pR);
|
GF2NT_233_Multiply_Reduce_ARMv8(pA, pB, pR);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -999,7 +1007,7 @@ const GF2NT::Element& GF2NT233::Multiply(const Element &a, const Element &b) con
|
||||||
const word* pB = b.reg.begin();
|
const word* pB = b.reg.begin();
|
||||||
word* pR = result.reg.begin();
|
word* pR = result.reg.begin();
|
||||||
|
|
||||||
GF2NT_233_Multiply_Reduce(pA, pB, pR);
|
GF2NT_233_Multiply_Reduce_POWER8(pA, pB, pR);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
113
gf2n_simd.cpp
113
gf2n_simd.cpp
|
|
@ -156,28 +156,6 @@ GF2NT_233_Reduce_ARMv8(uint64x2_t& c3, uint64x2_t& c2, uint64x2_t& c1, uint64x2_
|
||||||
c1 = vandq_u64(c1, m0);
|
c1 = vandq_u64(c1, m0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
|
||||||
GF2NT_233_Multiply_Reduce_ARMv8(const word* pA, const word* pB, word* pC)
|
|
||||||
{
|
|
||||||
// word is either 32-bit or 64-bit, depending on the platform.
|
|
||||||
// Load using a 32-bit pointer to avoid possible alignment issues.
|
|
||||||
const uint32_t* pAA = reinterpret_cast<const uint32_t*>(pA);
|
|
||||||
const uint32_t* pBB = reinterpret_cast<const uint32_t*>(pB);
|
|
||||||
|
|
||||||
uint64x2_t a0 = vreinterpretq_u64_u32(vld1q_u32(pAA+0));
|
|
||||||
uint64x2_t a1 = vreinterpretq_u64_u32(vld1q_u32(pAA+4));
|
|
||||||
uint64x2_t b0 = vreinterpretq_u64_u32(vld1q_u32(pBB+0));
|
|
||||||
uint64x2_t b1 = vreinterpretq_u64_u32(vld1q_u32(pBB+4));
|
|
||||||
|
|
||||||
uint64x2_t c0, c1, c2, c3;
|
|
||||||
F2N_Multiply_256x256_ARMv8(c3, c2, c1, c0, a1, a0, b1, b0);
|
|
||||||
GF2NT_233_Reduce_ARMv8(c3, c2, c1, c0);
|
|
||||||
|
|
||||||
uint32_t* pCC = reinterpret_cast<uint32_t*>(pC);
|
|
||||||
vst1q_u32(pCC+0, vreinterpretq_u32_u64(c0));
|
|
||||||
vst1q_u32(pCC+4, vreinterpretq_u32_u64(c1));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************** SSE ************************** //
|
// ************************** SSE ************************** //
|
||||||
|
|
@ -299,25 +277,6 @@ GF2NT_233_Reduce_CLMUL(__m128i& c3, __m128i& c2, __m128i& c1, __m128i& c0)
|
||||||
c1 = _mm_and_si128(c1, m0);
|
c1 = _mm_and_si128(c1, m0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline 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 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************* Power8 ************************* //
|
// ************************* Power8 ************************* //
|
||||||
|
|
@ -461,7 +420,60 @@ GF2NT_233_Reduce_POWER8(uint64x2_p& c3, uint64x2_p& c2, uint64x2_p& c1, uint64x2
|
||||||
c1 = VecAnd(c1, m0);
|
c1 = VecAnd(c1, m0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
#endif
|
||||||
|
|
||||||
|
ANONYMOUS_NAMESPACE_END
|
||||||
|
|
||||||
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
|
#if defined(CRYPTOPP_CLMUL_AVAILABLE)
|
||||||
|
|
||||||
|
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 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(CRYPTOPP_ARM_PMULL_AVAILABLE)
|
||||||
|
|
||||||
|
void
|
||||||
|
GF2NT_233_Multiply_Reduce_ARMv8(const word* pA, const word* pB, word* pC)
|
||||||
|
{
|
||||||
|
// word is either 32-bit or 64-bit, depending on the platform.
|
||||||
|
// Load using a 32-bit pointer to avoid possible alignment issues.
|
||||||
|
const uint32_t* pAA = reinterpret_cast<const uint32_t*>(pA);
|
||||||
|
const uint32_t* pBB = reinterpret_cast<const uint32_t*>(pB);
|
||||||
|
|
||||||
|
uint64x2_t a0 = vreinterpretq_u64_u32(vld1q_u32(pAA+0));
|
||||||
|
uint64x2_t a1 = vreinterpretq_u64_u32(vld1q_u32(pAA+4));
|
||||||
|
uint64x2_t b0 = vreinterpretq_u64_u32(vld1q_u32(pBB+0));
|
||||||
|
uint64x2_t b1 = vreinterpretq_u64_u32(vld1q_u32(pBB+4));
|
||||||
|
|
||||||
|
uint64x2_t c0, c1, c2, c3;
|
||||||
|
F2N_Multiply_256x256_ARMv8(c3, c2, c1, c0, a1, a0, b1, b0);
|
||||||
|
GF2NT_233_Reduce_ARMv8(c3, c2, c1, c0);
|
||||||
|
|
||||||
|
uint32_t* pCC = reinterpret_cast<uint32_t*>(pC);
|
||||||
|
vst1q_u32(pCC+0, vreinterpretq_u32_u64(c0));
|
||||||
|
vst1q_u32(pCC+4, vreinterpretq_u32_u64(c1));
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(CRYPTOPP_POWER8_VMULL_AVAILABLE)
|
||||||
|
|
||||||
|
void
|
||||||
GF2NT_233_Multiply_Reduce_POWER8(const word* pA, const word* pB, word* pC)
|
GF2NT_233_Multiply_Reduce_POWER8(const word* pA, const word* pB, word* pC)
|
||||||
{
|
{
|
||||||
// word is either 32-bit or 64-bit, depending on the platform.
|
// word is either 32-bit or 64-bit, depending on the platform.
|
||||||
|
|
@ -499,21 +511,4 @@ GF2NT_233_Multiply_Reduce_POWER8(const word* pA, const word* pB, word* pC)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ANONYMOUS_NAMESPACE_END
|
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
|
||||||
|
|
||||||
void GF2NT_233_Multiply_Reduce(const word* pA, const word* pB, word* pC)
|
|
||||||
{
|
|
||||||
#if defined(CRYPTOPP_CLMUL_AVAILABLE)
|
|
||||||
return GF2NT_233_Multiply_Reduce_CLMUL(pA, pB, pC);
|
|
||||||
#elif (CRYPTOPP_ARM_PMULL_AVAILABLE)
|
|
||||||
return GF2NT_233_Multiply_Reduce_ARMv8(pA, pB, pC);
|
|
||||||
#elif defined(CRYPTOPP_POWER8_VMULL_AVAILABLE)
|
|
||||||
return GF2NT_233_Multiply_Reduce_POWER8(pA, pB, pC);
|
|
||||||
#else
|
|
||||||
CRYPTOPP_ASSERT(0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
NAMESPACE_END
|
NAMESPACE_END
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue