diff options
-rw-r--r-- | src/passes/Precompute.cpp | 4 | ||||
-rw-r--r-- | test/passes/precompute-propagate.txt | 13 | ||||
-rw-r--r-- | test/passes/precompute-propagate.wast | 16 | ||||
-rw-r--r-- | test/wasm2js/conversions-modified.2asm.js.opt | 22 | ||||
-rw-r--r-- | test/wasm2js/float-ops.2asm.js.opt | 4 | ||||
-rw-r--r-- | test/wasm2js/get-set-local.2asm.js.opt | 6 | ||||
-rw-r--r-- | test/wasm2js/i64-add-sub.2asm.js.opt | 41 | ||||
-rw-r--r-- | test/wasm2js/i64-ctz.2asm.js.opt | 34 | ||||
-rw-r--r-- | test/wasm2js/i64-lowering.2asm.js.opt | 116 | ||||
-rw-r--r-- | test/wasm2js/i64-shifts.2asm.js.opt | 62 | ||||
-rw-r--r-- | test/wasm2js/reinterpret.2asm.js.opt | 13 | ||||
-rw-r--r-- | test/wasm2js/stack-modified.2asm.js.opt | 60 | ||||
-rw-r--r-- | test/wasm2js/unaligned.2asm.js.opt | 11 | ||||
-rw-r--r-- | test/wasm2js/unary-ops.2asm.js.opt | 63 |
14 files changed, 107 insertions, 358 deletions
diff --git a/src/passes/Precompute.cpp b/src/passes/Precompute.cpp index 02fd089ec..d5cfdc968 100644 --- a/src/passes/Precompute.cpp +++ b/src/passes/Precompute.cpp @@ -30,6 +30,7 @@ #include <ir/literal-utils.h> #include <ir/local-graph.h> #include <ir/manipulation.h> +#include <ir/properties.h> #include <ir/utils.h> #include <pass.h> #include <wasm-builder.h> @@ -308,7 +309,8 @@ private: if (setValues[set].isConcrete()) { continue; // already known constant } - auto value = setValues[set] = precomputeValue(set->value); + auto value = setValues[set] = + precomputeValue(Properties::getFallthrough(set->value)); if (value.isConcrete()) { for (auto* get : localGraph.setInfluences[set]) { work.insert(get); diff --git a/test/passes/precompute-propagate.txt b/test/passes/precompute-propagate.txt index 6ebd7bd5b..0db40489f 100644 --- a/test/passes/precompute-propagate.txt +++ b/test/passes/precompute-propagate.txt @@ -241,4 +241,17 @@ (nop) (local.get $2) ) + (func $through-fallthrough (; 16 ;) (type $2) (param $x i32) (param $y i32) (result i32) + (local.set $x + (block $block (result i32) + (nop) + (local.tee $y + (i32.const 7) + ) + ) + ) + (return + (i32.const 14) + ) + ) ) diff --git a/test/passes/precompute-propagate.wast b/test/passes/precompute-propagate.wast index 4b7764b19..17da74085 100644 --- a/test/passes/precompute-propagate.wast +++ b/test/passes/precompute-propagate.wast @@ -154,5 +154,21 @@ ) (local.get $2) ) + (func $through-fallthrough (param $x i32) (param $y i32) (result i32) + (local.set $x + (block (result i32) + (nop) + (local.tee $y + (i32.const 7) + ) + ) + ) + (return + (i32.add + (local.get $x) + (local.get $y) + ) + ) + ) ) diff --git a/test/wasm2js/conversions-modified.2asm.js.opt b/test/wasm2js/conversions-modified.2asm.js.opt index 2b756f906..fc6b306a7 100644 --- a/test/wasm2js/conversions-modified.2asm.js.opt +++ b/test/wasm2js/conversions-modified.2asm.js.opt @@ -142,23 +142,17 @@ function asmFunc(global, env, buffer) { } function legalstub$7($0) { - var $1 = 0, $2 = 0, $3_1 = 0, $4_1 = 0; - $2 = $7($0); - $3_1 = i64toi32_i32$HIGH_BITS; - $4_1 = 32; - $1 = $4_1 & 31; - setTempRet0((32 >>> 0 <= $4_1 >>> 0 ? $3_1 >>> $1 : ((1 << $1) - 1 & $3_1) << 32 - $1 | $2 >>> $1) | 0); - return $2; + var $1 = 0; + $1 = $7($0); + setTempRet0(i64toi32_i32$HIGH_BITS | 0); + return $1; } function legalstub$9($0) { - var $1 = 0, $2 = 0, $3_1 = 0, $4_1 = 0; - $2 = $9($0); - $3_1 = i64toi32_i32$HIGH_BITS; - $4_1 = 32; - $1 = $4_1 & 31; - setTempRet0((32 >>> 0 <= $4_1 >>> 0 ? $3_1 >>> $1 : ((1 << $1) - 1 & $3_1) << 32 - $1 | $2 >>> $1) | 0); - return $2; + var $1 = 0; + $1 = $9($0); + setTempRet0(i64toi32_i32$HIGH_BITS | 0); + return $1; } function legalstub$12($0, $1) { diff --git a/test/wasm2js/float-ops.2asm.js.opt b/test/wasm2js/float-ops.2asm.js.opt index 416f144d2..cc8f90643 100644 --- a/test/wasm2js/float-ops.2asm.js.opt +++ b/test/wasm2js/float-ops.2asm.js.opt @@ -246,12 +246,12 @@ function asmFunc(global, env, buffer) { function $47($0) { $0 = Math_fround($0); - return !((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 >>> 0) | 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; - return !((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 >>> 0) | 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) { diff --git a/test/wasm2js/get-set-local.2asm.js.opt b/test/wasm2js/get-set-local.2asm.js.opt index 134da55b0..40a422604 100644 --- a/test/wasm2js/get-set-local.2asm.js.opt +++ b/test/wasm2js/get-set-local.2asm.js.opt @@ -21,11 +21,7 @@ function asmFunc(global, env, buffer) { var nan = global.NaN; var infinity = global.Infinity; function legalstub$1($0, $1, $2) { - var $3 = 0; - $3 = $1; - $1 = $2; - $2 = $3 | 0; - return !$1 & ($0 | 0) == ($2 | 0); + return !$2 & ($0 | 0) == ($1 | 0); } var FUNCTION_TABLE = []; diff --git a/test/wasm2js/i64-add-sub.2asm.js.opt b/test/wasm2js/i64-add-sub.2asm.js.opt index 3f4ba759a..9809a42e8 100644 --- a/test/wasm2js/i64-add-sub.2asm.js.opt +++ b/test/wasm2js/i64-add-sub.2asm.js.opt @@ -36,48 +36,11 @@ function asmFunc(global, env, buffer) { } function legalstub$1($0, $1_1, $2, $3, $4, $5) { - var $6 = 0, $7 = 0; - $7 = $0; - $6 = 32; - $0 = $6 & 31; - if (32 >>> 0 <= $6 >>> 0) { - $6 = $1_1 << $0; - $0 = 0; - } else { - $6 = (1 << $0) - 1 & $1_1 >>> 32 - $0; - $0 = $1_1 << $0; - } - $7 = $7 | $0; - $1_1 = 32; - $0 = $1_1 & 31; - if (32 >>> 0 <= $1_1 >>> 0) { - $1_1 = $3 << $0; - $0 = 0; - } else { - $1_1 = (1 << $0) - 1 & $3 >>> 32 - $0; - $0 = $3 << $0; - } - $3 = $0 | $2; - $2 = $1_1; - $1_1 = 32; - $0 = $1_1 & 31; - if (32 >>> 0 <= $1_1 >>> 0) { - $1_1 = $5 << $0; - $0 = 0; - } else { - $1_1 = (1 << $0) - 1 & $5 >>> 32 - $0; - $0 = $5 << $0; - } - return $1($7, $6, $3, $2, $0 | $4, $1_1); + return $1($0, $1_1, $2, $3, $4, $5); } function legalstub$2($0, $1_1, $2, $3, $4, $5) { - var $6 = 0; - $6 = $0; - $0 = $1_1; - $1_1 = $3; - $3 = $2; - return ($4 | 0) == ($6 - $3 | 0) & ($5 | 0) == ($0 - (($6 >>> 0 < $3 >>> 0) + $1_1 | 0) | 0); + return ($4 | 0) == ($0 - $2 | 0) & ($5 | 0) == ($1_1 - (($0 >>> 0 < $2 >>> 0) + $3 | 0) | 0); } var FUNCTION_TABLE = []; diff --git a/test/wasm2js/i64-ctz.2asm.js.opt b/test/wasm2js/i64-ctz.2asm.js.opt index 691f5c8dd..50930e442 100644 --- a/test/wasm2js/i64-ctz.2asm.js.opt +++ b/test/wasm2js/i64-ctz.2asm.js.opt @@ -36,21 +36,18 @@ function asmFunc(global, env, buffer) { } function __wasm_ctz_i64($0, $1) { - var $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0; + var $2 = 0, $3 = 0; if ($0 | $1) { - $4 = 63; - $6 = $4; $3 = $1 + -1 | 0; - $2 = -1; - $5 = $2 + $0 | 0; - if ($5 >>> 0 < $2 >>> 0) { + $2 = $0 + -1 | 0; + if ($2 >>> 0 < -1 >>> 0) { $3 = $3 + 1 | 0 } - $2 = Math_clz32($0 ^ $5) + 32 | 0; + $2 = Math_clz32($0 ^ $2) + 32 | 0; $0 = Math_clz32($1 ^ $3); $0 = ($0 | 0) == (32 | 0) ? $2 : $0; - $1 = $6 - $0 | 0; - i64toi32_i32$HIGH_BITS = 0 - ($4 >>> 0 < $0 >>> 0) | 0; + $1 = 63 - $0 | 0; + i64toi32_i32$HIGH_BITS = 0 - (63 >>> 0 < $0 >>> 0) | 0; return $1; } i64toi32_i32$HIGH_BITS = 0; @@ -60,24 +57,23 @@ function asmFunc(global, env, buffer) { function __wasm_popcnt_i64($0, $1) { var $2 = 0, $3 = 0, $4 = 0, $5 = 0; label$2 : while (1) { - $3 = $4; - $2 = $5; + $5 = $3; + $2 = $4; if ($0 | $1) { $2 = $0; - $3 = 1; - $0 = $2 - $3 & $2; - $1 = $1 - ($2 >>> 0 < $3 >>> 0) & $1; - $2 = 1 + $4 | 0; - if ($2 >>> 0 < $3 >>> 0) { - $5 = $5 + 1 | 0 + $0 = $2 - 1 & $2; + $1 = $1 - ($2 >>> 0 < 1 >>> 0) & $1; + $2 = $3 + 1 | 0; + if ($2 >>> 0 < 1 >>> 0) { + $4 = $4 + 1 | 0 } - $4 = $2; + $3 = $2; continue; } break; }; i64toi32_i32$HIGH_BITS = $2; - return $3; + return $5; } var FUNCTION_TABLE = []; diff --git a/test/wasm2js/i64-lowering.2asm.js.opt b/test/wasm2js/i64-lowering.2asm.js.opt index e948447ce..eef1057f8 100644 --- a/test/wasm2js/i64-lowering.2asm.js.opt +++ b/test/wasm2js/i64-lowering.2asm.js.opt @@ -61,135 +61,35 @@ function asmFunc(global, env, buffer) { } function legalstub$3($0, $1, $2, $3_1) { - 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; - $0 = $1 << $0; - } - $5_1 = $5_1 | $0; - $1 = 32; - $0 = $1 & 31; - if (32 >>> 0 <= $1 >>> 0) { - $1 = $3_1 << $0; - $0 = 0; - } else { - $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0; - $0 = $3_1 << $0; - } - return $3($5_1, $4_1, $0 | $2, $1); + return $3($0, $1, $2, $3_1); } function legalstub$4($0, $1, $2, $3_1) { - 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; - $0 = $1 << $0; - } - $5_1 = $5_1 | $0; - $1 = 32; - $0 = $1 & 31; - if (32 >>> 0 <= $1 >>> 0) { - $1 = $3_1 << $0; - $0 = 0; - } else { - $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0; - $0 = $3_1 << $0; - } - return $4($5_1, $4_1, $0 | $2, $1); + return $4($0, $1, $2, $3_1); } function legalstub$5($0, $1, $2, $3_1) { - 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; - $0 = $1 << $0; - } - $5_1 = $5_1 | $0; - $1 = 32; - $0 = $1 & 31; - if (32 >>> 0 <= $1 >>> 0) { - $1 = $3_1 << $0; - $0 = 0; - } else { - $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0; - $0 = $3_1 << $0; - } - return $5($5_1, $4_1, $0 | $2, $1); + return $5($0, $1, $2, $3_1); } function legalstub$6($0, $1, $2, $3_1) { - 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; - $0 = $1 << $0; - } - $5_1 = $5_1 | $0; - $1 = 32; - $0 = $1 & 31; - if (32 >>> 0 <= $1 >>> 0) { - $1 = $3_1 << $0; - $0 = 0; - } else { - $1 = (1 << $0) - 1 & $3_1 >>> 32 - $0; - $0 = $3_1 << $0; - } - return $6($5_1, $4_1, $0 | $2, $1); + return $6($0, $1, $2, $3_1); } function legalstub$7($0, $1, $2, $3_1) { - var $4_1 = 0; - $4_1 = $0; - $0 = $1; - $1 = $3_1; - return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 >= $2 >>> 0 | $0 >>> 0 > $1 >>> 0; + return ($1 | 0) == ($3_1 | 0) & $0 >>> 0 >= $2 >>> 0 | $1 >>> 0 > $3_1 >>> 0; } function legalstub$8($0, $1, $2, $3_1) { - var $4_1 = 0; - $4_1 = $0; - $0 = $1; - $1 = $3_1; - return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 > $2 >>> 0 | $0 >>> 0 > $1 >>> 0; + return ($1 | 0) == ($3_1 | 0) & $0 >>> 0 > $2 >>> 0 | $1 >>> 0 > $3_1 >>> 0; } function legalstub$9($0, $1, $2, $3_1) { - var $4_1 = 0; - $4_1 = $0; - $0 = $1; - $1 = $3_1; - return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 <= $2 >>> 0 | $0 >>> 0 < $1 >>> 0; + return ($1 | 0) == ($3_1 | 0) & $0 >>> 0 <= $2 >>> 0 | $1 >>> 0 < $3_1 >>> 0; } function legalstub$10($0, $1, $2, $3_1) { - var $4_1 = 0; - $4_1 = $0; - $0 = $1; - $1 = $3_1; - return ($0 | 0) == ($1 | 0) & $4_1 >>> 0 < $2 >>> 0 | $0 >>> 0 < $1 >>> 0; + return ($1 | 0) == ($3_1 | 0) & $0 >>> 0 < $2 >>> 0 | $1 >>> 0 < $3_1 >>> 0; } var FUNCTION_TABLE = []; diff --git a/test/wasm2js/i64-shifts.2asm.js.opt b/test/wasm2js/i64-shifts.2asm.js.opt index a6606ec41..0cb2501e7 100644 --- a/test/wasm2js/i64-shifts.2asm.js.opt +++ b/test/wasm2js/i64-shifts.2asm.js.opt @@ -57,69 +57,11 @@ function asmFunc(global, env, buffer) { } function legalstub$1($0, $1_1, $2_1, $3, $4, $5) { - var $6 = 0, $7 = 0; - $7 = $0; - $6 = 32; - $0 = $6 & 31; - if (32 >>> 0 <= $6 >>> 0) { - $6 = $1_1 << $0; - $0 = 0; - } else { - $6 = (1 << $0) - 1 & $1_1 >>> 32 - $0; - $0 = $1_1 << $0; - } - $7 = $7 | $0; - $1_1 = 32; - $0 = $1_1 & 31; - if (32 >>> 0 <= $1_1 >>> 0) { - $0 = 0 - } else { - $0 = $3 << $0 - } - $2_1 = $0 | $2_1; - $1_1 = 32; - $0 = $1_1 & 31; - if (32 >>> 0 <= $1_1 >>> 0) { - $1_1 = $5 << $0; - $0 = 0; - } else { - $1_1 = (1 << $0) - 1 & $5 >>> 32 - $0; - $0 = $5 << $0; - } - return $1($7, $6, $2_1, $0 | $4, $1_1); + return $1($0, $1_1, $2_1, $4, $5); } function legalstub$2($0, $1_1, $2_1, $3, $4, $5) { - var $6 = 0, $7 = 0; - $7 = $0; - $6 = 32; - $0 = $6 & 31; - if (32 >>> 0 <= $6 >>> 0) { - $6 = $1_1 << $0; - $0 = 0; - } else { - $6 = (1 << $0) - 1 & $1_1 >>> 32 - $0; - $0 = $1_1 << $0; - } - $7 = $7 | $0; - $1_1 = 32; - $0 = $1_1 & 31; - if (32 >>> 0 <= $1_1 >>> 0) { - $0 = 0 - } else { - $0 = $3 << $0 - } - $2_1 = $0 | $2_1; - $1_1 = 32; - $0 = $1_1 & 31; - if (32 >>> 0 <= $1_1 >>> 0) { - $1_1 = $5 << $0; - $0 = 0; - } else { - $1_1 = (1 << $0) - 1 & $5 >>> 32 - $0; - $0 = $5 << $0; - } - return $2($7, $6, $2_1, $0 | $4, $1_1); + return $2($0, $1_1, $2_1, $4, $5); } var FUNCTION_TABLE = []; diff --git a/test/wasm2js/reinterpret.2asm.js.opt b/test/wasm2js/reinterpret.2asm.js.opt index 4c9856ca0..58c2057b6 100644 --- a/test/wasm2js/reinterpret.2asm.js.opt +++ b/test/wasm2js/reinterpret.2asm.js.opt @@ -67,18 +67,7 @@ function asmFunc(global, env, buffer) { } function legalstub$2($0, $1_1) { - var $2_1 = 0, $3 = 0; - $3 = $0; - $2_1 = 32; - $0 = $2_1 & 31; - if (32 >>> 0 <= $2_1 >>> 0) { - $2_1 = $1_1 << $0; - $0 = 0; - } else { - $2_1 = (1 << $0) - 1 & $1_1 >>> 32 - $0; - $0 = $1_1 << $0; - } - return $2($3 | $0, $2_1); + return $2($0, $1_1); } var FUNCTION_TABLE = []; diff --git a/test/wasm2js/stack-modified.2asm.js.opt b/test/wasm2js/stack-modified.2asm.js.opt index baabfe868..c5190792d 100644 --- a/test/wasm2js/stack-modified.2asm.js.opt +++ b/test/wasm2js/stack-modified.2asm.js.opt @@ -45,55 +45,25 @@ function asmFunc(global, env, buffer) { } function legalstub$0($0_1, $1) { - var $2 = 0, $3 = 0; - $3 = $0_1; - $2 = 32; - $0_1 = $2 & 31; - if (32 >>> 0 <= $2 >>> 0) { - $2 = $1 << $0_1; - $0_1 = 0; - } else { - $2 = (1 << $0_1) - 1 & $1 >>> 32 - $0_1; - $0_1 = $1 << $0_1; - } - $0_1 = $0($3 | $0_1, $2); - $1 = i64toi32_i32$HIGH_BITS; - $3 = 32; - $2 = $3 & 31; - setTempRet0((32 >>> 0 <= $3 >>> 0 ? $1 >>> $2 : ((1 << $2) - 1 & $1) << 32 - $2 | $0_1 >>> $2) | 0); + $0_1 = $0($0_1, $1); + setTempRet0(i64toi32_i32$HIGH_BITS | 0); return $0_1; } function _ZN17compiler_builtins3int3mul3Mul3mul17h070e9a1c69faec5bE($0_1, $1, $2, $3) { - var $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0, $10 = 0; - $6 = $2 >>> 16; - $10 = $0_1; - $7 = $0_1 >>> 16; - $5 = Math_imul($6, $7); - $4 = $2 & 65535; - $8 = $0_1 & 65535; - $9 = Math_imul($4, $8); - $7 = ($9 >>> 16) + Math_imul($4, $7) | 0; - $6 = ($7 & 65535) + Math_imul($6, $8) | 0; - $8 = $5; - $5 = 32; - $4 = $5 & 31; - $5 = $8 + Math_imul(32 >>> 0 <= $5 >>> 0 ? $1 >>> $4 : ((1 << $4) - 1 & $1) << 32 - $4 | $0_1 >>> $4, $2) | 0; - $1 = $2; - $2 = 32; - $0_1 = $2 & 31; - $1 = (($5 + Math_imul($10, 32 >>> 0 <= $2 >>> 0 ? $3 >>> $0_1 : ((1 << $0_1) - 1 & $3) << 32 - $0_1 | $1 >>> $0_1) | 0) + ($7 >>> 16) | 0) + ($6 >>> 16) | 0; - $0_1 = 32 & 31; - if (32 >>> 0 <= $2 >>> 0) { - $2 = $1 << $0_1; - $0_1 = 0; - } else { - $2 = (1 << $0_1) - 1 & $1 >>> 32 - $0_1; - $0_1 = $1 << $0_1; - } - $0_1 = $0_1 | ($9 & 65535 | $6 << 16); - i64toi32_i32$HIGH_BITS = $2; - return $0_1; + var $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0; + $4 = $2 >>> 16; + $5 = $0_1 >>> 16; + $9 = Math_imul($4, $5); + $6 = $2 & 65535; + $7 = $0_1 & 65535; + $8 = Math_imul($6, $7); + $5 = ($8 >>> 16) + Math_imul($5, $6) | 0; + $4 = ($5 & 65535) + Math_imul($4, $7) | 0; + $0_1 = (((Math_imul($1, $2) + $9 | 0) + Math_imul($0_1, $3) | 0) + ($5 >>> 16) | 0) + ($4 >>> 16) | 0; + $1 = $8 & 65535 | $4 << 16; + i64toi32_i32$HIGH_BITS = $0_1; + return $1; } var FUNCTION_TABLE = []; diff --git a/test/wasm2js/unaligned.2asm.js.opt b/test/wasm2js/unaligned.2asm.js.opt index bbca2c8bf..c765fbc46 100644 --- a/test/wasm2js/unaligned.2asm.js.opt +++ b/test/wasm2js/unaligned.2asm.js.opt @@ -104,13 +104,10 @@ function asmFunc(global, env, buffer) { } function legalstub$1() { - var $0_1 = 0, $1_1 = 0, $2_1 = 0, $3_1 = 0; - $1_1 = $1(); - $2_1 = i64toi32_i32$HIGH_BITS; - $3_1 = 32; - $0_1 = $3_1 & 31; - setTempRet0((32 >>> 0 <= $3_1 >>> 0 ? $2_1 >>> $0_1 : ((1 << $0_1) - 1 & $2_1) << 32 - $0_1 | $1_1 >>> $0_1) | 0); - return $1_1; + var $0_1 = 0; + $0_1 = $1(); + setTempRet0(i64toi32_i32$HIGH_BITS | 0); + return $0_1; } var FUNCTION_TABLE = []; diff --git a/test/wasm2js/unary-ops.2asm.js.opt b/test/wasm2js/unary-ops.2asm.js.opt index 7dcc1c85c..836400f0e 100644 --- a/test/wasm2js/unary-ops.2asm.js.opt +++ b/test/wasm2js/unary-ops.2asm.js.opt @@ -57,11 +57,7 @@ function asmFunc(global, env, buffer) { } function legalstub$3($0, $1_1, $2) { - var $3 = 0; - $3 = $1_1; - $1_1 = $2; - $2 = $3 | 0; - return !$1_1 & ($0 | 0) == ($2 | 0); + return !$2 & ($0 | 0) == ($1_1 | 0); } function legalstub$4($0, $1_1, $2) { @@ -73,28 +69,7 @@ function asmFunc(global, env, buffer) { } function legalstub$8($0, $1_1, $2, $3) { - var $4 = 0, $5 = 0; - $5 = $0; - $4 = 32; - $0 = $4 & 31; - if (32 >>> 0 <= $4 >>> 0) { - $4 = $1_1 << $0; - $0 = 0; - } else { - $4 = (1 << $0) - 1 & $1_1 >>> 32 - $0; - $0 = $1_1 << $0; - } - $5 = $5 | $0; - $1_1 = 32; - $0 = $1_1 & 31; - if (32 >>> 0 <= $1_1 >>> 0) { - $1_1 = $3 << $0; - $0 = 0; - } else { - $1_1 = (1 << $0) - 1 & $3 >>> 32 - $0; - $0 = $3 << $0; - } - return $8($5, $4, $0 | $2, $1_1); + return $8($0, $1_1, $2, $3); } function legalstub$9($0, $1_1, $2, $3) { @@ -102,21 +77,18 @@ function asmFunc(global, env, buffer) { } function __wasm_ctz_i64($0, $1_1) { - var $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6_1 = 0; + var $2 = 0, $3 = 0; if ($0 | $1_1) { - $4 = 63; - $6_1 = $4; $3 = $1_1 + -1 | 0; - $2 = -1; - $5 = $2 + $0 | 0; - if ($5 >>> 0 < $2 >>> 0) { + $2 = $0 + -1 | 0; + if ($2 >>> 0 < -1 >>> 0) { $3 = $3 + 1 | 0 } - $2 = Math_clz32($0 ^ $5) + 32 | 0; + $2 = Math_clz32($0 ^ $2) + 32 | 0; $0 = Math_clz32($1_1 ^ $3); $0 = ($0 | 0) == (32 | 0) ? $2 : $0; - $1_1 = $6_1 - $0 | 0; - i64toi32_i32$HIGH_BITS = 0 - ($4 >>> 0 < $0 >>> 0) | 0; + $1_1 = 63 - $0 | 0; + i64toi32_i32$HIGH_BITS = 0 - (63 >>> 0 < $0 >>> 0) | 0; return $1_1; } i64toi32_i32$HIGH_BITS = 0; @@ -140,24 +112,23 @@ function asmFunc(global, env, buffer) { function __wasm_popcnt_i64($0, $1_1) { var $2 = 0, $3 = 0, $4 = 0, $5 = 0; label$2 : while (1) { - $3 = $4; - $2 = $5; + $5 = $3; + $2 = $4; if ($0 | $1_1) { $2 = $0; - $3 = 1; - $0 = $2 - $3 & $2; - $1_1 = $1_1 - ($2 >>> 0 < $3 >>> 0) & $1_1; - $2 = 1 + $4 | 0; - if ($2 >>> 0 < $3 >>> 0) { - $5 = $5 + 1 | 0 + $0 = $2 - 1 & $2; + $1_1 = $1_1 - ($2 >>> 0 < 1 >>> 0) & $1_1; + $2 = $3 + 1 | 0; + if ($2 >>> 0 < 1 >>> 0) { + $4 = $4 + 1 | 0 } - $4 = $2; + $3 = $2; continue; } break; }; i64toi32_i32$HIGH_BITS = $2; - return $3; + return $5; } var FUNCTION_TABLE = []; |