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

Unified Diff: test/cctest/compiler/test-run-calls-to-external-references.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.cc ('k') | test/cctest/wasm/test-run-wasm-64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-run-calls-to-external-references.cc
diff --git a/test/cctest/compiler/test-run-calls-to-external-references.cc b/test/cctest/compiler/test-run-calls-to-external-references.cc
index 58b7cf39557a320b5cfed90100c5e7745046ed3b..430e23814d4ef956b141431b3ac9c3fca5c220fb 100644
--- a/test/cctest/compiler/test-run-calls-to-external-references.cc
+++ b/test/cctest/compiler/test-run-calls-to-external-references.cc
@@ -48,6 +48,21 @@ void TestExternalReference(BufferedRawMachineAssemblerTester<int32_t>* m,
CHECK_EQ(comparison_param2, param2);
}
+template <typename R, typename P>
+void TestExternalReference(BufferedRawMachineAssemblerTester<R>* m,
+ ExternalReference ref, R (*comparison)(P*),
+ P param) {
+ P comparison_param = param;
+
+ Node* function = m->ExternalConstant(ref);
+ m->Return(m->CallCFunction1(MachineType::Pointer(), MachineType::Pointer(),
+ function, m->PointerConstant(&param)));
+
+ CHECK_EQ(comparison(&comparison_param), m->Call());
+
+ CHECK_EQ(comparison_param, param);
+}
+
template <typename R, typename P1, typename P2>
void TestExternalReference(BufferedRawMachineAssemblerTester<R>* m,
ExternalReference ref, R (*comparison)(P1*, P2*),
@@ -201,6 +216,30 @@ TEST(RunCallUint64Mod) {
TestExternalReference(&m, ref, wasm::uint64_mod_wrapper, uint64_t(1774),
uint64_t(21));
}
+
+TEST(RunCallWord32Ctz) {
+ BufferedRawMachineAssemblerTester<uint32_t> m;
+ ExternalReference ref = ExternalReference::wasm_word32_ctz(m.isolate());
+ TestExternalReference(&m, ref, wasm::word32_ctz_wrapper, uint32_t(1774));
+}
+
+TEST(RunCallWord64Ctz) {
+ BufferedRawMachineAssemblerTester<uint32_t> m;
+ ExternalReference ref = ExternalReference::wasm_word64_ctz(m.isolate());
+ TestExternalReference(&m, ref, wasm::word64_ctz_wrapper, uint64_t(1774));
+}
+
+TEST(RunCallWord32Popcnt) {
+ BufferedRawMachineAssemblerTester<uint32_t> m;
+ ExternalReference ref = ExternalReference::wasm_word32_popcnt(m.isolate());
+ TestExternalReference(&m, ref, wasm::word32_popcnt_wrapper, uint32_t(1774));
+}
+
+TEST(RunCallWord64Popcnt) {
+ BufferedRawMachineAssemblerTester<uint32_t> m;
+ ExternalReference ref = ExternalReference::wasm_word64_popcnt(m.isolate());
+ TestExternalReference(&m, ref, wasm::word64_popcnt_wrapper, uint64_t(1774));
+}
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/wasm/wasm-external-refs.cc ('k') | test/cctest/wasm/test-run-wasm-64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698