Move SIMON-64 and SPECK-64 to Power7 minimum

SIMON-64 and SPECK-64 don't use 64-bit type so they can run on Power7. We may be able to drop to Power4, but we need to test the effects of Loads and Stores without vec_vxs_ld and vec_vsx_st
This commit is contained in:
Jeffrey Walton 2018-08-14 23:31:40 -04:00
parent 62e95313af
commit 6f1caab7c2
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
4 changed files with 59 additions and 47 deletions

View File

@ -43,7 +43,7 @@
# include <arm_acle.h> # include <arm_acle.h>
#endif #endif
#if defined(CRYPTOPP_POWER8_AVAILABLE) #if defined(CRYPTOPP_POWER7_AVAILABLE)
# include "ppc-simd.h" # include "ppc-simd.h"
#endif #endif
@ -951,9 +951,9 @@ inline void SIMON64_Dec_6_Blocks(__m128i &block0, __m128i &block1,
#endif // CRYPTOPP_SSE41_AVAILABLE #endif // CRYPTOPP_SSE41_AVAILABLE
// ***************************** Power8 ***************************** // // ***************************** Power7 ***************************** //
#if defined(CRYPTOPP_POWER8_AVAILABLE) #if defined(CRYPTOPP_POWER7_AVAILABLE)
using CryptoPP::uint8x16_p; using CryptoPP::uint8x16_p;
using CryptoPP::uint32x4_p; using CryptoPP::uint32x4_p;
@ -1191,7 +1191,7 @@ inline void SIMON64_Dec_6_Blocks(uint32x4_p &block0, uint32x4_p &block1,
block5 = (uint32x4_p)vec_perm(x3, y3, m4); block5 = (uint32x4_p)vec_perm(x3, y3, m4);
} }
#endif // CRYPTOPP_POWER8_AVAILABLE #endif // CRYPTOPP_POWER7_AVAILABLE
// ***************************** Power8 ***************************** // // ***************************** Power8 ***************************** //
@ -1506,23 +1506,27 @@ size_t SIMON128_Dec_AdvancedProcessBlocks_SSSE3(const word64* subKeys, size_t ro
} }
#endif // CRYPTOPP_SSSE3_AVAILABLE #endif // CRYPTOPP_SSSE3_AVAILABLE
// ***************************** Power8 ***************************** // // ***************************** Power7 ***************************** //
#if defined(CRYPTOPP_POWER8_AVAILABLE) #if defined(CRYPTOPP_POWER7_AVAILABLE)
size_t SIMON64_Enc_AdvancedProcessBlocks_POWER8(const word32* subKeys, size_t rounds, size_t SIMON64_Enc_AdvancedProcessBlocks_POWER7(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags)
{ {
return AdvancedProcessBlocks64_6x2_ALTIVEC(SIMON64_Enc_Block, SIMON64_Enc_6_Blocks, return AdvancedProcessBlocks64_6x2_ALTIVEC(SIMON64_Enc_Block, SIMON64_Enc_6_Blocks,
subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags); subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
} }
size_t SIMON64_Dec_AdvancedProcessBlocks_POWER8(const word32* subKeys, size_t rounds, size_t SIMON64_Dec_AdvancedProcessBlocks_POWER7(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags)
{ {
return AdvancedProcessBlocks64_6x2_ALTIVEC(SIMON64_Dec_Block, SIMON64_Dec_6_Blocks, return AdvancedProcessBlocks64_6x2_ALTIVEC(SIMON64_Dec_Block, SIMON64_Dec_6_Blocks,
subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags); subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
} }
#endif
// ***************************** Power8 ***************************** //
#if defined(CRYPTOPP_POWER8_AVAILABLE)
size_t SIMON128_Enc_AdvancedProcessBlocks_POWER8(const word64* subKeys, size_t rounds, size_t SIMON128_Enc_AdvancedProcessBlocks_POWER8(const word64* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags)
{ {

View File

@ -225,13 +225,15 @@ extern size_t SIMON128_Dec_AdvancedProcessBlocks_SSSE3(const word64* subKeys, si
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags); const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
#endif #endif
#if (CRYPTOPP_POWER7_AVAILABLE)
extern size_t SIMON64_Enc_AdvancedProcessBlocks_POWER7(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
extern size_t SIMON64_Dec_AdvancedProcessBlocks_POWER7(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
#endif
#if (CRYPTOPP_POWER8_AVAILABLE) #if (CRYPTOPP_POWER8_AVAILABLE)
extern size_t SIMON64_Enc_AdvancedProcessBlocks_POWER8(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
extern size_t SIMON64_Dec_AdvancedProcessBlocks_POWER8(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
extern size_t SIMON128_Enc_AdvancedProcessBlocks_POWER8(const word64* subKeys, size_t rounds, extern size_t SIMON128_Enc_AdvancedProcessBlocks_POWER8(const word64* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags); const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
@ -249,9 +251,9 @@ std::string SIMON64::Base::AlgorithmProvider() const
if (HasNEON()) if (HasNEON())
return "NEON"; return "NEON";
#endif #endif
#if (CRYPTOPP_POWER8_AVAILABLE) #if (CRYPTOPP_POWER7_AVAILABLE)
if (HasPower8()) if (HasPower7())
return "Power8"; return "Power7";
#endif #endif
return "C++"; return "C++";
} }
@ -454,9 +456,9 @@ size_t SIMON64::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xor
return SIMON64_Enc_AdvancedProcessBlocks_NEON(m_rkeys, (size_t)m_rounds, return SIMON64_Enc_AdvancedProcessBlocks_NEON(m_rkeys, (size_t)m_rounds,
inBlocks, xorBlocks, outBlocks, length, flags); inBlocks, xorBlocks, outBlocks, length, flags);
#endif #endif
#if (CRYPTOPP_POWER8_AVAILABLE) #if (CRYPTOPP_POWER7_AVAILABLE)
if (HasPower8()) if (HasPower7())
return SIMON64_Enc_AdvancedProcessBlocks_POWER8(m_rkeys, (size_t)m_rounds, return SIMON64_Enc_AdvancedProcessBlocks_POWER7(m_rkeys, (size_t)m_rounds,
inBlocks, xorBlocks, outBlocks, length, flags); inBlocks, xorBlocks, outBlocks, length, flags);
#endif #endif
return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags); return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags);
@ -475,9 +477,9 @@ size_t SIMON64::Dec::AdvancedProcessBlocks(const byte *inBlocks, const byte *xor
return SIMON64_Dec_AdvancedProcessBlocks_NEON(m_rkeys, (size_t)m_rounds, return SIMON64_Dec_AdvancedProcessBlocks_NEON(m_rkeys, (size_t)m_rounds,
inBlocks, xorBlocks, outBlocks, length, flags); inBlocks, xorBlocks, outBlocks, length, flags);
#endif #endif
#if (CRYPTOPP_POWER8_AVAILABLE) #if (CRYPTOPP_POWER7_AVAILABLE)
if (HasPower8()) if (HasPower7())
return SIMON64_Dec_AdvancedProcessBlocks_POWER8(m_rkeys, (size_t)m_rounds, return SIMON64_Dec_AdvancedProcessBlocks_POWER7(m_rkeys, (size_t)m_rounds,
inBlocks, xorBlocks, outBlocks, length, flags); inBlocks, xorBlocks, outBlocks, length, flags);
#endif #endif
return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags); return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags);

View File

@ -43,7 +43,7 @@
# include <arm_acle.h> # include <arm_acle.h>
#endif #endif
#if defined(CRYPTOPP_POWER8_AVAILABLE) #if defined(CRYPTOPP_POWER7_AVAILABLE)
# include "ppc-simd.h" # include "ppc-simd.h"
#endif #endif
@ -842,9 +842,9 @@ inline void SPECK64_Dec_6_Blocks(__m128i &block0, __m128i &block1,
#endif // CRYPTOPP_SSE41_AVAILABLE #endif // CRYPTOPP_SSE41_AVAILABLE
// ***************************** Power8 ***************************** // // ***************************** Power7 ***************************** //
#if defined(CRYPTOPP_POWER8_AVAILABLE) #if defined(CRYPTOPP_POWER7_AVAILABLE)
using CryptoPP::uint8x16_p; using CryptoPP::uint8x16_p;
using CryptoPP::uint32x4_p; using CryptoPP::uint32x4_p;
@ -1072,7 +1072,7 @@ void SPECK64_Dec_6_Blocks(uint32x4_p &block0, uint32x4_p &block1,
block5 = (uint32x4_p)vec_perm(x3, y3, m4); block5 = (uint32x4_p)vec_perm(x3, y3, m4);
} }
#endif // POWER8 #endif // CRYPTOPP_POWER7_AVAILABLE
// ***************************** Power8 ***************************** // // ***************************** Power8 ***************************** //
@ -1295,7 +1295,7 @@ void SPECK128_Dec_6_Blocks(uint32x4_p &block0, uint32x4_p &block1,
block5 = (uint32x4_p)vec_perm(x3, y3, m4); block5 = (uint32x4_p)vec_perm(x3, y3, m4);
} }
#endif // POWER8 #endif // CRYPTOPP_POWER8_AVAILABLE
ANONYMOUS_NAMESPACE_END ANONYMOUS_NAMESPACE_END
@ -1371,23 +1371,27 @@ size_t SPECK128_Dec_AdvancedProcessBlocks_SSSE3(const word64* subKeys, size_t ro
} }
#endif // CRYPTOPP_SSSE3_AVAILABLE #endif // CRYPTOPP_SSSE3_AVAILABLE
// ***************************** Power8 ***************************** // // ***************************** Power7 ***************************** //
#if defined(CRYPTOPP_POWER8_AVAILABLE) #if defined(CRYPTOPP_POWER7_AVAILABLE)
size_t SPECK64_Enc_AdvancedProcessBlocks_POWER8(const word32* subKeys, size_t rounds, size_t SPECK64_Enc_AdvancedProcessBlocks_POWER7(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags)
{ {
return AdvancedProcessBlocks64_6x2_ALTIVEC(SPECK64_Enc_Block, SPECK64_Enc_6_Blocks, return AdvancedProcessBlocks64_6x2_ALTIVEC(SPECK64_Enc_Block, SPECK64_Enc_6_Blocks,
subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags); subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
} }
size_t SPECK64_Dec_AdvancedProcessBlocks_POWER8(const word32* subKeys, size_t rounds, size_t SPECK64_Dec_AdvancedProcessBlocks_POWER7(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags)
{ {
return AdvancedProcessBlocks64_6x2_ALTIVEC(SPECK64_Dec_Block, SPECK64_Dec_6_Blocks, return AdvancedProcessBlocks64_6x2_ALTIVEC(SPECK64_Dec_Block, SPECK64_Dec_6_Blocks,
subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags); subKeys, rounds, inBlocks, xorBlocks, outBlocks, length, flags);
} }
#endif
// ***************************** Power8 ***************************** //
#if defined(CRYPTOPP_POWER8_AVAILABLE)
size_t SPECK128_Enc_AdvancedProcessBlocks_POWER8(const word64* subKeys, size_t rounds, size_t SPECK128_Enc_AdvancedProcessBlocks_POWER8(const word64* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags) const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags)
{ {

View File

@ -200,13 +200,15 @@ extern size_t SPECK128_Dec_AdvancedProcessBlocks_SSSE3(const word64* subKeys, si
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags); const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
#endif #endif
#if defined(CRYPTOPP_POWER7_AVAILABLE)
extern size_t SPECK64_Enc_AdvancedProcessBlocks_POWER7(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
extern size_t SPECK64_Dec_AdvancedProcessBlocks_POWER7(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
#endif
#if defined(CRYPTOPP_POWER8_AVAILABLE) #if defined(CRYPTOPP_POWER8_AVAILABLE)
extern size_t SPECK64_Enc_AdvancedProcessBlocks_POWER8(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
extern size_t SPECK64_Dec_AdvancedProcessBlocks_POWER8(const word32* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
extern size_t SPECK128_Enc_AdvancedProcessBlocks_POWER8(const word64* subKeys, size_t rounds, extern size_t SPECK128_Enc_AdvancedProcessBlocks_POWER8(const word64* subKeys, size_t rounds,
const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags); const byte *inBlocks, const byte *xorBlocks, byte *outBlocks, size_t length, word32 flags);
@ -224,9 +226,9 @@ std::string SPECK64::Base::AlgorithmProvider() const
if (HasNEON()) if (HasNEON())
return "NEON"; return "NEON";
#endif #endif
#if (CRYPTOPP_POWER8_AVAILABLE) #if (CRYPTOPP_POWER7_AVAILABLE)
if (HasPower8()) if (HasPower7())
return "Power8"; return "Power7";
#endif #endif
return "C++"; return "C++";
} }
@ -429,9 +431,9 @@ size_t SPECK64::Enc::AdvancedProcessBlocks(const byte *inBlocks, const byte *xor
return SPECK64_Enc_AdvancedProcessBlocks_NEON(m_rkeys, (size_t)m_rounds, return SPECK64_Enc_AdvancedProcessBlocks_NEON(m_rkeys, (size_t)m_rounds,
inBlocks, xorBlocks, outBlocks, length, flags); inBlocks, xorBlocks, outBlocks, length, flags);
#endif #endif
#if (CRYPTOPP_POWER8_AVAILABLE) #if (CRYPTOPP_POWER7_AVAILABLE)
if (HasPower8()) if (HasPower7())
return SPECK64_Enc_AdvancedProcessBlocks_POWER8(m_rkeys, (size_t)m_rounds, return SPECK64_Enc_AdvancedProcessBlocks_POWER7(m_rkeys, (size_t)m_rounds,
inBlocks, xorBlocks, outBlocks, length, flags); inBlocks, xorBlocks, outBlocks, length, flags);
#endif #endif
return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags); return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags);
@ -450,9 +452,9 @@ size_t SPECK64::Dec::AdvancedProcessBlocks(const byte *inBlocks, const byte *xor
return SPECK64_Dec_AdvancedProcessBlocks_NEON(m_rkeys, (size_t)m_rounds, return SPECK64_Dec_AdvancedProcessBlocks_NEON(m_rkeys, (size_t)m_rounds,
inBlocks, xorBlocks, outBlocks, length, flags); inBlocks, xorBlocks, outBlocks, length, flags);
#endif #endif
#if (CRYPTOPP_POWER8_AVAILABLE) #if (CRYPTOPP_POWER7_AVAILABLE)
if (HasPower8()) if (HasPower7())
return SPECK64_Dec_AdvancedProcessBlocks_POWER8(m_rkeys, (size_t)m_rounds, return SPECK64_Dec_AdvancedProcessBlocks_POWER7(m_rkeys, (size_t)m_rounds,
inBlocks, xorBlocks, outBlocks, length, flags); inBlocks, xorBlocks, outBlocks, length, flags);
#endif #endif
return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags); return BlockTransformation::AdvancedProcessBlocks(inBlocks, xorBlocks, outBlocks, length, flags);