diff options
author | Alon Zakai <azakai@google.com> | 2021-03-29 11:33:52 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 11:33:52 -0700 |
commit | 1a6efdb4233a077bc6e5e8a340baf5672bb5bced (patch) | |
tree | f814f47930fe8a2312cd23848ea63ff7e13bb9dc /test/wasm2js/i64-rotate.2asm.js.opt | |
parent | 9c1d69f6596b76fe83bff17709b92f8cc2054a31 (diff) | |
download | binaryen-1a6efdb4233a077bc6e5e8a340baf5672bb5bced.tar.gz binaryen-1a6efdb4233a077bc6e5e8a340baf5672bb5bced.tar.bz2 binaryen-1a6efdb4233a077bc6e5e8a340baf5672bb5bced.zip |
Inlining: Always inline single-use functions (#3730)
This implements emscripten-core/emscripten#13744
Inlining functions with a single use allows us to remove the function afterward.
That looks highly beneficial, shrinking every single benchmark in emscripten's
benchmark suite, by an average of 2% on the macrobenchmarks and 3.5% on
all of them. Speed also improves, although mostly on the microbenchmarks so
that might be less realistic.
There may be a slight downside to startup time due to emitting larger functions,
but given the baseline compilers in VMs these days it seems worth it, as the
delay would be just to get to the upper tier. On the benchmark suite the risk
seems low.
See more details in the PR above.
Diffstat (limited to 'test/wasm2js/i64-rotate.2asm.js.opt')
-rw-r--r-- | test/wasm2js/i64-rotate.2asm.js.opt | 148 |
1 files changed, 72 insertions, 76 deletions
diff --git a/test/wasm2js/i64-rotate.2asm.js.opt b/test/wasm2js/i64-rotate.2asm.js.opt index b74f97053..ecffd160a 100644 --- a/test/wasm2js/i64-rotate.2asm.js.opt +++ b/test/wasm2js/i64-rotate.2asm.js.opt @@ -15,104 +15,100 @@ function asmFunc(env) { var infinity = Infinity; var i64toi32_i32$HIGH_BITS = 0; function legalstub$1($0, $1, $2, $3, $4, $5) { - return (__wasm_rotl_i64($0, $1, $2) | 0) == ($4 | 0) & ($5 | 0) == (i64toi32_i32$HIGH_BITS | 0); - } - - function legalstub$2($0, $1, $2, $3, $4, $5) { - return (__wasm_rotr_i64($0, $1, $2) | 0) == ($4 | 0) & ($5 | 0) == (i64toi32_i32$HIGH_BITS | 0); - } - - function __wasm_rotl_i64($0, $1, $2) { - var $3 = 0, $4 = 0, $5 = 0, $6 = 0; - $6 = $2 & 63; - $5 = $6; - $3 = $5 & 31; - if ($5 >>> 0 >= 32) { - $3 = -1 >>> $3 | 0 + var $6 = 0, $7 = 0, $8 = 0; + $3 = $0; + $8 = $2 & 63; + $6 = $8; + $0 = $6 & 31; + if ($6 >>> 0 >= 32) { + $0 = -1 >>> $0 | 0 } else { - $4 = -1 >>> $3 | 0; - $3 = (1 << $3) - 1 << 32 - $3 | -1 >>> $3; + $7 = -1 >>> $0 | 0; + $0 = (1 << $0) - 1 << 32 - $0 | -1 >>> $0; } - $5 = $3 & $0; - $3 = $1 & $4; - $4 = $6 & 31; - if ($6 >>> 0 >= 32) { - $3 = $5 << $4; - $6 = 0; + $6 = $0 & $3; + $0 = $1 & $7; + $7 = $8 & 31; + if ($8 >>> 0 >= 32) { + $0 = $6 << $7; + $8 = 0; } else { - $3 = (1 << $4) - 1 & $5 >>> 32 - $4 | $3 << $4; - $6 = $5 << $4; + $0 = (1 << $7) - 1 & $6 >>> 32 - $7 | $0 << $7; + $8 = $6 << $7; } - $5 = $3; - $4 = 0 - $2 & 63; - $3 = $4; - $2 = $3 & 31; - if ($3 >>> 0 >= 32) { - $3 = -1 << $2; + $7 = $0; + $6 = 0 - $2 & 63; + $0 = $6; + $2 = $0 & 31; + if ($0 >>> 0 >= 32) { + $0 = -1 << $2; $2 = 0; } else { - $3 = (1 << $2) - 1 & -1 >>> 32 - $2 | -1 << $2; + $0 = (1 << $2) - 1 & -1 >>> 32 - $2 | -1 << $2; $2 = -1 << $2; } - $0 = $2 & $0; - $3 = $1 & $3; - $1 = $4 & 31; - if ($4 >>> 0 >= 32) { + $3 = $2 & $3; + $1 = $0 & $1; + $0 = $6 & 31; + if ($6 >>> 0 >= 32) { $2 = 0; - $0 = $3 >>> $1 | 0; + $0 = $1 >>> $0 | 0; } else { - $2 = $3 >>> $1 | 0; - $0 = ((1 << $1) - 1 & $3) << 32 - $1 | $0 >>> $1; + $2 = $1 >>> $0 | 0; + $0 = ((1 << $0) - 1 & $1) << 32 - $0 | $3 >>> $0; } - $0 = $0 | $6; - i64toi32_i32$HIGH_BITS = $2 | $5; - return $0; + $0 = $0 | $8; + i64toi32_i32$HIGH_BITS = $2 | $7; + return ($0 | 0) == ($4 | 0) & ($5 | 0) == (i64toi32_i32$HIGH_BITS | 0); } - function __wasm_rotr_i64($0, $1, $2) { - var $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0; - $6 = $2 & 63; - $3 = $6 & 31; - if ($6 >>> 0 >= 32) { - $4 = -1 << $3; - $7 = 0; + function legalstub$2($0, $1, $2, $3, $4, $5) { + var $6 = 0, $7 = 0, $8 = 0, $9 = 0; + $3 = $0; + $8 = $2 & 63; + $0 = $8; + $6 = $0 & 31; + if ($0 >>> 0 >= 32) { + $0 = -1 << $6; + $6 = 0; } else { - $4 = (1 << $3) - 1 & -1 >>> 32 - $3 | -1 << $3; - $7 = -1 << $3; + $0 = (1 << $6) - 1 & -1 >>> 32 - $6 | -1 << $6; + $6 = -1 << $6; } - $7 = $7 & $0; - $3 = $1 & $4; - $5 = $6 & 31; - if ($6 >>> 0 >= 32) { - $4 = 0; - $6 = $3 >>> $5 | 0; + $9 = $6 & $3; + $7 = $0 & $1; + $6 = $8 & 31; + if ($8 >>> 0 >= 32) { + $0 = 0; + $8 = $7 >>> $6 | 0; } else { - $4 = $3 >>> $5 | 0; - $6 = ((1 << $5) - 1 & $3) << 32 - $5 | $7 >>> $5; + $0 = $7 >>> $6 | 0; + $8 = ((1 << $6) - 1 & $7) << 32 - $6 | $9 >>> $6; } - $7 = $4; - $3 = 0 - $2 & 63; - $5 = $3 & 31; - if ($3 >>> 0 >= 32) { - $4 = 0; - $2 = -1 >>> $5 | 0; + $6 = $0; + $7 = 0 - $2 & 63; + $0 = $7; + $2 = $0 & 31; + if ($0 >>> 0 >= 32) { + $0 = 0; + $2 = -1 >>> $2 | 0; } else { - $4 = -1 >>> $5 | 0; - $2 = (1 << $5) - 1 << 32 - $5 | -1 >>> $5; + $0 = -1 >>> $2 | 0; + $2 = (1 << $2) - 1 << 32 - $2 | -1 >>> $2; } - $0 = $2 & $0; - $1 = $1 & $4; - $4 = $3 & 31; - if ($3 >>> 0 >= 32) { - $2 = $0 << $4; + $2 = $2 & $3; + $1 = $0 & $1; + $0 = $7 & 31; + if ($7 >>> 0 >= 32) { + $1 = $2 << $0; $0 = 0; } else { - $2 = (1 << $4) - 1 & $0 >>> 32 - $4 | $1 << $4; - $0 = $0 << $4; + $1 = (1 << $0) - 1 & $2 >>> 32 - $0 | $1 << $0; + $0 = $2 << $0; } - $0 = $0 | $6; - i64toi32_i32$HIGH_BITS = $2 | $7; - return $0; + $0 = $0 | $8; + i64toi32_i32$HIGH_BITS = $1 | $6; + return ($0 | 0) == ($4 | 0) & ($5 | 0) == (i64toi32_i32$HIGH_BITS | 0); } return { |