Don't kick in AVX2/AVX512 VTEC unless the packet is larger than 256 bytes.

This commit is contained in:
Adam Ierymenko 2020-07-30 10:02:37 -07:00
parent 1f2a107d1d
commit 0c56d7c769
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3

View file

@ -705,7 +705,7 @@ void AES::CTR::crypt(const void *const input, unsigned int len) noexcept
if (likely(len >= 64)) {
#if defined(ZT_AES_VAES512) && defined(ZT_AES_VAES256)
if (Utils::CPUID.vaes) {
if (Utils::CPUID.vaes && (len >= 256)) {
if (Utils::CPUID.avx512f) {
p_aesCtrInnerVAES512(len, _ctr[0], c1, in, out, k);
} else {
@ -716,7 +716,7 @@ void AES::CTR::crypt(const void *const input, unsigned int len) noexcept
#endif
#if !defined(ZT_AES_VAES512) && defined(ZT_AES_VAES256)
if (Utils::CPUID.vaes) {
if (Utils::CPUID.vaes && (len >= 256)) {
p_aesCtrInnerVAES256(len, _ctr[0], c1, in, out, k);
goto skip_conventional_aesni_64;
}
@ -897,7 +897,7 @@ void AES::CTR::crypt(const void *const input, unsigned int len) noexcept
out += totalLen;
_len = totalLen + len;
if (len >= 64) {
if (likely(len >= 64)) {
const uint32x4_t four = {0,0,0,4};
uint8x16_t dd1 = (uint8x16_t)vaddq_u32((uint32x4_t)dd, one);
uint8x16_t dd2 = (uint8x16_t)vaddq_u32((uint32x4_t)dd1, one);