Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: src/wasm/wasm-external-refs.cc

Issue 1857363003: [wasm] New implementation of popcnt and ctz. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-external-refs.h ('k') | test/cctest/compiler/test-run-calls-to-external-references.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-external-refs.cc
diff --git a/src/wasm/wasm-external-refs.cc b/src/wasm/wasm-external-refs.cc
index 1c4bd082522cd51983eb1188825fbc1d2a4ffa31..e155f3c8ba64fb0f0c321e8f307bcf384533426b 100644
--- a/src/wasm/wasm-external-refs.cc
+++ b/src/wasm/wasm-external-refs.cc
@@ -9,6 +9,7 @@
#include "include/v8config.h"
+#include "src/base/bits.h"
#include "src/wasm/wasm-external-refs.h"
namespace v8 {
@@ -176,6 +177,23 @@ int32_t uint64_mod_wrapper(uint64_t* dst, uint64_t* src) {
*dst %= *src;
return 1;
}
+
+uint32_t word32_ctz_wrapper(uint32_t* input) {
+ return static_cast<uint32_t>(base::bits::CountTrailingZeros32(*input));
+}
+
+uint32_t word64_ctz_wrapper(uint64_t* input) {
+ return static_cast<uint32_t>(base::bits::CountTrailingZeros64(*input));
+}
+
+uint32_t word32_popcnt_wrapper(uint32_t* input) {
+ return static_cast<uint32_t>(base::bits::CountPopulation(*input));
+}
+
+uint32_t word64_popcnt_wrapper(uint64_t* input) {
+ return static_cast<uint32_t>(base::bits::CountPopulation(*input));
+}
+
} // namespace wasm
} // namespace internal
} // namespace v8
« no previous file with comments | « src/wasm/wasm-external-refs.h ('k') | test/cctest/compiler/test-run-calls-to-external-references.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698