diff options
author | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-02-11 21:55:14 -0800 |
---|---|---|
committer | Alon Zakai (kripken) <alonzakai@gmail.com> | 2017-02-16 22:45:37 -0800 |
commit | c06b3762a09e95443fd0f159b2675209db1dbb29 (patch) | |
tree | fcdeda6f567e35a11582e5879746c20910499388 /test/passes/optimize-instructions.wast | |
parent | 2553266cf716df3f03d5d057887ed660c12f4fb6 (diff) | |
download | binaryen-c06b3762a09e95443fd0f159b2675209db1dbb29.tar.gz binaryen-c06b3762a09e95443fd0f159b2675209db1dbb29.tar.bz2 binaryen-c06b3762a09e95443fd0f159b2675209db1dbb29.zip |
optimize out a sign-ext into a store of the same size
Diffstat (limited to 'test/passes/optimize-instructions.wast')
-rw-r--r-- | test/passes/optimize-instructions.wast | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index 9bd5d975a..6cba3d51f 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -1419,4 +1419,86 @@ ) ) ) + (func $store-signext (param $0 i32) + (i32.store8 + (i32.const 8) + (i32.shr_s + (i32.shl + (get_local $0) + (i32.const 24) ;; exact size we store, sign-ext of 8 bits + ) + (i32.const 24) + ) + ) + (i32.store8 + (i32.const 8) + (i32.shr_s + (i32.shl + (get_local $0) + (i32.const 25) ;; 7 bits. so the ext can alter a bit we store, do not optimize + ) + (i32.const 25) + ) + ) + (i32.store8 + (i32.const 8) + (i32.shr_s + (i32.shl + (get_local $0) + (i32.const 23) ;; 9 bits, this is good to optimize + ) + (i32.const 23) + ) + ) + (i32.store16 + (i32.const 8) + (i32.shr_s + (i32.shl + (get_local $0) + (i32.const 16) ;; exact size we store, sign-ext of 16 bits + ) + (i32.const 16) + ) + ) + (i32.store16 + (i32.const 8) + (i32.shr_s + (i32.shl + (get_local $0) + (i32.const 17) ;; 15 bits. so the ext can alter a bit we store, do not optimize + ) + (i32.const 17) + ) + ) + (i32.store16 + (i32.const 8) + (i32.shr_s + (i32.shl + (get_local $0) + (i32.const 14) ;; 17 bits, this is good to optimize + ) + (i32.const 14) + ) + ) + (i32.store + (i32.const 8) + (i32.shr_s + (i32.shl + (get_local $0) + (i32.const 16) ;; 4 bytes stored, do nothing + ) + (i32.const 16) + ) + ) + (i32.store + (i32.const 8) + (i32.shr_s + (i32.shl + (get_local $0) + (i32.const 8) ;; 4 bytes stored, do nothing + ) + (i32.const 8) + ) + ) + ) ) |