diff options
author | Alon Zakai <azakai@google.com> | 2019-05-10 10:23:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-10 10:23:58 -0700 |
commit | d216f8742ba0663fffb035c577a5449bbc8a33a2 (patch) | |
tree | d01bc76ad836d0874e22f27fde6df8aff4ff06d8 /test/wasm2js/i64-lowering.2asm.js.opt | |
parent | bdfdbfbbac4a0f47d8b789167697d6dd70a39720 (diff) | |
download | binaryen-d216f8742ba0663fffb035c577a5449bbc8a33a2.tar.gz binaryen-d216f8742ba0663fffb035c577a5449bbc8a33a2.tar.bz2 binaryen-d216f8742ba0663fffb035c577a5449bbc8a33a2.zip |
wasm2js: avoid reinterprets (#2094)
In JS a reinterpret is especially expensive, as we implement it as a write to a temp buffer and a read using another view. This finds places where we load a value from memory, then reinterpret it later - in that case, we can load it using another view, at the cost of another load and another local.
This is helpful on things like Box2D, where there are many reinterprets due to the main 2D vector class being an union over two floats/ints, and LLVM likes to do a single i64 load of them.
Diffstat (limited to 'test/wasm2js/i64-lowering.2asm.js.opt')
-rw-r--r-- | test/wasm2js/i64-lowering.2asm.js.opt | 160 |
1 files changed, 72 insertions, 88 deletions
diff --git a/test/wasm2js/i64-lowering.2asm.js.opt b/test/wasm2js/i64-lowering.2asm.js.opt index 99d9885ae..e948447ce 100644 --- a/test/wasm2js/i64-lowering.2asm.js.opt +++ b/test/wasm2js/i64-lowering.2asm.js.opt @@ -61,151 +61,135 @@ function asmFunc(global, env, buffer) { } function legalstub$3($0, $1, $2, $3_1) { - var $4_1 = 0, $5_1 = 0, $6_1 = 0, $7 = 0, $8 = 0; - $6_1 = $0; - $5_1 = 32; - $0 = $5_1 & 31; - if (32 >>> 0 <= $5_1 >>> 0) { + var $4_1 = 0, $5_1 = 0; + $5_1 = $0; + $4_1 = 32; + $0 = $4_1 & 31; + if (32 >>> 0 <= $4_1 >>> 0) { $4_1 = $1 << $0; $0 = 0; } else { - $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0 | $4_1 << $0; + $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0; $0 = $1 << $0; } - $5_1 = $6_1 | $0; - $4_1 = $4_1 | $7; - $6_1 = $2; - $2 = 0; - $1 = $3_1; - $3_1 = 32; - $0 = $3_1 & 31; - if (32 >>> 0 <= $3_1 >>> 0) { - $2 = $1 << $0; + $5_1 = $5_1 | $0; + $1 = 32; + $0 = $1 & 31; + if (32 >>> 0 <= $1 >>> 0) { + $1 = $3_1 << $0; $0 = 0; } else { - $2 = (1 << $0) - 1 & $1 >>> 32 - $0 | $2 << $0; - $0 = $1 << $0; + $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0; + $0 = $3_1 << $0; } - return $3($5_1, $4_1, $6_1 | $0, $2 | $8); + return $3($5_1, $4_1, $0 | $2, $1); } function legalstub$4($0, $1, $2, $3_1) { - var $4_1 = 0, $5_1 = 0, $6_1 = 0, $7 = 0, $8 = 0; - $6_1 = $0; - $5_1 = 32; - $0 = $5_1 & 31; - if (32 >>> 0 <= $5_1 >>> 0) { + var $4_1 = 0, $5_1 = 0; + $5_1 = $0; + $4_1 = 32; + $0 = $4_1 & 31; + if (32 >>> 0 <= $4_1 >>> 0) { $4_1 = $1 << $0; $0 = 0; } else { - $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0 | $4_1 << $0; + $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0; $0 = $1 << $0; } - $5_1 = $6_1 | $0; - $4_1 = $4_1 | $7; - $6_1 = $2; - $2 = 0; - $1 = $3_1; - $3_1 = 32; - $0 = $3_1 & 31; - if (32 >>> 0 <= $3_1 >>> 0) { - $2 = $1 << $0; + $5_1 = $5_1 | $0; + $1 = 32; + $0 = $1 & 31; + if (32 >>> 0 <= $1 >>> 0) { + $1 = $3_1 << $0; $0 = 0; } else { - $2 = (1 << $0) - 1 & $1 >>> 32 - $0 | $2 << $0; - $0 = $1 << $0; + $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0; + $0 = $3_1 << $0; } - return $4($5_1, $4_1, $6_1 | $0, $2 | $8); + return $4($5_1, $4_1, $0 | $2, $1); } function legalstub$5($0, $1, $2, $3_1) { - var $4_1 = 0, $5_1 = 0, $6_1 = 0, $7 = 0, $8 = 0; - $6_1 = $0; - $5_1 = 32; - $0 = $5_1 & 31; - if (32 >>> 0 <= $5_1 >>> 0) { + var $4_1 = 0, $5_1 = 0; + $5_1 = $0; + $4_1 = 32; + $0 = $4_1 & 31; + if (32 >>> 0 <= $4_1 >>> 0) { $4_1 = $1 << $0; $0 = 0; } else { - $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0 | $4_1 << $0; + $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0; $0 = $1 << $0; } - $5_1 = $6_1 | $0; - $4_1 = $4_1 | $7; - $6_1 = $2; - $2 = 0; - $1 = $3_1; - $3_1 = 32; - $0 = $3_1 & 31; - if (32 >>> 0 <= $3_1 >>> 0) { - $2 = $1 << $0; + $5_1 = $5_1 | $0; + $1 = 32; + $0 = $1 & 31; + if (32 >>> 0 <= $1 >>> 0) { + $1 = $3_1 << $0; $0 = 0; } else { - $2 = (1 << $0) - 1 & $1 >>> 32 - $0 | $2 << $0; - $0 = $1 << $0; + $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0; + $0 = $3_1 << $0; } - return $5($5_1, $4_1, $6_1 | $0, $2 | $8); + return $5($5_1, $4_1, $0 | $2, $1); } function legalstub$6($0, $1, $2, $3_1) { - var $4_1 = 0, $5_1 = 0, $6_1 = 0, $7 = 0, $8 = 0; - $6_1 = $0; - $5_1 = 32; - $0 = $5_1 & 31; - if (32 >>> 0 <= $5_1 >>> 0) { + var $4_1 = 0, $5_1 = 0; + $5_1 = $0; + $4_1 = 32; + $0 = $4_1 & 31; + if (32 >>> 0 <= $4_1 >>> 0) { $4_1 = $1 << $0; $0 = 0; } else { - $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0 | $4_1 << $0; + $4_1 = (1 << $0) - 1 & $1 >>> 32 - $0; $0 = $1 << $0; } - $5_1 = $6_1 | $0; - $4_1 = $4_1 | $7; - $6_1 = $2; - $2 = 0; - $1 = $3_1; - $3_1 = 32; - $0 = $3_1 & 31; - if (32 >>> 0 <= $3_1 >>> 0) { - $2 = $1 << $0; + $5_1 = $5_1 | $0; + $1 = 32; + $0 = $1 & 31; + if (32 >>> 0 <= $1 >>> 0) { + $1 = $3_1 << $0; $0 = 0; } else { - $2 = (1 << $0) - 1 & $1 >>> 32 - $0 | $2 << $0; - $0 = $1 << $0; + $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0; + $0 = $3_1 << $0; } - return $6($5_1, $4_1, $6_1 | $0, $2 | $8); + return $6($5_1, $4_1, $0 | $2, $1); } function legalstub$7($0, $1, $2, $3_1) { var $4_1 = 0; - $4_1 = $2; - $2 = $3_1; - $3_1 = $4_1 | 0; - return ($1 | 0) == ($2 | 0) & $0 >>> 0 >= $3_1 >>> 0 | $1 >>> 0 > $2 >>> 0; + $4_1 = $0; + $0 = $1; + $1 = $3_1; + return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 >= $2 >>> 0 | $0 >>> 0 > $1 >>> 0; } function legalstub$8($0, $1, $2, $3_1) { var $4_1 = 0; - $4_1 = $2; - $2 = $3_1; - $3_1 = $4_1 | 0; - return ($1 | 0) == ($2 | 0) & $0 >>> 0 > $3_1 >>> 0 | $1 >>> 0 > $2 >>> 0; + $4_1 = $0; + $0 = $1; + $1 = $3_1; + return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 > $2 >>> 0 | $0 >>> 0 > $1 >>> 0; } function legalstub$9($0, $1, $2, $3_1) { var $4_1 = 0; - $4_1 = $2; - $2 = $3_1; - $3_1 = $4_1 | 0; - return ($1 | 0) == ($2 | 0) & $0 >>> 0 <= $3_1 >>> 0 | $1 >>> 0 < $2 >>> 0; + $4_1 = $0; + $0 = $1; + $1 = $3_1; + return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 <= $2 >>> 0 | $0 >>> 0 < $1 >>> 0; } function legalstub$10($0, $1, $2, $3_1) { var $4_1 = 0; - $4_1 = $2; - $2 = $3_1; - $3_1 = $4_1 | 0; - return ($1 | 0) == ($2 | 0) & $0 >>> 0 < $3_1 >>> 0 | $1 >>> 0 < $2 >>> 0; + $4_1 = $0; + $0 = $1; + $1 = $3_1; + return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 < $2 >>> 0 | $0 >>> 0 < $1 >>> 0; } var FUNCTION_TABLE = []; |