diff options
author | robert.bradford <robert.bradford@intel.com> | 2014-10-24 12:08:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-24 19:08:23 +0000 |
commit | a5022d5eab6f77889aceed6ab0ccaf44a657ffc4 (patch) | |
tree | 121b66e113e3baad65a6bfbd9b7876f2480bd640 /third_party/zlib/BUILD.gn | |
parent | 5e64220166aa85f47fa9b8dd5db53254bc95487f (diff) | |
download | chromium_src-a5022d5eab6f77889aceed6ab0ccaf44a657ffc4.zip chromium_src-a5022d5eab6f77889aceed6ab0ccaf44a657ffc4.tar.gz chromium_src-a5022d5eab6f77889aceed6ab0ccaf44a657ffc4.tar.bz2 |
Reland "Integrate SIMD optimisations for zlib"
This reland adds an MSan suppression entry to work around gaps in MSan's
support for some of the intrinsics this patch uses. This version also inlines
the insert_string_sse function as it uses inline assembly and therefore does
not need to be in the static library.
Original CL: https://codereview.chromium.org/552123005
These optimisations have been published on zlib mailing list and at
https://github.com/jtkukunas/zlib/
This change merges the following optimisation patches:
- "For x86, add CPUID check."
- "Adds SSE2 optimized hash shifting to fill_window."
- "add SSE4.2 optimized hash function"
- "add PCLMULQDQ optimized CRC folding"
From Jim Kukunas <james.t.kukunas@linux.intel.com>; and adapts them to the
current zlib version in Chromium.
The optimisations are enabled at runtime if all the necessary CPU features are
present. As the optimisations require extra cflags to enable the compiler to
use the instructions the optimisations are held in their own static library
with a stub implementation to allow linking on other platforms.
TEST=net_unittests(GZipUnitTest) passes, Chrome functions and performance
improvement seen on RoboHornet benchmark on Linux Desktop
BUG=401517
Review URL: https://codereview.chromium.org/677713002
Cr-Commit-Position: refs/heads/master@{#301162}
Diffstat (limited to 'third_party/zlib/BUILD.gn')
-rw-r--r-- | third_party/zlib/BUILD.gn | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/third_party/zlib/BUILD.gn b/third_party/zlib/BUILD.gn index 0f21450..18cf816 100644 --- a/third_party/zlib/BUILD.gn +++ b/third_party/zlib/BUILD.gn @@ -6,6 +6,15 @@ config("zlib_config") { include_dirs = [ "." ] } +static_library("zlib_x86_simd") { + if (cpu_arch == "x86" || cpu_arch == "x64") { + sources = [ "crc_folding.c", "fill_window_sse.c" ] + cflags = [ "-msse2", "-msse4.2", "-mpclmul" ] + } else { + sources = [ "simd_stub.c"] + } +} + static_library("zlib") { if (!is_win) { # Don't stomp on "libzlib" on other platforms. @@ -36,16 +45,22 @@ static_library("zlib") { "trees.c", "trees.h", "uncompr.c", + "x86.h", "zconf.h", "zlib.h", "zutil.c", "zutil.h", ] + if (cpu_arch == "x86" || cpu_arch == "x64") { + sources += [ "x86.c" ] + } + configs -= [ "//build/config/compiler:chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ] public_configs = [ ":zlib_config" ] + deps = [ ":zlib_x86_simd" ] } static_library("minizip") { |