diff options
author | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-02-13 17:35:39 -0800 |
---|---|---|
committer | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-02-16 22:45:40 -0800 |
commit | ced44f4fd543b50980d4bf674fa6a30f9c31790f (patch) | |
tree | 21dbebbdce5a0e38db3c6438384f5914de93c517 /test/passes/optimize-instructions.wast | |
parent | eec567640d154147fb88754fd13aada738a63eef (diff) | |
download | binaryen-ced44f4fd543b50980d4bf674fa6a30f9c31790f.tar.gz binaryen-ced44f4fd543b50980d4bf674fa6a30f9c31790f.tar.bz2 binaryen-ced44f4fd543b50980d4bf674fa6a30f9c31790f.zip |
take into account loads into local info in OptimizeInstructions
Diffstat (limited to 'test/passes/optimize-instructions.wast')
-rw-r--r-- | test/passes/optimize-instructions.wast | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index 0169bb054..2f2333867 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -1978,4 +1978,46 @@ ) ) ) + (func $local-info-sign-ext-already-exted-by-load (param $0 i32) (param $1 i32) + (local $x i32) + (local $y i32) + (local $z i32) + (local $w i32) + (set_local $x + (i32.load8_s (i32.const 1024)) ;; 8 bits, sign extended, no need to do it again + ) + (drop + (i32.shr_s + (i32.shl + (get_local $x) + (i32.const 24) + ) + (i32.const 24) + ) + ) + (set_local $y + (i32.load8_u (i32.const 1024)) ;; 8 bits, zext, so bad + ) + (drop + (i32.shr_s + (i32.shl + (get_local $y) + (i32.const 24) + ) + (i32.const 24) + ) + ) + (set_local $z + (i32.load16_s (i32.const 1024)) ;; 16 bits sign-extended, wrong size + ) + (drop + (i32.shr_s + (i32.shl + (get_local $z) + (i32.const 24) + ) + (i32.const 24) + ) + ) + ) ) |