summaryrefslogtreecommitdiff
path: root/src/asmjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/asmjs')
-rw-r--r--src/asmjs/asm_v_wasm.cpp12
-rw-r--r--src/asmjs/shared-constants.cpp6
-rw-r--r--src/asmjs/shared-constants.h6
3 files changed, 24 insertions, 0 deletions
diff --git a/src/asmjs/asm_v_wasm.cpp b/src/asmjs/asm_v_wasm.cpp
index ae7d320ca..bfb04a9fd 100644
--- a/src/asmjs/asm_v_wasm.cpp
+++ b/src/asmjs/asm_v_wasm.cpp
@@ -109,4 +109,16 @@ FunctionType* ensureFunctionType(std::string sig, Module* wasm) {
return type;
}
+Expression* ensureDouble(Expression* expr, MixedArena& allocator) {
+ if (expr->type == f32) {
+ auto conv = allocator.alloc<Unary>();
+ conv->op = PromoteFloat32;
+ conv->value = expr;
+ conv->type = WasmType::f64;
+ return conv;
+ }
+ assert(expr->type == f64);
+ return expr;
+}
+
} // namespace wasm
diff --git a/src/asmjs/shared-constants.cpp b/src/asmjs/shared-constants.cpp
index 43c3d1065..f62be6168 100644
--- a/src/asmjs/shared-constants.cpp
+++ b/src/asmjs/shared-constants.cpp
@@ -42,7 +42,13 @@ cashew::IString GLOBAL("global"),
ASM2WASM("asm2wasm"),
F64_REM("f64-rem"),
F64_TO_INT("f64-to-int"),
+ F64_TO_UINT("f64-to-uint"),
F64_TO_INT64("f64-to-int64"),
+ F64_TO_UINT64("f64-to-uint64"),
+ F32_TO_INT("f32-to-int"),
+ F32_TO_UINT("f32-to-uint"),
+ F32_TO_INT64("f32-to-int64"),
+ F32_TO_UINT64("f32-to-uint64"),
I32S_DIV("i32s-div"),
I32U_DIV("i32u-div"),
I32S_REM("i32s-rem"),
diff --git a/src/asmjs/shared-constants.h b/src/asmjs/shared-constants.h
index ce5cd95a6..7e4b27c85 100644
--- a/src/asmjs/shared-constants.h
+++ b/src/asmjs/shared-constants.h
@@ -45,7 +45,13 @@ extern cashew::IString GLOBAL,
ASM2WASM,
F64_REM,
F64_TO_INT,
+ F64_TO_UINT,
F64_TO_INT64,
+ F64_TO_UINT64,
+ F32_TO_INT,
+ F32_TO_UINT,
+ F32_TO_INT64,
+ F32_TO_UINT64,
I32S_DIV,
I32U_DIV,
I32S_REM,