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

Unified Diff: test/cctest/wasm/test-run-wasm-asmjs.cc

Issue 1971693002: [wasm] Introduce custom asm.js bytecodes for double->int conversions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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-opcodes.h ('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-asmjs.cc
diff --git a/test/cctest/wasm/test-run-wasm-asmjs.cc b/test/cctest/wasm/test-run-wasm-asmjs.cc
index c8fb32cff527d6fbdda8c99cb62fe0c0a08f5904..e948d3524887870a786c74515c31c73f5b538707 100644
--- a/test/cctest/wasm/test-run-wasm-asmjs.cc
+++ b/test/cctest/wasm/test-run-wasm-asmjs.cc
@@ -70,6 +70,46 @@ TEST(Run_WASM_Int32AsmjsRemU) {
CHECK_EQ(kMin, r.Call(kMin, -1));
}
+TEST(Run_Wasm_I32AsmjsSConvertF32) {
+ WasmRunner<int32_t> r(MachineType::Float32());
+ BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0)));
+
+ FOR_FLOAT32_INPUTS(i) {
+ int32_t expected = DoubleToInt32(*i);
+ CHECK_EQ(expected, r.Call(*i));
+ }
+}
+
+TEST(Run_Wasm_I32AsmjsSConvertF64) {
+ WasmRunner<int32_t> r(MachineType::Float64());
+ BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0)));
+
+ FOR_FLOAT64_INPUTS(i) {
+ int32_t expected = DoubleToInt32(*i);
+ CHECK_EQ(expected, r.Call(*i));
+ }
+}
+
+TEST(Run_Wasm_I32AsmjsUConvertF32) {
+ WasmRunner<uint32_t> r(MachineType::Float32());
+ BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0)));
+
+ FOR_FLOAT32_INPUTS(i) {
+ uint32_t expected = DoubleToUint32(*i);
+ CHECK_EQ(expected, r.Call(*i));
+ }
+}
+
+TEST(Run_Wasm_I32AsmjsUConvertF64) {
+ WasmRunner<uint32_t> r(MachineType::Float64());
+ BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0)));
+
+ FOR_FLOAT64_INPUTS(i) {
+ uint32_t expected = DoubleToUint32(*i);
+ CHECK_EQ(expected, r.Call(*i));
+ }
+}
+
TEST(Run_Wasm_LoadMemI32_oob_asm) {
TestingModule module;
module.origin = kAsmJsOrigin;
« no previous file with comments | « src/wasm/wasm-opcodes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698