From d93c05bfa9a7fc813c31c7972e6680d6ef0277d2 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 29 Oct 2015 17:26:23 -0700 Subject: fix Convert --- src/asm2wasm.cpp | 2 +- src/wasm.h | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/asm2wasm.cpp b/src/asm2wasm.cpp index 28ff7d563..ef43a6ac2 100644 --- a/src/asm2wasm.cpp +++ b/src/asm2wasm.cpp @@ -821,7 +821,7 @@ Function* Asm2WasmModule::processFunction(Ref ast) { auto ret = allocator.alloc(); ret->op = isUnsignedCoercion(ast[2]) ? ConvertUInt32 : ConvertSInt32; ret->value = process(ast[2]); - ret->type = BasicType::i32; + ret->type = BasicType::f64; return ret; } assert(childType == ASM_NONE); // e.g. a coercion on a call diff --git a/src/wasm.h b/src/wasm.h index 6aa568210..a5210e4d6 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -654,13 +654,16 @@ public: Expression *value; std::ostream& print(std::ostream &o, unsigned indent) override { - printOpening(o, "convert "); + o << '('; + prepareColor(o); + printBasicType(o, type) << ".convert_"; switch (op) { - case ConvertUInt32: o << "uint32toDouble"; break; - case ConvertSInt32: o << "sint32toDouble"; break; - case TruncSFloat64: o << "float64tosint32"; break; + case ConvertUInt32: o << "u/i32"; break; + case ConvertSInt32: o << "s/i32"; break; + case TruncSFloat64: o << "s/f64"; break; default: abort(); } + restoreNormalColor(o); incIndent(o, indent); printFullLine(o, indent, value); decIndent(o, indent); -- cgit v1.2.3