xref: /aosp_15_r20/external/zlib/patches/0013-cpu-feature-detection-for-arm.patch (revision 86ee64e75fa5f8bce2c8c356138035642429cd05)
1From c43ba7a55f091c0dcbfd8d89f7a5121269ce1b81 Mon Sep 17 00:00:00 2001
2From: Ho Cheung <[email protected]>
3Date: Thu, 27 Jul 2023 09:47:52 +0800
4Subject: [PATCH] [zlib] Perform CPU feature detection for ARM inside adler32()
5
6Perform CPU feature detection for ARM within adler32() to have the same
7behavior as x86.
8
9---
10 third_party/zlib/adler32.c | 4 ++--
11 1 file changed, 2 insertions(+), 2 deletions(-)
12
13diff --git a/third_party/zlib/adler32.c b/third_party/zlib/adler32.c
14index 81c584f68e233..99a294496f7eb 100644
15--- a/third_party/zlib/adler32.c
16+++ b/third_party/zlib/adler32.c
17@@ -90,9 +90,9 @@ uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
18         return adler | (sum2 << 16);
19     }
20
21-#if defined(ADLER32_SIMD_SSSE3)
22+#if defined(ADLER32_SIMD_SSSE3) || defined(ADLER32_SIMD_NEON)
23     /*
24-     * Use SSSE3 to compute the adler32. Since this routine can be
25+     * Use SIMD to compute the adler32. Since this function can be
26      * freely used, check CPU features here. zlib convention is to
27      * call adler32(0, NULL, 0), before making calls to adler32().
28      * So this is a good early (and infrequent) place to cache CPU
29--
302.41.0.windows.3
31