summaryrefslogtreecommitdiff
path: root/test/passes
diff options
context:
space:
mode:
Diffstat (limited to 'test/passes')
-rw-r--r--test/passes/optimize-instructions.txt70
-rw-r--r--test/passes/post-emscripten.txt73
-rw-r--r--test/passes/post-emscripten.wast101
3 files changed, 224 insertions, 20 deletions
diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt
index a8cf68dbd..f959c3cd6 100644
--- a/test/passes/optimize-instructions.txt
+++ b/test/passes/optimize-instructions.txt
@@ -415,20 +415,32 @@
)
)
(func $load-off-2 (type $3) (param $0 i32) (result i32)
- (i32.store
- (i32.const 6)
+ (i32.store offset=2
+ (i32.add
+ (i32.const 1)
+ (i32.const 3)
+ )
(get_local $0)
)
- (i32.store
- (i32.const 6)
+ (i32.store offset=2
+ (i32.add
+ (i32.const 3)
+ (i32.const 1)
+ )
(get_local $0)
)
- (i32.store offset=7
- (get_local $0)
+ (i32.store offset=2
+ (i32.add
+ (get_local $0)
+ (i32.const 5)
+ )
(get_local $0)
)
- (i32.store offset=9
- (get_local $0)
+ (i32.store offset=2
+ (i32.add
+ (get_local $0)
+ (i32.const 7)
+ )
(get_local $0)
)
(i32.store offset=2
@@ -445,12 +457,18 @@
)
(get_local $0)
)
- (i32.store
- (i32.const 4)
+ (i32.store offset=2
+ (i32.add
+ (i32.const -15)
+ (i32.const 17)
+ )
(get_local $0)
)
- (i32.store
- (i32.const 0)
+ (i32.store offset=2
+ (i32.add
+ (i32.const -21)
+ (i32.const 19)
+ )
(get_local $0)
)
(i32.store
@@ -462,18 +480,27 @@
(get_local $0)
)
(drop
- (i32.load
- (i32.const 8)
+ (i32.load offset=2
+ (i32.add
+ (i32.const 2)
+ (i32.const 4)
+ )
)
)
(drop
- (i32.load
- (i32.const 8)
+ (i32.load offset=2
+ (i32.add
+ (i32.const 4)
+ (i32.const 2)
+ )
)
)
(drop
- (i32.load offset=8
- (get_local $0)
+ (i32.load offset=2
+ (i32.add
+ (get_local $0)
+ (i32.const 6)
+ )
)
)
(drop
@@ -481,8 +508,11 @@
(i32.const 10)
)
)
- (i32.load offset=12
- (get_local $0)
+ (i32.load offset=2
+ (i32.add
+ (get_local $0)
+ (i32.const 10)
+ )
)
)
)
diff --git a/test/passes/post-emscripten.txt b/test/passes/post-emscripten.txt
index a2acbbb28..830d4276e 100644
--- a/test/passes/post-emscripten.txt
+++ b/test/passes/post-emscripten.txt
@@ -1,6 +1,8 @@
(module
(type $0 (func (param i32)))
+ (type $1 (func (param i32) (result i32)))
(memory $0 256 256)
+ (export "load-off-2" (func $load-off-2))
(func $b0 (type $0) (param $x i32)
(drop
(i32.load offset=1
@@ -39,4 +41,75 @@
)
)
)
+ (func $load-off-2 (type $1) (param $0 i32) (result i32)
+ (i32.store
+ (i32.const 6)
+ (get_local $0)
+ )
+ (i32.store
+ (i32.const 6)
+ (get_local $0)
+ )
+ (i32.store offset=7
+ (get_local $0)
+ (get_local $0)
+ )
+ (i32.store offset=9
+ (get_local $0)
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.add
+ (i32.const -11)
+ (get_local $0)
+ )
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.add
+ (get_local $0)
+ (i32.const -13)
+ )
+ (get_local $0)
+ )
+ (i32.store
+ (i32.const 4)
+ (get_local $0)
+ )
+ (i32.store
+ (i32.const 0)
+ (get_local $0)
+ )
+ (i32.store
+ (i32.const 25)
+ (get_local $0)
+ )
+ (i32.store
+ (i32.const -23)
+ (get_local $0)
+ )
+ (drop
+ (i32.load
+ (i32.const 8)
+ )
+ )
+ (drop
+ (i32.load
+ (i32.const 8)
+ )
+ )
+ (drop
+ (i32.load offset=8
+ (get_local $0)
+ )
+ )
+ (drop
+ (i32.load
+ (i32.const 10)
+ )
+ )
+ (i32.load offset=12
+ (get_local $0)
+ )
+ )
)
diff --git a/test/passes/post-emscripten.wast b/test/passes/post-emscripten.wast
index b554fea53..f262975f5 100644
--- a/test/passes/post-emscripten.wast
+++ b/test/passes/post-emscripten.wast
@@ -51,4 +51,105 @@
)
)
)
+ (func $load-off-2 "load-off-2" (param $0 i32) (result i32)
+ (i32.store offset=2
+ (i32.add
+ (i32.const 1)
+ (i32.const 3)
+ )
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.add
+ (i32.const 3)
+ (i32.const 1)
+ )
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.add
+ (get_local $0)
+ (i32.const 5)
+ )
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.add
+ (i32.const 7)
+ (get_local $0)
+ )
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.add
+ (i32.const -11) ;; do not fold this!
+ (get_local $0)
+ )
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.add
+ (get_local $0)
+ (i32.const -13) ;; do not fold this!
+ )
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.add
+ (i32.const -15)
+ (i32.const 17)
+ )
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.add
+ (i32.const -21)
+ (i32.const 19)
+ )
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.const 23)
+ (get_local $0)
+ )
+ (i32.store offset=2
+ (i32.const -25)
+ (get_local $0)
+ )
+ (drop
+ (i32.load offset=2
+ (i32.add
+ (i32.const 2)
+ (i32.const 4)
+ )
+ )
+ )
+ (drop
+ (i32.load offset=2
+ (i32.add
+ (i32.const 4)
+ (i32.const 2)
+ )
+ )
+ )
+ (drop
+ (i32.load offset=2
+ (i32.add
+ (get_local $0)
+ (i32.const 6)
+ )
+ )
+ )
+ (drop
+ (i32.load offset=2
+ (i32.const 8)
+ )
+ )
+ (i32.load offset=2
+ (i32.add
+ (i32.const 10)
+ (get_local $0)
+ )
+ )
+ )
)