diff options
Diffstat (limited to 'test/passes')
-rw-r--r-- | test/passes/optimize-instructions.txt | 80 | ||||
-rw-r--r-- | test/passes/optimize-instructions.wast | 86 |
2 files changed, 166 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt index 550859185..d70e6a9c5 100644 --- a/test/passes/optimize-instructions.txt +++ b/test/passes/optimize-instructions.txt @@ -1643,4 +1643,84 @@ ) ) ) + (func $compare-load-s-sign-extend (type $4) (param $0 i32) (param $1 i32) + (drop + (i32.eq + (i32.load8_u + (get_local $0) + ) + (i32.and + (get_local $1) + (i32.const 255) + ) + ) + ) + (drop + (i32.eq + (i32.and + (get_local $1) + (i32.const 255) + ) + (i32.load8_u + (get_local $0) + ) + ) + ) + (drop + (i32.eq + (i32.load8_u + (get_local $0) + ) + (i32.shr_s + (i32.shl + (get_local $1) + (i32.const 24) + ) + (i32.const 24) + ) + ) + ) + (drop + (i32.eq + (i32.load8_s + (get_local $0) + ) + (i32.shr_s + (i32.shl + (get_local $1) + (i32.const 16) + ) + (i32.const 16) + ) + ) + ) + (drop + (i32.eq + (i32.shr_s + (i32.shl + (get_local $1) + (i32.const 24) + ) + (i32.const 24) + ) + (i32.load8_u + (get_local $0) + ) + ) + ) + (drop + (i32.eq + (i32.shr_s + (i32.shl + (get_local $1) + (i32.const 16) + ) + (i32.const 16) + ) + (i32.load8_s + (get_local $0) + ) + ) + ) + ) ) diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index 2f2333867..51bd076d1 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -2020,4 +2020,90 @@ ) ) ) + (func $compare-load-s-sign-extend (param $0 i32) (param $1 i32) + (drop + (i32.eq + (i32.load8_s + (get_local $0) + ) + (i32.shr_s + (i32.shl + (get_local $1) + (i32.const 24) + ) + (i32.const 24) + ) + ) + ) + (drop + (i32.eq + (i32.shr_s + (i32.shl + (get_local $1) + (i32.const 24) + ) + (i32.const 24) + ) + (i32.load8_s + (get_local $0) ;; flip order, we should canonicalize + ) + ) + ) + (drop + (i32.eq + (i32.load8_u ;; unsigned, bad + (get_local $0) + ) + (i32.shr_s + (i32.shl + (get_local $1) + (i32.const 24) + ) + (i32.const 24) + ) + ) + ) + (drop + (i32.eq + (i32.load8_s + (get_local $0) + ) + (i32.shr_s + (i32.shl + (get_local $1) + (i32.const 16) ;; wrong size + ) + (i32.const 16) + ) + ) + ) + (drop + (i32.eq + (i32.shr_s + (i32.shl + (get_local $1) + (i32.const 24) + ) + (i32.const 24) + ) + (i32.load8_u ;; unsigned, bad + (get_local $0) + ) + ) + ) + (drop + (i32.eq + (i32.shr_s + (i32.shl + (get_local $1) + (i32.const 16) ;; wrong size + ) + (i32.const 16) + ) + (i32.load8_s + (get_local $0) + ) + ) + ) + ) ) |