[webkit-changes] [WebKit/WebKit] 4e7fe4: [JSC] Use std::popcount instead of __builtin_popco...
Linda_pp
noreply at github.com
Fri Jun 30 06:49:37 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4e7fe413ab40496e17623f5679b3e21cda074f1f
https://github.com/WebKit/WebKit/commit/4e7fe413ab40496e17623f5679b3e21cda074f1f
Author: Hayashida Ryuichi <Ryuichi.Hayashida at sony.com>
Date: 2023-06-30 (Fri, 30 Jun 2023)
Changed paths:
M Source/JavaScriptCore/wasm/WasmBBQJIT.cpp
M Source/JavaScriptCore/wasm/WasmOperations.cpp
M Source/JavaScriptCore/wasm/WasmSlowPaths.cpp
Log Message:
-----------
[JSC] Use std::popcount instead of __builtin_popcount and __builtin_popcountll
https://bugs.webkit.org/show_bug.cgi?id=258557
Reviewed by Ross Kirsling.
__builtin_popcount and __builtin_popcountll are builtin functions
provided by GCC and Clang. However MSVC doesn't provide them so they
don't compile with MSVC.
This patch replaces the builtin functions with portable std::popcount
defined in C++ STL. The function is available in all major C++ standard
library implementations (libstdc++, libc++, MSVC STL).
* libc++: https://github.com/llvm/llvm-project/blob/llvmorg-14.0.6/libcxx/include/bit#L192
* libstdc++: https://github.com/gcc-mirror/gcc/blob/releases/gcc-9.5.0/libstdc%2B%2B-v3/include/std/bit#L169
* MSVC STL: https://github.com/microsoft/STL/blob/40640c6df9754ea031f8df7c720b89714d19df97/stl/inc/__msvc_bit_utils.hpp#L396
It is confirmed that all implementations are optimized to use the
compiler-specific intrinsics.
* Source/JavaScriptCore/wasm/WasmBBQJIT.cpp:
(JSC::Wasm::BBQJIT::addI32Popcnt):
(JSC::Wasm::BBQJIT::addI64Popcnt):
* Source/JavaScriptCore/wasm/WasmOperations.cpp:
(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/wasm/WasmSlowPaths.cpp:
(JSC::LLInt::slow_path_wasm_popcount):
(JSC::LLInt::slow_path_wasm_popcountll):
Canonical link: https://commits.webkit.org/265651@main
More information about the webkit-changes
mailing list