diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-03-09 16:46:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-09 16:46:38 -0800 |
commit | d79d71ac7dfe807a5e98b94c9d1f67df4da7998a (patch) | |
tree | a795b28fd5ca074c7a901ede07dcaa0fc571bdc0 /test/passes/optimize-instructions.wast | |
parent | be4be557567251a73f40bfd7a48220b33f5ddc58 (diff) | |
download | binaryen-d79d71ac7dfe807a5e98b94c9d1f67df4da7998a.tar.gz binaryen-d79d71ac7dfe807a5e98b94c9d1f67df4da7998a.tar.bz2 binaryen-d79d71ac7dfe807a5e98b94c9d1f67df4da7998a.zip |
fix sign-ext opt issues (#935)
* fix a bug where compared sign-exts of different sizes were turned into zero-exts
* fix a bug where we consider an almost sign-ext as ok to change the sign of a load inside it, ignoring that the load has the extra shifting
Diffstat (limited to 'test/passes/optimize-instructions.wast')
-rw-r--r-- | test/passes/optimize-instructions.wast | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index 51bd076d1..8ef6f67a5 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -2106,4 +2106,79 @@ ) ) ) + (func $unsign-diff-sizes (param $x i32) (param $y i32) (result i32) + (i32.ne + (i32.shr_s + (i32.shl + (call $unsign-diff-sizes + (i32.const -1) + (i32.const 5) + ) + (i32.const 24) + ) + (i32.const 24) + ) + (i32.shr_s + (i32.shl + (call $unsign-diff-sizes + (i32.const 1) + (i32.const 2006) + ) + (i32.const 16) + ) + (i32.const 16) + ) + ) + ) + (func $unsign-same-sizes (param $x i32) (param $y i32) (result i32) + (i32.ne + (i32.shr_s + (i32.shl + (call $unsign-same-sizes + (i32.const -1) + (i32.const 5) + ) + (i32.const 24) + ) + (i32.const 24) + ) + (i32.shr_s + (i32.shl + (call $unsign-same-sizes + (i32.const 1) + (i32.const 2006) + ) + (i32.const 24) + ) + (i32.const 24) + ) + ) + ) + (func $fuzz-almost-sign-ext + (drop + (i32.shr_s + (i32.shl + (i32.load16_u + (i32.const 2278) + ) + (i32.const 17) + ) + (i32.const 16) + ) + ) + (drop + (i32.shr_s + (i32.shl + (i32.shl + (i32.load16_u + (i32.const 2278) + ) + (i32.const 1) + ) + (i32.const 16) + ) + (i32.const 16) + ) + ) + ) ) |