summaryrefslogtreecommitdiff
path: root/test/passes/optimize-instructions.txt
diff options
context:
space:
mode:
Diffstat (limited to 'test/passes/optimize-instructions.txt')
-rw-r--r--test/passes/optimize-instructions.txt648
1 files changed, 646 insertions, 2 deletions
diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt
index 03f0f7074..d70e6a9c5 100644
--- a/test/passes/optimize-instructions.txt
+++ b/test/passes/optimize-instructions.txt
@@ -4,6 +4,7 @@
(type $2 (func (result i32)))
(type $3 (func (param i32) (result i32)))
(type $4 (func (param i32 i32)))
+ (type $5 (func (param i32)))
(memory $0 0)
(export "load-off-2" (func $load-off-2))
(func $f (type $0) (param $i1 i32) (param $i2 i64)
@@ -668,15 +669,15 @@
(drop
(i32.xor
(i32.const 127)
- (i32.const 128)
+ (i32.const 126)
)
)
(drop
(i32.shr_s
(i32.shl
(i32.xor
+ (i32.const 127)
(i32.const 128)
- (i32.const 129)
)
(i32.const 24)
)
@@ -913,6 +914,21 @@
(i32.const 25)
)
)
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (i32.xor
+ (i32.le_u
+ (get_local $0)
+ (i32.const 2)
+ )
+ (get_local $0)
+ )
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
)
(func $linear-sums (type $4) (param $0 i32) (param $1 i32)
(drop
@@ -1079,4 +1095,632 @@
)
)
)
+ (func $sign-ext-ne (type $4) (param $0 i32) (param $1 i32)
+ (drop
+ (i32.ne
+ (i32.and
+ (get_local $0)
+ (i32.const 255)
+ )
+ (i32.const 232)
+ )
+ )
+ (drop
+ (i32.ne
+ (i32.and
+ (get_local $0)
+ (i32.const 255)
+ )
+ (i32.const 111)
+ )
+ )
+ (drop
+ (i32.ne
+ (i32.and
+ (get_local $0)
+ (i32.const 255)
+ )
+ (i32.and
+ (get_local $1)
+ (i32.const 255)
+ )
+ )
+ )
+ )
+ (func $sign-ext-eqz (type $4) (param $0 i32) (param $1 i32)
+ (drop
+ (i32.eqz
+ (i32.and
+ (get_local $0)
+ (i32.const 255)
+ )
+ )
+ )
+ )
+ (func $sign-ext-boolean (type $4) (param $0 i32) (param $1 i32)
+ (drop
+ (if i32
+ (i32.and
+ (get_local $0)
+ (i32.const 255)
+ )
+ (i32.const 100)
+ (i32.const 200)
+ )
+ )
+ )
+ (func $add-sub-zero (type $4) (param $0 i32) (param $1 i32)
+ (drop
+ (get_local $0)
+ )
+ (drop
+ (get_local $0)
+ )
+ )
+ (func $store-signext (type $5) (param $0 i32)
+ (i32.store8
+ (i32.const 8)
+ (get_local $0)
+ )
+ (i32.store8
+ (i32.const 8)
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 25)
+ )
+ (i32.const 25)
+ )
+ )
+ (i32.store8
+ (i32.const 8)
+ (get_local $0)
+ )
+ (i32.store16
+ (i32.const 8)
+ (get_local $0)
+ )
+ (i32.store16
+ (i32.const 8)
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 17)
+ )
+ (i32.const 17)
+ )
+ )
+ (i32.store16
+ (i32.const 8)
+ (get_local $0)
+ )
+ (i32.store
+ (i32.const 8)
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 16)
+ )
+ (i32.const 16)
+ )
+ )
+ (i32.store
+ (i32.const 8)
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 8)
+ )
+ (i32.const 8)
+ )
+ )
+ )
+ (func $sign-ext-tee (type $4) (param $0 i32) (param $1 i32)
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (tee_local $0
+ (i32.const 128)
+ )
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (drop
+ (tee_local $0
+ (i32.const 127)
+ )
+ )
+ )
+ (func $sign-ext-load (type $4) (param $0 i32) (param $1 i32)
+ (drop
+ (i32.load8_s
+ (i32.const 256)
+ )
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (i32.shr_u
+ (i32.load8_s
+ (i32.const 256)
+ )
+ (i32.const 1)
+ )
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (drop
+ (i32.shr_u
+ (i32.load8_u
+ (i32.const 256)
+ )
+ (i32.const 1)
+ )
+ )
+ (drop
+ (i32.load16_s
+ (i32.const 256)
+ )
+ )
+ (drop
+ (tee_local $1
+ (i32.load8_s
+ (i32.const 1)
+ )
+ )
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (tee_local $1
+ (i32.load8_u
+ (i32.const 1)
+ )
+ )
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (drop
+ (i32.and
+ (tee_local $1
+ (i32.load8_s
+ (i32.const 1)
+ )
+ )
+ (i32.const 255)
+ )
+ )
+ (drop
+ (tee_local $1
+ (i32.load8_u
+ (i32.const 1)
+ )
+ )
+ )
+ )
+ (func $mask-bits (type $4) (param $0 i32) (param $1 i32)
+ (drop
+ (tee_local $0
+ (i32.const 127)
+ )
+ )
+ (drop
+ (tee_local $0
+ (i32.const 128)
+ )
+ )
+ (drop
+ (i32.and
+ (tee_local $0
+ (i32.const 128)
+ )
+ (i32.const 254)
+ )
+ )
+ (drop
+ (i32.and
+ (tee_local $0
+ (i32.const 128)
+ )
+ (i32.const 1279)
+ )
+ )
+ (drop
+ (i32.and
+ (tee_local $0
+ (i32.const 128)
+ )
+ (i32.const 1290)
+ )
+ )
+ (drop
+ (tee_local $0
+ (i32.const 128)
+ )
+ )
+ (drop
+ (tee_local $0
+ (i32.const 128)
+ )
+ )
+ (drop
+ (i32.and
+ (tee_local $0
+ (i32.const 128)
+ )
+ (i32.const 127)
+ )
+ )
+ )
+ (func $local-info-zero-ext (type $4) (param $0 i32) (param $1 i32)
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (local $w i32)
+ (set_local $x
+ (i32.const 212)
+ )
+ (drop
+ (get_local $x)
+ )
+ (set_local $y
+ (i32.const 500)
+ )
+ (drop
+ (i32.and
+ (get_local $y)
+ (i32.const 255)
+ )
+ )
+ (set_local $0
+ (i32.const 212)
+ )
+ (drop
+ (i32.and
+ (get_local $0)
+ (i32.const 255)
+ )
+ )
+ (set_local $z
+ (i32.const 212)
+ )
+ (set_local $z
+ (i32.const 220)
+ )
+ (drop
+ (get_local $z)
+ )
+ (set_local $w
+ (i32.const 212)
+ )
+ (set_local $w
+ (i32.const 1000)
+ )
+ (drop
+ (i32.and
+ (get_local $w)
+ (i32.const 255)
+ )
+ )
+ )
+ (func $local-info-sign-ext-bitsize (type $4) (param $0 i32) (param $1 i32)
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (local $w i32)
+ (set_local $x
+ (i32.const 127)
+ )
+ (drop
+ (get_local $x)
+ )
+ (set_local $y
+ (i32.const 128)
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (get_local $y)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (set_local $0
+ (i32.const 127)
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (set_local $z
+ (i32.const 127)
+ )
+ (set_local $z
+ (i32.const 100)
+ )
+ (drop
+ (get_local $z)
+ )
+ (set_local $w
+ (i32.const 127)
+ )
+ (set_local $w
+ (i32.const 150)
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (get_local $w)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ )
+ (func $local-info-sign-ext-already-exted (type $4) (param $0 i32) (param $1 i32)
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (local $w i32)
+ (set_local $x
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (drop
+ (get_local $x)
+ )
+ (set_local $y
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 16)
+ )
+ (i32.const 16)
+ )
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (get_local $y)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (set_local $0
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (set_local $z
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (set_local $z
+ (i32.shr_s
+ (i32.shl
+ (get_local $1)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (drop
+ (get_local $z)
+ )
+ (set_local $w
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (set_local $w
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 23)
+ )
+ (i32.const 24)
+ )
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (get_local $w)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (get_local $0)
+ (i32.const 24)
+ )
+ (i32.const 23)
+ )
+ )
+ )
+ (func $signed-loads-fill-the-bits (type $3) (param $$e i32) (result i32)
+ (local $$0 i32)
+ (local $$conv i32)
+ (set_local $$0
+ (i32.load8_s
+ (i32.const 1024)
+ )
+ )
+ (set_local $$conv
+ (i32.and
+ (get_local $$0)
+ (i32.const 255)
+ )
+ )
+ (return
+ (i32.eq
+ (get_local $$conv)
+ (get_local $$e)
+ )
+ )
+ )
+ (func $local-info-sign-ext-already-exted-by-load (type $4) (param $0 i32) (param $1 i32)
+ (local $x i32)
+ (local $y i32)
+ (local $z i32)
+ (local $w i32)
+ (set_local $x
+ (i32.load8_s
+ (i32.const 1024)
+ )
+ )
+ (drop
+ (get_local $x)
+ )
+ (set_local $y
+ (i32.load8_u
+ (i32.const 1024)
+ )
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (get_local $y)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ (set_local $z
+ (i32.load16_s
+ (i32.const 1024)
+ )
+ )
+ (drop
+ (i32.shr_s
+ (i32.shl
+ (get_local $z)
+ (i32.const 24)
+ )
+ (i32.const 24)
+ )
+ )
+ )
+ (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)
+ )
+ )
+ )
+ )
)