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

Unified Diff: test/cctest/wasm/test-run-wasm-64.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 | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm-64.cc
diff --git a/test/cctest/wasm/test-run-wasm-64.cc b/test/cctest/wasm/test-run-wasm-64.cc
index 79ed38645b5071b163e7290ff304b19f82016e4d..6f879641e69c80232f23ed49a7476dac56a611d2 100644
--- a/test/cctest/wasm/test-run-wasm-64.cc
+++ b/test/cctest/wasm/test-run-wasm-64.cc
@@ -442,9 +442,64 @@ TEST(Run_Wasm_F64UConvertI64) {
}
}
// kExprI64SConvertF32:
+
+TEST(Run_Wasm_I64SConvertF32) {
+ WasmRunner<int64_t> r(MachineType::Float32());
+ BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
+
+ FOR_FLOAT32_INPUTS(i) {
+ if (*i < static_cast<float>(std::numeric_limits<int64_t>::max()) &&
+ *i >= static_cast<float>(std::numeric_limits<int64_t>::min())) {
+ CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i));
+ } else {
+ CHECK_TRAP64(r.Call(*i));
+ }
+ }
+}
// kExprI64SConvertF64:
+TEST(Run_Wasm_I64SConvertF64) {
+ WasmRunner<int64_t> r(MachineType::Float64());
+ BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
+
+ FOR_FLOAT64_INPUTS(i) {
+ if (*i < static_cast<double>(std::numeric_limits<int64_t>::max()) &&
+ *i >= static_cast<double>(std::numeric_limits<int64_t>::min())) {
+ CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i));
+ } else {
+ CHECK_TRAP64(r.Call(*i));
+ }
+ }
+}
+
// kExprI64UConvertF32:
+TEST(Run_Wasm_I64UConvertF32) {
+ WasmRunner<uint64_t> r(MachineType::Float32());
+ BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
+
+ FOR_FLOAT32_INPUTS(i) {
+ if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
+ *i > -1) {
+ CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i));
+ } else {
+ CHECK_TRAP64(r.Call(*i));
+ }
+ }
+}
+
// kExprI64UConvertF64:
+TEST(Run_Wasm_I64UConvertF64) {
+ WasmRunner<uint64_t> r(MachineType::Float64());
+ BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
+
+ FOR_FLOAT64_INPUTS(i) {
+ if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
+ *i > -1) {
+ CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i));
+ } else {
+ CHECK_TRAP64(r.Call(*i));
+ }
+ }
+}
TEST(Run_WasmCallI64Parameter) {
// Build the target function.
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698