summaryrefslogtreecommitdiff
path: root/src/passes/TrapMode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/TrapMode.cpp')
-rw-r--r--src/passes/TrapMode.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/passes/TrapMode.cpp b/src/passes/TrapMode.cpp
index f3cf3c63c..528357d4a 100644
--- a/src/passes/TrapMode.cpp
+++ b/src/passes/TrapMode.cpp
@@ -20,7 +20,6 @@
// generates a check and replaces the result with zero in that case.
//
-#include "asm_v_wasm.h"
#include "asmjs/shared-constants.h"
#include "ir/trapping.h"
#include "mixed_arena.h"
@@ -38,6 +37,18 @@ Name I64U_REM("i64u-rem");
Name I64S_DIV("i64s-div");
Name I64U_DIV("i64u-div");
+static Expression* ensureDouble(Expression* expr, MixedArena& allocator) {
+ if (expr->type == Type::f32) {
+ auto conv = allocator.alloc<Unary>();
+ conv->op = PromoteFloat32;
+ conv->value = expr;
+ conv->type = Type::f64;
+ return conv;
+ }
+ assert(expr->type == Type::f64);
+ return expr;
+}
+
Name getBinaryFuncName(Binary* curr) {
switch (curr->op) {
case RemSInt32: