summaryrefslogtreecommitdiff
path: root/src/asmjs/asm_v_wasm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/asmjs/asm_v_wasm.cpp')
-rw-r--r--src/asmjs/asm_v_wasm.cpp12
1 files changed, 12 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