diff options
-rw-r--r-- | src/asm2wasm.cpp | 2 | ||||
-rw-r--r-- | src/wasm.h | 11 | ||||
-rw-r--r-- | test/emcc_hello_world.wast | 4 |
3 files changed, 10 insertions, 7 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); diff --git a/test/emcc_hello_world.wast b/test/emcc_hello_world.wast index 410a3b2b5..2a5fe5699 100644 --- a/test/emcc_hello_world.wast +++ b/test/emcc_hello_world.wast @@ -426,7 +426,7 @@ ) (nop) (break $topmost - (convert sint32toDouble + (f64.convert_s/i32 (get_local $$retval$0) ) ) @@ -449,7 +449,7 @@ ) ) (break $topmost - (convert sint32toDouble + (f64.convert_s/i32 (get_local $$call) ) ) |