summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/dot_s/memops.s94
-rw-r--r--test/dot_s/memops.wast222
2 files changed, 316 insertions, 0 deletions
diff --git a/test/dot_s/memops.s b/test/dot_s/memops.s
new file mode 100644
index 000000000..cf8d1db38
--- /dev/null
+++ b/test/dot_s/memops.s
@@ -0,0 +1,94 @@
+ .text
+ .file "/tmp/tmpG0LbqO/a.out.bc"
+ .type _Z6reporti,@function
+_Z6reporti: # @_Z6reporti
+ .param i32
+# BB#0:
+ i32.const $push0=, 8
+ i32.store $discard=, 0($pop0), $0
+ i32.const $push1=, .str
+ call emscripten_asm_const, $pop1
+ return
+func_end0:
+ .size _Z6reporti, func_end0-_Z6reporti
+
+ .globl main
+ .type main,@function
+main: # @main
+ .result i32
+ .local i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 # XXX this was 1 short in the backend output, an extra one was added manually
+# BB#0:
+ i32.const $7=, __stack_pointer
+ i32.load $7=, 0($7)
+ i32.const $8=, 1048576
+ i32.sub $12=, $7, $8
+ i32.const $8=, __stack_pointer
+ i32.store $12=, 0($8), $12
+ i32.const $1=, 0
+ copy_local $0=, $1
+ copy_local $6=, $1
+BB1_1: # %.preheader1
+ # =>This Loop Header: Depth=1
+ # Child Loop BB1_2 Depth 2
+ # Child Loop BB1_3 Depth 2
+ loop BB1_5
+ copy_local $4=, $1
+BB1_2: # Parent Loop BB1_1 Depth=1
+ # => This Inner Loop Header: Depth=2
+ loop BB1_3
+ i32.const $10=, 0
+ i32.add $10=, $12, $10
+ i32.add $push1=, $10, $4
+ i32.add $push0=, $6, $4
+ i32.store8 $discard=, 0($pop1), $pop0
+ i32.const $2=, 1
+ i32.add $4=, $4, $2
+ i32.const $3=, 1048576
+ i32.ne $push2=, $4, $3
+ copy_local $5=, $1
+ br_if $pop2, BB1_2
+BB1_3: # %.preheader
+ # Parent Loop BB1_1 Depth=1
+ # => This Inner Loop Header: Depth=2
+ loop BB1_4
+ i32.const $11=, 0
+ i32.add $11=, $12, $11
+ i32.add $push3=, $11, $5
+ i32.load8_u $push4=, 0($pop3)
+ i32.and $push5=, $pop4, $2
+ i32.add $6=, $pop5, $6
+ i32.add $5=, $5, $2
+ i32.ne $push6=, $5, $3
+ br_if $pop6, BB1_3
+BB1_4: # in Loop: Header=BB1_1 Depth=1
+ i32.const $push7=, 3
+ i32.mul $push8=, $6, $pop7
+ i32.const $push9=, 5
+ i32.div_s $push10=, $6, $pop9
+ i32.add $push11=, $pop8, $pop10
+ i32.const $push12=, 17
+ i32.add $push13=, $pop11, $pop12
+ i32.const $push14=, 65535
+ i32.and $6=, $pop13, $pop14
+ i32.add $0=, $0, $2
+ i32.const $push15=, 100
+ i32.ne $push16=, $0, $pop15
+ br_if $pop16, BB1_1
+BB1_5:
+ call _Z6reporti, $6
+ i32.const $push17=, 0
+ i32.const $9=, 1048576
+ i32.add $12=, $12, $9
+ i32.const $9=, __stack_pointer
+ i32.store $12=, 0($9), $12
+ return $pop17
+func_end1:
+ .size main, func_end1-main
+
+ .type .str,@object # @.str
+ .data
+.str:
+ .asciz "{ Module.print(\"hello, world! \" + HEAP32[8>>2]); }"
+ .size .str, 51
+
+
diff --git a/test/dot_s/memops.wast b/test/dot_s/memops.wast
new file mode 100644
index 000000000..61926bd18
--- /dev/null
+++ b/test/dot_s/memops.wast
@@ -0,0 +1,222 @@
+(module
+ (memory 0 4294967295 (segment 16 "{ Module.print(\"hello, world! \" + HEAP32[8>>2]); }\00"))
+ (import $_emscripten_asm_const_vi "env" "_emscripten_asm_const_vi")
+ (export "_Z6reporti" $_Z6reporti)
+ (export "main" $main)
+ (func $_Z6reporti (param $$0 i32)
+ (block $fake_return_waka123
+ (block
+ (i32.store align=4
+ (i32.const 8)
+ (get_local $$0)
+ )
+ (call_import $_emscripten_asm_const_vi
+ (i32.const 0)
+ )
+ (br $fake_return_waka123)
+ )
+ )
+ )
+ (func $main (result i32)
+ (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)
+ (local $$12 i32)
+ (block $fake_return_waka123
+ (block
+ (set_local $$7
+ (i32.const 0)
+ )
+ (set_local $$7
+ (i32.load align=4
+ (get_local $$7)
+ )
+ )
+ (set_local $$8
+ (i32.const 1048576)
+ )
+ (set_local $$12
+ (i32.sub
+ (get_local $$7)
+ (get_local $$8)
+ )
+ )
+ (set_local $$8
+ (i32.const 0)
+ )
+ (set_local $$12
+ (i32.store align=4
+ (get_local $$8)
+ (get_local $$12)
+ )
+ )
+ (set_local $$1
+ (i32.const 0)
+ )
+ (set_local $$0
+ (get_local $$1)
+ )
+ (set_local $$6
+ (get_local $$1)
+ )
+ (loop $BB1_5 $BB1_1
+ (block
+ (set_local $$4
+ (get_local $$1)
+ )
+ (loop $BB1_3 $BB1_2
+ (block
+ (set_local $$10
+ (i32.const 0)
+ )
+ (set_local $$10
+ (i32.add
+ (get_local $$12)
+ (get_local $$10)
+ )
+ )
+ (i32.store align=8
+ (i32.add
+ (get_local $$10)
+ (get_local $$4)
+ )
+ (i32.add
+ (get_local $$6)
+ (get_local $$4)
+ )
+ )
+ (set_local $$2
+ (i32.const 1)
+ )
+ (set_local $$4
+ (i32.add
+ (get_local $$4)
+ (get_local $$2)
+ )
+ )
+ (set_local $$3
+ (i32.const 1048576)
+ )
+ (set_local $$5
+ (get_local $$1)
+ )
+ (br_if
+ (i32.ne
+ (get_local $$4)
+ (get_local $$3)
+ )
+ $BB1_2
+ )
+ )
+ )
+ (loop $BB1_4 $BB1_3
+ (block
+ (set_local $$11
+ (i32.const 0)
+ )
+ (set_local $$11
+ (i32.add
+ (get_local $$12)
+ (get_local $$11)
+ )
+ )
+ (set_local $$6
+ (i32.add
+ (i32.and
+ (i32.load align=8
+ (i32.add
+ (get_local $$11)
+ (get_local $$5)
+ )
+ )
+ (get_local $$2)
+ )
+ (get_local $$6)
+ )
+ )
+ (set_local $$5
+ (i32.add
+ (get_local $$5)
+ (get_local $$2)
+ )
+ )
+ (br_if
+ (i32.ne
+ (get_local $$5)
+ (get_local $$3)
+ )
+ $BB1_3
+ )
+ )
+ )
+ (set_local $$6
+ (i32.and
+ (i32.add
+ (i32.add
+ (i32.mul
+ (get_local $$6)
+ (i32.const 3)
+ )
+ (i32.div_s
+ (get_local $$6)
+ (i32.const 5)
+ )
+ )
+ (i32.const 17)
+ )
+ (i32.const 65535)
+ )
+ )
+ (set_local $$0
+ (i32.add
+ (get_local $$0)
+ (get_local $$2)
+ )
+ )
+ (br_if
+ (i32.ne
+ (get_local $$0)
+ (i32.const 100)
+ )
+ $BB1_1
+ )
+ )
+ )
+ (call $_Z6reporti
+ (get_local $$6)
+ )
+ (set_local $$9
+ (i32.const 1048576)
+ )
+ (set_local $$12
+ (i32.add
+ (get_local $$12)
+ (get_local $$9)
+ )
+ )
+ (set_local $$9
+ (i32.const 0)
+ )
+ (set_local $$12
+ (i32.store align=4
+ (get_local $$9)
+ (get_local $$12)
+ )
+ )
+ (br $fake_return_waka123
+ (i32.const 0)
+ )
+ )
+ )
+ )
+)
+; METADATA: { "asmConsts": {"0": ["{ Module.print(\"hello, world! \" + HEAP32[8>>2]); }", ["vi"]]} } \ No newline at end of file