diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-08-01 08:06:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-01 08:06:04 -0700 |
commit | 5a07a930ad51003411b2bc827ea9bf08728ecc5a (patch) | |
tree | 7a599caa2977464e4b056c59457d17c4d7e1bd91 /test/passes/optimize-instructions.wast | |
parent | 76751bf1f9df4eb2ee6c216744af9ed1e097132e (diff) | |
parent | 44154e3d0895e2f5688861f0bc8d62af71ee6b6d (diff) | |
download | binaryen-5a07a930ad51003411b2bc827ea9bf08728ecc5a.tar.gz binaryen-5a07a930ad51003411b2bc827ea9bf08728ecc5a.tar.bz2 binaryen-5a07a930ad51003411b2bc827ea9bf08728ecc5a.zip |
Merge pull request #1116 from WebAssembly/fuzz
Fuzz fixes
Diffstat (limited to 'test/passes/optimize-instructions.wast')
-rw-r--r-- | test/passes/optimize-instructions.wast | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index cf8275412..8362453e9 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -842,7 +842,7 @@ (i32.const -1) (i32.const 2147483647) ) - (i32.const 32) + (i32.const 31) ;; adjusted after we fixed shift computation to just look at lower 5 bits ) (i32.const 24) ) @@ -2433,4 +2433,67 @@ (i32.const 1) ) ) + (func $neg-shifts-and-255 (result i32) + (i32.and + (i32.shr_u + (i32.const -99) + (i32.const -32) ;; this shift does nothing + ) + (i32.const 255) + ) + ) + (func $neg-shifts-and-255-b (result i32) + (i32.and + (i32.shl + (i32.const -2349025) + (i32.const -32) ;; this shift does nothing + ) + (i32.const 255) + ) + ) + (func $shifts-square-overflow (param $x i32) (result i32) + (i32.shr_u + (i32.shr_u + (get_local $x) + (i32.const 65535) ;; 31 bits effectively + ) + (i32.const 32767) ;; also 31 bits, so two shifts that force the value into nothing for sure + ) + ) + (func $shifts-square-no-overflow-small (param $x i32) (result i32) + (i32.shr_u + (i32.shr_u + (get_local $x) + (i32.const 1031) ;; 7 bits effectively + ) + (i32.const 4098) ;; 2 bits effectively + ) + ) + (func $shifts-square-overflow-64 (param $x i64) (result i64) + (i64.shr_u + (i64.shr_u + (get_local $x) + (i64.const 65535) ;; 63 bits effectively + ) + (i64.const 64767) ;; also 63 bits, so two shifts that force the value into nothing for sure + ) + ) + (func $shifts-square-no-overflow-small-64 (param $x i64) (result i64) + (i64.shr_u + (i64.shr_u + (get_local $x) + (i64.const 1031) ;; 7 bits effectively + ) + (i64.const 4098) ;; 2 bits effectively + ) + ) + (func $shifts-square-unreachable (param $x i32) (result i32) + (i32.shr_u + (i32.shr_u + (unreachable) + (i32.const 1031) ;; 7 bits effectively + ) + (i32.const 4098) ;; 2 bits effectively + ) + ) ) |