summaryrefslogtreecommitdiff
path: root/test/passes/optimize-instructions_all-features.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/passes/optimize-instructions_all-features.wast')
-rw-r--r--test/passes/optimize-instructions_all-features.wast67
1 files changed, 67 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions_all-features.wast b/test/passes/optimize-instructions_all-features.wast
index 8c2cefb53..1afa3e5b5 100644
--- a/test/passes/optimize-instructions_all-features.wast
+++ b/test/passes/optimize-instructions_all-features.wast
@@ -3104,6 +3104,73 @@
(i64.const 1)
))
)
+ (func $srem-by-pot-eq-ne-zero (param $x i32) (param $y i64)
+ ;; eqz((signed)x % 4)
+ (drop (i32.eqz
+ (i32.rem_s
+ (local.get $x)
+ (i32.const 4)
+ )
+ ))
+ (drop (i64.eqz
+ (i64.rem_s
+ (local.get $y)
+ (i64.const 4)
+ )
+ ))
+ ;; (signed)x % 4 == 0
+ (drop (i32.eq
+ (i32.rem_s
+ (local.get $x)
+ (i32.const 4)
+ )
+ (i32.const 0)
+ ))
+ (drop (i64.eq
+ (i64.rem_s
+ (local.get $y)
+ (i64.const 2)
+ )
+ (i64.const 0)
+ ))
+ ;; ;; (signed)x % 2 != 0
+ (drop (i32.ne
+ (i32.rem_s
+ (local.get $x)
+ (i32.const 2)
+ )
+ (i32.const 0)
+ ))
+ (drop (i64.ne
+ (i64.rem_s
+ (local.get $y)
+ (i64.const 2)
+ )
+ (i64.const 0)
+ ))
+ ;; ;;
+ (drop (i32.eq
+ (i32.rem_s
+ (local.get $x)
+ (i32.const 3) ;; skip
+ )
+ (i32.const 0)
+ ))
+ (drop (i32.eq
+ (i32.rem_s
+ (local.get $x)
+ (i32.const -4) ;; skip
+ )
+ (i32.const 0)
+ ))
+ (drop (i64.eq
+ (i64.rem_s
+ (local.get $y)
+ (i64.const 3) ;; skip
+ )
+ (i64.const 0)
+ ))
+ )
(func $orZero (param $0 i32) (result i32)
(i32.or
(local.get $0)