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

Unified Diff: test/cctest/compiler/test-run-calls-to-external-references.cc

Issue 1775903002: [wasm] Int64Lowering of I64XConvertFXX instructions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 years, 9 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/wasm/test-run-wasm.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 e701e62c195d1ec30da8eeefbea93fce179d1fbc..2444045e9a49aa8c67f58ecee91e1a47aa9c9a92 100644
--- a/test/cctest/compiler/test-run-calls-to-external-references.cc
+++ b/test/cctest/compiler/test-run-calls-to-external-references.cc
@@ -331,6 +331,99 @@ TEST(RunCallUint64ToFloat64) {
}
}
+TEST(RunCallFloat32ToInt64) {
+ BufferedRawMachineAssemblerTester<int32_t> m;
+ ExternalReference ref = ExternalReference::wasm_float32_to_int64(m.isolate());
+
+ float input;
+ int64_t output;
+
+ Node* function = m.ExternalConstant(ref);
+ m.Return(m.CallCFunction2(
+ MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
+ function, m.PointerConstant(&input), m.PointerConstant(&output)));
+ FOR_FLOAT32_INPUTS(i) {
+ input = *i;
+ if (*i >= static_cast<float>(std::numeric_limits<int64_t>::min()) &&
+ *i < static_cast<float>(std::numeric_limits<int64_t>::max())) {
+ CHECK_EQ(1, m.Call());
+ CHECK_EQ(static_cast<int64_t>(*i), output);
+ } else {
+ CHECK_EQ(0, m.Call());
+ }
+ }
+}
+
+TEST(RunCallFloat32ToUint64) {
+ BufferedRawMachineAssemblerTester<int32_t> m;
+ ExternalReference ref =
+ ExternalReference::wasm_float32_to_uint64(m.isolate());
+
+ float input;
+ uint64_t output;
+
+ Node* function = m.ExternalConstant(ref);
+ m.Return(m.CallCFunction2(
+ MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
+ function, m.PointerConstant(&input), m.PointerConstant(&output)));
+ FOR_FLOAT32_INPUTS(i) {
+ input = *i;
+ if (*i > -1.0 &&
+ *i < static_cast<float>(std::numeric_limits<uint64_t>::max())) {
+ CHECK_EQ(1, m.Call());
+ CHECK_EQ(static_cast<uint64_t>(*i), output);
+ } else {
+ CHECK_EQ(0, m.Call());
+ }
+ }
+}
+
+TEST(RunCallFloat64ToInt64) {
+ BufferedRawMachineAssemblerTester<int32_t> m;
+ ExternalReference ref = ExternalReference::wasm_float64_to_int64(m.isolate());
+
+ double input;
+ int64_t output;
+
+ Node* function = m.ExternalConstant(ref);
+ m.Return(m.CallCFunction2(
+ MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
+ function, m.PointerConstant(&input), m.PointerConstant(&output)));
+ FOR_FLOAT64_INPUTS(i) {
+ input = *i;
+ if (*i >= static_cast<double>(std::numeric_limits<int64_t>::min()) &&
+ *i < static_cast<double>(std::numeric_limits<int64_t>::max())) {
+ CHECK_EQ(1, m.Call());
+ CHECK_EQ(static_cast<int64_t>(*i), output);
+ } else {
+ CHECK_EQ(0, m.Call());
+ }
+ }
+}
+
+TEST(RunCallFloat64ToUint64) {
+ BufferedRawMachineAssemblerTester<int32_t> m;
+ ExternalReference ref =
+ ExternalReference::wasm_float64_to_uint64(m.isolate());
+
+ double input;
+ uint64_t output;
+
+ Node* function = m.ExternalConstant(ref);
+ m.Return(m.CallCFunction2(
+ MachineType::Int32(), MachineType::Pointer(), MachineType::Pointer(),
+ function, m.PointerConstant(&input), m.PointerConstant(&output)));
+ FOR_FLOAT64_INPUTS(i) {
+ input = *i;
+ if (*i > -1.0 &&
+ *i < static_cast<double>(std::numeric_limits<uint64_t>::max())) {
+ CHECK_EQ(1, m.Call());
+ CHECK_EQ(static_cast<uint64_t>(*i), output);
+ } else {
+ CHECK_EQ(0, m.Call());
+ }
+ }
+}
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/wasm/wasm-external-refs.h ('k') | test/cctest/wasm/test-run-wasm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698