From 3c5a2de669542caebd7ef001db6678b70375f0b5 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 16 May 2018 18:40:45 -0500 Subject: wasm2asm: Implement float<->int conversions (#1550) This commit lifts the same conversion strategy that `emcc` takes to convert between floats point numbers and integers, and it should implement all the various matrices of i32/u32/i64/u64 to f32/f64 Some refactoring was performed in the i64->i32 pass to allow for temporary variables to get allocated which have types other than i32, but otherwise this contains a pretty direct translation of `emcc`'s operations to `wasm2asm`. --- src/tools/wasm2asm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/tools/wasm2asm.cpp') diff --git a/src/tools/wasm2asm.cpp b/src/tools/wasm2asm.cpp index cc53dc834..2251a332c 100644 --- a/src/tools/wasm2asm.cpp +++ b/src/tools/wasm2asm.cpp @@ -39,7 +39,8 @@ int main(int argc, const char *argv[]) { }) .add("--allow-asserts", "", "Allow compilation of .wast testing asserts", Options::Arguments::Zero, - [](Options* o, const std::string& argument) { + [&](Options* o, const std::string& argument) { + builderFlags.allowAsserts = true; o->extra["asserts"] = "1"; }) .add("--pedantic", "", "Emulate WebAssembly trapping behavior", -- cgit v1.2.3