Commit f49db10161 for openssl.org
commit f49db10161948e09107a51ae77c9f1f3aa5dd93e
Author: krk <keremkat@gmail.com>
Date: Thu Jan 29 19:52:49 2026 +0000
Add software prefetch to AVX2 base64 encoder hot loop
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Fri Feb 13 14:31:43 2026
(Merged from https://github.com/openssl/openssl/pull/29858)
diff --git a/crypto/evp/enc_b64_avx2.c b/crypto/evp/enc_b64_avx2.c
index b3f46e66ae..141e7fcc87 100644
--- a/crypto/evp/enc_b64_avx2.c
+++ b/crypto/evp/enc_b64_avx2.c
@@ -493,6 +493,7 @@ int encode_base64_avx2(EVP_ENCODE_CTX *ctx, unsigned char *dst,
/* Process 96 bytes at a time */
for (; i + 100 <= srclen; i += 96) {
+ _mm_prefetch((const char *)(input + i + 192), _MM_HINT_T0);
/* We shave off 4 bytes from the beginning and the end */
const __m128i lo0 = _mm_loadu_si128((const __m128i *)(input + i + 4 * 3 * 0));
const __m128i hi0 = _mm_loadu_si128((const __m128i *)(input + i + 4 * 3 * 1));