summaryrefslogtreecommitdiff
path: root/test/passes/optimize-instructions.wast
diff options
context:
space:
mode:
Diffstat (limited to 'test/passes/optimize-instructions.wast')
-rw-r--r--test/passes/optimize-instructions.wast124
1 files changed, 123 insertions, 1 deletions
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast
index 8ef6f67a5..eccbf1268 100644
--- a/test/passes/optimize-instructions.wast
+++ b/test/passes/optimize-instructions.wast
@@ -491,7 +491,19 @@
)
(i32.const 24)
)
- (i32.const 32767) ;; non-zero and bigger than the mask
+ (i32.const 32767) ;; non-zero and bigger than the mask, with sign bit
+ )
+ )
+ (drop
+ (i32.eq
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ (i32.const -149) ;; non-zero and bigger than the mask, without sign bit
)
)
;; eq of two sign-ext, can both be a zext
@@ -1370,6 +1382,30 @@
)
(i32.const 24)
)
+ (i32.const 64872) ;; no sign bit
+ )
+ )
+ (drop
+ (i32.ne
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ (i32.const -149) ;; no sign bit, not all ones
+ )
+ )
+ (drop
+ (i32.ne
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
(i32.const 111)
)
)
@@ -2181,4 +2217,90 @@
)
)
)
+ (func $fuzz-comp-impossible (param $x i32)
+ (drop
+ (i32.eq
+ (i32.shr_s
+ (i32.shl
+ (get_local $x)
+ (i32.const 16)
+ )
+ (i32.const 16)
+ )
+ (i32.const 65535) ;; impossible to be equal, the effective sign bit is set, but not the higher bits, which the sign-ext will set on the non-const value
+ )
+ )
+ (drop
+ (i32.eq
+ (i32.shr_s
+ (i32.shl
+ (get_local $x)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ (i32.const 255)
+ )
+ )
+ (drop
+ (i32.eq
+ (i32.shr_s
+ (i32.shl
+ (get_local $x)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ (i32.const 127) ;; safe
+ )
+ )
+ (drop
+ (i32.eq
+ (i32.shr_s
+ (i32.shl
+ (get_local $x)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ (i32.const 128) ;; unsafe again
+ )
+ )
+ (drop
+ (i32.eq
+ (i32.shr_s
+ (i32.shl
+ (get_local $x)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ (i32.const 4223) ;; more big bits, so sign bit though
+ )
+ )
+ (drop
+ (i32.eq
+ (i32.shr_s
+ (i32.shl
+ (get_local $x)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ (i32.const 4224) ;; more big bits
+ )
+ )
+ (drop
+ (i32.eq
+ (i32.shr_s
+ (i32.shl
+ (get_local $x)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ (i32.const -4) ;; safe even with more big bits, as they are all 1s
+ )
+ )
+ )
)