diff options
author | Alon Zakai <azakai@google.com> | 2019-05-02 14:17:49 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-02 14:17:49 -0700 |
commit | 29e7e4483dc04ca8e882f12871c7eb395c82de00 (patch) | |
tree | 40b968dfef03b6cb4b877850bce1c2507e2bc8df /test/wasm2js/float-ops.2asm.js.opt | |
parent | b394fcc887dbb2e02b5ff5b307004e4dc7ec2baf (diff) | |
download | binaryen-29e7e4483dc04ca8e882f12871c7eb395c82de00.tar.gz binaryen-29e7e4483dc04ca8e882f12871c7eb395c82de00.tar.bz2 binaryen-29e7e4483dc04ca8e882f12871c7eb395c82de00.zip |
wasm2js: ignore implicit traps (#2079)
We don't actually try to emit traps for loads, stores, invalid float to ints, etc., so when optimizing we may as well do so under the assumption those traps do not exist.
This lets us emit nice code for a select whose operands are loads, for example - otherwise, the values seem to have side effects.
Diffstat (limited to 'test/wasm2js/float-ops.2asm.js.opt')
-rw-r--r-- | test/wasm2js/float-ops.2asm.js.opt | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/test/wasm2js/float-ops.2asm.js.opt b/test/wasm2js/float-ops.2asm.js.opt index 4ef79e58a..130fe6bce 100644 --- a/test/wasm2js/float-ops.2asm.js.opt +++ b/test/wasm2js/float-ops.2asm.js.opt @@ -247,34 +247,12 @@ function asmFunc(global, env, buffer) { function $47($0) { $0 = Math_fround($0); - var $1_1 = 0, $2_1 = 0; - $2_1 = ~~$0 >>> 0; - if (Math_fround(Math_abs($0)) >= Math_fround(1.0)) { - if ($0 > Math_fround(0.0)) { - $1_1 = ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 / Math_fround(4294967296.0)))), Math_fround(4294967296.0))) >>> 0 - } else { - $1_1 = ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0 - } - } else { - $1_1 = 0 - } - return !($2_1 | $1_1) | 0; + return !(~~$0 >>> 0 | (Math_fround(Math_abs($0)) >= Math_fround(1.0) ? ($0 > Math_fround(0.0) ? ~~Math_fround(Math_min(Math_fround(Math_floor(Math_fround($0 / Math_fround(4294967296.0)))), Math_fround(4294967296.0))) >>> 0 : ~~Math_fround(Math_ceil(Math_fround(Math_fround($0 - Math_fround(~~$0 >>> 0 >>> 0)) / Math_fround(4294967296.0)))) >>> 0) : 0)) | 0; } function $48($0) { $0 = +$0; - var $1_1 = 0, $2_1 = 0; - $2_1 = ~~$0 >>> 0; - if (Math_abs($0) >= 1.0) { - if ($0 > 0.0) { - $1_1 = ~~Math_min(Math_floor($0 / 4294967296.0), 4294967295.0) >>> 0 - } else { - $1_1 = ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0 - } - } else { - $1_1 = 0 - } - return !($2_1 | $1_1) | 0; + return !(~~$0 >>> 0 | (Math_abs($0) >= 1.0 ? ($0 > 0.0 ? ~~Math_min(Math_floor($0 / 4294967296.0), 4294967295.0) >>> 0 : ~~Math_ceil(($0 - +(~~$0 >>> 0 >>> 0)) / 4294967296.0) >>> 0) : 0)) | 0; } function legalstub$43($0, $1_1) { |