diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/asm2wasm.cpp | 2 | ||||
-rw-r--r-- | src/wasm.h | 11 |
2 files changed, 8 insertions, 5 deletions
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<Convert>(); 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); |