Skip to content
Snippets Groups Projects
Commit f317558d authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot
Browse files

[zlib] Expose Intel SSE2 via CPU features

Add x86_cpu_enable_sse2 in cpu_features.c. Update external symbols for
the new name exposed x86_cpu_enable_sse2.

Also, add cpu_check_features to the symbols list (was missing and it's
defined as a ZLIB_INTERNAL symbol).

Bug: 1072308
Change-Id: Ibedfdb0c2e17a20b6f09f49b43ef383b0aa3029b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2156328


Commit-Queue: Noel Gordon <noel@chromium.org>
Reviewed-by: default avatarChris Blume <cblume@chromium.org>
Reviewed-by: default avatarAdenilson Cavalcanti <cavalcantii@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#760858}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: aba86d62e3b8524f2520ad8797900fbe2f7a55ba
parent a0ea34a2
No related branches found
No related tags found
No related merge requests found
......@@ -192,4 +192,8 @@
#define arm_check_features Cr_z_arm_check_features
#define armv8_crc32_little Cr_z_armv8_crc32_little
/* Symbols added by cpu_features.c */
#define cpu_check_features Cr_z_cpu_check_features
#define x86_cpu_enable_sse2 Cr_z_x86_cpu_enable_sse2
#endif /* THIRD_PARTY_ZLIB_CHROMECONF_H_ */
......@@ -19,6 +19,7 @@
*/
int ZLIB_INTERNAL arm_cpu_enable_crc32 = 0;
int ZLIB_INTERNAL arm_cpu_enable_pmull = 0;
int ZLIB_INTERNAL x86_cpu_enable_sse2 = 0;
int ZLIB_INTERNAL x86_cpu_enable_ssse3 = 0;
int ZLIB_INTERNAL x86_cpu_enable_simd = 0;
......@@ -127,16 +128,20 @@ static void _cpu_check_features(void)
int x86_cpu_has_sse42;
int x86_cpu_has_pclmulqdq;
int abcd[4];
#ifdef _MSC_VER
__cpuid(abcd, 1);
#else
__cpuid(1, abcd[0], abcd[1], abcd[2], abcd[3]);
#endif
x86_cpu_has_sse2 = abcd[3] & 0x4000000;
x86_cpu_has_ssse3 = abcd[2] & 0x000200;
x86_cpu_has_sse42 = abcd[2] & 0x100000;
x86_cpu_has_pclmulqdq = abcd[2] & 0x2;
x86_cpu_enable_sse2 = x86_cpu_has_sse2;
x86_cpu_enable_ssse3 = x86_cpu_has_ssse3;
x86_cpu_enable_simd = x86_cpu_has_sse2 &&
......@@ -145,4 +150,4 @@ static void _cpu_check_features(void)
}
#endif
#endif
#endif
\ No newline at end of file
#endif
......@@ -11,6 +11,7 @@
*/
extern int arm_cpu_enable_crc32;
extern int arm_cpu_enable_pmull;
extern int x86_cpu_enable_sse2;
extern int x86_cpu_enable_ssse3;
extern int x86_cpu_enable_simd;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment