diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-12-05 13:13:55 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-12-05 13:13:55 -0800 |
commit | 05684cead0dfa8c553d1bed38a5b8746b45e0dec (patch) | |
tree | e7dde0f85d91babe4279e2dd0afec31e36ad500a | |
parent | 41ff4225d80f881f42fd9daf8cc7d5ba804238f2 (diff) | |
download | binaryen-05684cead0dfa8c553d1bed38a5b8746b45e0dec.tar.gz binaryen-05684cead0dfa8c553d1bed38a5b8746b45e0dec.tar.bz2 binaryen-05684cead0dfa8c553d1bed38a5b8746b45e0dec.zip |
fix asm doubles in wasm2asm
-rw-r--r-- | src/wasm2asm.h | 2 | ||||
-rw-r--r-- | test/unit.2asm.js | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/wasm2asm.h b/src/wasm2asm.h index 5003dee7f..2b7d6a455 100644 --- a/src/wasm2asm.h +++ b/src/wasm2asm.h @@ -679,7 +679,7 @@ Ref Wasm2AsmBuilder::processFunctionBody(Expression* curr, IString result) { ret[2]->push_back(ValueBuilder::makeDouble(curr->value.f32)); return ret; } - case f64: return ValueBuilder::makeDouble(curr->value.f64); + case f64: return ValueBuilder::makeUnary(PLUS, ValueBuilder::makeDouble(curr->value.f64)); default: abort(); } } diff --git a/test/unit.2asm.js b/test/unit.2asm.js index c82fd38a5..e85255c64 100644 --- a/test/unit.2asm.js +++ b/test/unit.2asm.js @@ -2,9 +2,9 @@ function asmFunc() { function big_negative() { var temp = 0.0; { - temp = -2147483648; - temp = -2147483648; - temp = -21474836480; + temp = -2147483648.0; + temp = -2147483648.0; + temp = -21474836480.0; temp = .039625; temp = -.039625; } @@ -18,7 +18,7 @@ function asmFunc() { wasm2asm$noresult = -3.4; break topmost; }; - if (HEAPF64[32 >> 3] > 0 | 0) { + if (HEAPF64[32 >> 3] > 0.0 | 0) { wasm2asm$noresult = 5.6; break topmost; }; @@ -32,11 +32,11 @@ function asmFunc() { y = +y; var t = 0.0, Int = 0.0, Double = 0, wasm2asm_f64$0 = 0.0; topmost : { - if (x > 0 | 0) { + if (x > 0.0 | 0) { wasm2asm$noresult = 1.2; break topmost; }; - if (Int > 0 | 0) { + if (Int > 0.0 | 0) { wasm2asm$noresult = -3.4; break topmost; }; @@ -126,7 +126,7 @@ function asmFunc() { } function negZero() { - return 0; + return 0.0; } function abs() { @@ -137,7 +137,7 @@ function asmFunc() { wasm2asm_i32$0 = (wasm2asm_i32$1 = asm2wasm_i32_temp < 0 | 0, wasm2asm_i32$2 = 0 - asm2wasm_i32_temp | 0, wasm2asm_i32$3 = asm2wasm_i32_temp, wasm2asm_i32$1 ? wasm2asm_i32$2 : wasm2asm_i32$3); x = wasm2asm_i32$0; } - y = Math_abs(0); + y = Math_abs(0.0); z = Math_fround(Math_abs(Math_fround(0))); } } |