summaryrefslogtreecommitdiff
path: root/test/passes
diff options
context:
space:
mode:
Diffstat (limited to 'test/passes')
-rw-r--r--test/passes/alignment-lowering.txt544
-rw-r--r--test/passes/alignment-lowering.wast63
2 files changed, 607 insertions, 0 deletions
diff --git a/test/passes/alignment-lowering.txt b/test/passes/alignment-lowering.txt
new file mode 100644
index 000000000..fefb128f7
--- /dev/null
+++ b/test/passes/alignment-lowering.txt
@@ -0,0 +1,544 @@
+(module
+ (type $0 (func))
+ (memory $0 1 1)
+ (func $func_4 (; 0 ;) (type $0)
+ (local $0 i32)
+ (local $1 i32)
+ (local $2 i32)
+ (local $3 i32)
+ (local $4 i32)
+ (local $5 i32)
+ (local $6 i32)
+ (local $7 i32)
+ (local $8 i32)
+ (local $9 i32)
+ (local $10 i32)
+ (local $11 i32)
+ (drop
+ (i32.load
+ (i32.const 4)
+ )
+ )
+ (drop
+ (block (result i32)
+ (local.set $0
+ (i32.const 4)
+ )
+ (i32.or
+ (i32.or
+ (i32.load8_u
+ (local.get $0)
+ )
+ (i32.shl
+ (i32.load8_u offset=1
+ (local.get $0)
+ )
+ (i32.const 8)
+ )
+ )
+ (i32.or
+ (i32.shl
+ (i32.load8_u offset=2
+ (local.get $0)
+ )
+ (i32.const 16)
+ )
+ (i32.shl
+ (i32.load8_u offset=3
+ (local.get $0)
+ )
+ (i32.const 24)
+ )
+ )
+ )
+ )
+ )
+ (drop
+ (block (result i32)
+ (local.set $1
+ (i32.const 4)
+ )
+ (i32.or
+ (i32.load16_u
+ (local.get $1)
+ )
+ (i32.shl
+ (i32.load16_u offset=2
+ (local.get $1)
+ )
+ (i32.const 16)
+ )
+ )
+ )
+ )
+ (drop
+ (i32.load
+ (i32.const 4)
+ )
+ )
+ (drop
+ (i32.load offset=100
+ (i32.const 4)
+ )
+ )
+ (drop
+ (block (result i32)
+ (local.set $2
+ (i32.const 4)
+ )
+ (i32.or
+ (i32.or
+ (i32.load8_u offset=100
+ (local.get $2)
+ )
+ (i32.shl
+ (i32.load8_u offset=101
+ (local.get $2)
+ )
+ (i32.const 8)
+ )
+ )
+ (i32.or
+ (i32.shl
+ (i32.load8_u offset=102
+ (local.get $2)
+ )
+ (i32.const 16)
+ )
+ (i32.shl
+ (i32.load8_u offset=103
+ (local.get $2)
+ )
+ (i32.const 24)
+ )
+ )
+ )
+ )
+ )
+ (drop
+ (block (result i32)
+ (local.set $3
+ (i32.const 4)
+ )
+ (i32.or
+ (i32.load16_u offset=100
+ (local.get $3)
+ )
+ (i32.shl
+ (i32.load16_u offset=102
+ (local.get $3)
+ )
+ (i32.const 16)
+ )
+ )
+ )
+ )
+ (drop
+ (i32.load offset=100
+ (i32.const 4)
+ )
+ )
+ (drop
+ (unreachable)
+ )
+ (i32.store
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (block
+ (local.set $4
+ (i32.const 4)
+ )
+ (local.set $5
+ (i32.const 8)
+ )
+ (i32.store8
+ (local.get $4)
+ (local.get $5)
+ )
+ (i32.store8 offset=1
+ (local.get $4)
+ (i32.shr_u
+ (local.get $5)
+ (i32.const 8)
+ )
+ )
+ (i32.store8 offset=2
+ (local.get $4)
+ (i32.shr_u
+ (local.get $5)
+ (i32.const 16)
+ )
+ )
+ (i32.store8 offset=3
+ (local.get $4)
+ (i32.shr_u
+ (local.get $5)
+ (i32.const 24)
+ )
+ )
+ )
+ (block
+ (local.set $6
+ (i32.const 4)
+ )
+ (local.set $7
+ (i32.const 8)
+ )
+ (i32.store16
+ (local.get $6)
+ (local.get $7)
+ )
+ (i32.store16 offset=2
+ (local.get $6)
+ (i32.shr_u
+ (local.get $7)
+ (i32.const 16)
+ )
+ )
+ )
+ (i32.store
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (i32.store offset=100
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (block
+ (local.set $8
+ (i32.const 4)
+ )
+ (local.set $9
+ (i32.const 8)
+ )
+ (i32.store8 offset=100
+ (local.get $8)
+ (local.get $9)
+ )
+ (i32.store8 offset=101
+ (local.get $8)
+ (i32.shr_u
+ (local.get $9)
+ (i32.const 8)
+ )
+ )
+ (i32.store8 offset=102
+ (local.get $8)
+ (i32.shr_u
+ (local.get $9)
+ (i32.const 16)
+ )
+ )
+ (i32.store8 offset=103
+ (local.get $8)
+ (i32.shr_u
+ (local.get $9)
+ (i32.const 24)
+ )
+ )
+ )
+ (block
+ (local.set $10
+ (i32.const 4)
+ )
+ (local.set $11
+ (i32.const 8)
+ )
+ (i32.store16 offset=100
+ (local.get $10)
+ (local.get $11)
+ )
+ (i32.store16 offset=102
+ (local.get $10)
+ (i32.shr_u
+ (local.get $11)
+ (i32.const 16)
+ )
+ )
+ )
+ (i32.store offset=100
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (block
+ (drop
+ (unreachable)
+ )
+ (drop
+ (i32.const 8)
+ )
+ )
+ (block
+ (drop
+ (i32.const 4)
+ )
+ (drop
+ (unreachable)
+ )
+ )
+ )
+ (func $func_2 (; 1 ;) (type $0)
+ (local $0 i32)
+ (local $1 i32)
+ (local $2 i32)
+ (local $3 i32)
+ (local $4 i32)
+ (local $5 i32)
+ (drop
+ (i32.load16_u
+ (i32.const 4)
+ )
+ )
+ (drop
+ (block (result i32)
+ (local.set $0
+ (i32.const 4)
+ )
+ (i32.or
+ (i32.load8_u
+ (local.get $0)
+ )
+ (i32.shl
+ (i32.load8_u offset=1
+ (local.get $0)
+ )
+ (i32.const 8)
+ )
+ )
+ )
+ )
+ (drop
+ (i32.load16_u
+ (i32.const 4)
+ )
+ )
+ (drop
+ (i32.load16_u offset=100
+ (i32.const 4)
+ )
+ )
+ (drop
+ (block (result i32)
+ (local.set $1
+ (i32.const 4)
+ )
+ (i32.or
+ (i32.load8_u offset=100
+ (local.get $1)
+ )
+ (i32.shl
+ (i32.load8_u offset=101
+ (local.get $1)
+ )
+ (i32.const 8)
+ )
+ )
+ )
+ )
+ (drop
+ (i32.load16_u offset=100
+ (i32.const 4)
+ )
+ )
+ (drop
+ (unreachable)
+ )
+ (i32.store16
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (block
+ (local.set $2
+ (i32.const 4)
+ )
+ (local.set $3
+ (i32.const 8)
+ )
+ (i32.store8
+ (local.get $2)
+ (local.get $3)
+ )
+ (i32.store8 offset=1
+ (local.get $2)
+ (i32.shr_u
+ (local.get $3)
+ (i32.const 8)
+ )
+ )
+ )
+ (i32.store16
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (i32.store16 offset=100
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (block
+ (local.set $4
+ (i32.const 4)
+ )
+ (local.set $5
+ (i32.const 8)
+ )
+ (i32.store8 offset=100
+ (local.get $4)
+ (local.get $5)
+ )
+ (i32.store8 offset=101
+ (local.get $4)
+ (i32.shr_u
+ (local.get $5)
+ (i32.const 8)
+ )
+ )
+ )
+ (i32.store16 offset=100
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (block
+ (drop
+ (unreachable)
+ )
+ (drop
+ (i32.const 8)
+ )
+ )
+ (block
+ (drop
+ (i32.const 4)
+ )
+ (drop
+ (unreachable)
+ )
+ )
+ )
+ (func $func_1 (; 2 ;) (type $0)
+ (drop
+ (i32.load8_u
+ (i32.const 4)
+ )
+ )
+ (drop
+ (i32.load8_u
+ (i32.const 4)
+ )
+ )
+ (drop
+ (i32.load8_u offset=100
+ (i32.const 4)
+ )
+ )
+ (drop
+ (i32.load8_u offset=100
+ (i32.const 4)
+ )
+ )
+ (drop
+ (unreachable.load offset=100
+ (unreachable)
+ )
+ )
+ (i32.store8
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (i32.store8
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (i32.store8 offset=100
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (i32.store8 offset=100
+ (i32.const 4)
+ (i32.const 8)
+ )
+ (i32.store8 offset=100
+ (unreachable)
+ (i32.const 8)
+ )
+ (i32.store8 offset=100
+ (i32.const 4)
+ (unreachable)
+ )
+ )
+ (func $func_signed (; 3 ;) (type $0)
+ (local $0 i32)
+ (local $1 i32)
+ (drop
+ (i32.load16_s
+ (i32.const 4)
+ )
+ )
+ (drop
+ (block (result i32)
+ (local.set $0
+ (i32.const 4)
+ )
+ (i32.shr_s
+ (i32.shl
+ (i32.or
+ (i32.load8_u
+ (local.get $0)
+ )
+ (i32.shl
+ (i32.load8_u offset=1
+ (local.get $0)
+ )
+ (i32.const 8)
+ )
+ )
+ (i32.const 16)
+ )
+ (i32.const 16)
+ )
+ )
+ )
+ (drop
+ (i32.load16_s
+ (i32.const 4)
+ )
+ )
+ (drop
+ (i32.load16_s offset=100
+ (i32.const 4)
+ )
+ )
+ (drop
+ (block (result i32)
+ (local.set $1
+ (i32.const 4)
+ )
+ (i32.shr_s
+ (i32.shl
+ (i32.or
+ (i32.load8_u offset=100
+ (local.get $1)
+ )
+ (i32.shl
+ (i32.load8_u offset=101
+ (local.get $1)
+ )
+ (i32.const 8)
+ )
+ )
+ (i32.const 16)
+ )
+ (i32.const 16)
+ )
+ )
+ )
+ (drop
+ (i32.load16_s offset=100
+ (i32.const 4)
+ )
+ )
+ (drop
+ (unreachable)
+ )
+ )
+)
diff --git a/test/passes/alignment-lowering.wast b/test/passes/alignment-lowering.wast
new file mode 100644
index 000000000..135fd281e
--- /dev/null
+++ b/test/passes/alignment-lowering.wast
@@ -0,0 +1,63 @@
+(module
+ (memory $0 1 1)
+ (func $func_4
+ (drop (i32.load (i32.const 4)))
+ (drop (i32.load align=1 (i32.const 4)))
+ (drop (i32.load align=2 (i32.const 4)))
+ (drop (i32.load align=4 (i32.const 4)))
+ (drop (i32.load offset=100 (i32.const 4)))
+ (drop (i32.load offset=100 align=1 (i32.const 4)))
+ (drop (i32.load offset=100 align=2 (i32.const 4)))
+ (drop (i32.load offset=100 align=4 (i32.const 4)))
+ (drop (i32.load offset=100 align=1 (unreachable)))
+ (i32.store (i32.const 4) (i32.const 8))
+ (i32.store align=1 (i32.const 4) (i32.const 8))
+ (i32.store align=2 (i32.const 4) (i32.const 8))
+ (i32.store align=4 (i32.const 4) (i32.const 8))
+ (i32.store offset=100 (i32.const 4) (i32.const 8))
+ (i32.store offset=100 align=1 (i32.const 4) (i32.const 8))
+ (i32.store offset=100 align=2 (i32.const 4) (i32.const 8))
+ (i32.store offset=100 align=4 (i32.const 4) (i32.const 8))
+ (i32.store offset=100 align=1 (unreachable) (i32.const 8))
+ (i32.store offset=100 align=1 (i32.const 4) (unreachable))
+ )
+ (func $func_2
+ (drop (i32.load16_u (i32.const 4)))
+ (drop (i32.load16_u align=1 (i32.const 4)))
+ (drop (i32.load16_u align=2 (i32.const 4)))
+ (drop (i32.load16_u offset=100 (i32.const 4)))
+ (drop (i32.load16_u offset=100 align=1 (i32.const 4)))
+ (drop (i32.load16_u offset=100 align=2 (i32.const 4)))
+ (drop (i32.load16_u offset=100 align=1 (unreachable)))
+ (i32.store16 (i32.const 4) (i32.const 8))
+ (i32.store16 align=1 (i32.const 4) (i32.const 8))
+ (i32.store16 align=2 (i32.const 4) (i32.const 8))
+ (i32.store16 offset=100 (i32.const 4) (i32.const 8))
+ (i32.store16 offset=100 align=1 (i32.const 4) (i32.const 8))
+ (i32.store16 offset=100 align=2 (i32.const 4) (i32.const 8))
+ (i32.store16 offset=100 align=1 (unreachable) (i32.const 8))
+ (i32.store16 offset=100 align=1 (i32.const 4) (unreachable))
+ )
+ (func $func_1
+ (drop (i32.load8_u (i32.const 4)))
+ (drop (i32.load8_u align=1 (i32.const 4)))
+ (drop (i32.load8_u offset=100 (i32.const 4)))
+ (drop (i32.load8_u offset=100 align=1 (i32.const 4)))
+ (drop (i32.load8_u offset=100 align=1 (unreachable)))
+ (i32.store8 (i32.const 4) (i32.const 8))
+ (i32.store8 align=1 (i32.const 4) (i32.const 8))
+ (i32.store8 offset=100 (i32.const 4) (i32.const 8))
+ (i32.store8 offset=100 align=1 (i32.const 4) (i32.const 8))
+ (i32.store8 offset=100 align=1 (unreachable) (i32.const 8))
+ (i32.store8 offset=100 align=1 (i32.const 4) (unreachable))
+ )
+ (func $func_signed
+ (drop (i32.load16_s (i32.const 4)))
+ (drop (i32.load16_s align=1 (i32.const 4)))
+ (drop (i32.load16_s align=2 (i32.const 4)))
+ (drop (i32.load16_s offset=100 (i32.const 4)))
+ (drop (i32.load16_s offset=100 align=1 (i32.const 4)))
+ (drop (i32.load16_s offset=100 align=2 (i32.const 4)))
+ (drop (i32.load16_s offset=100 align=1 (unreachable)))
+ )
+)