diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dot_s/em_js.s | 31 | ||||
-rw-r--r-- | test/dot_s/em_js.wast | 48 |
2 files changed, 79 insertions, 0 deletions
diff --git a/test/dot_s/em_js.s b/test/dot_s/em_js.s new file mode 100644 index 000000000..4f6b46898 --- /dev/null +++ b/test/dot_s/em_js.s @@ -0,0 +1,31 @@ + .text + .file "/tmp/tmpkxUaTH/a.out.bc" + .globl main + .type main,@function +main: # @main + .result i32 +# BB#0: + i32.const $push0=, 15 + i32.call $push1=, foo@FUNCTION, $pop0 + return $pop1 + .endfunc +.Lfunc_end0: + .size main, .Lfunc_end0-main + + .globl __em_js__foo + .type __em_js__foo,@function +__em_js__foo: # @__em_js__foo + .result i32 +# BB#0: + i32.const $push1=, .str + .endfunc +.Lfunc_end0: + .size __em_js__foo, .Lfunc_end0-__em_js__foo + + .type .str,@object # @.str + .data +.str: + .asciz "(int x)<::>{ Module.print(\"got x=\" + x); }" + .size .str, 43 + + .functype foo, i32, i32 diff --git a/test/dot_s/em_js.wast b/test/dot_s/em_js.wast new file mode 100644 index 000000000..14cd7b686 --- /dev/null +++ b/test/dot_s/em_js.wast @@ -0,0 +1,48 @@ +(module + (type $FUNCSIG$ii (func (param i32) (result i32))) + (import "env" "foo" (func $foo (param i32) (result i32))) + (import "env" "memory" (memory $0 1)) + (table 0 anyfunc) + (data (i32.const 16) "(int x)<::>{ Module.print(\"got x=\" + x); }\00") + (export "main" (func $main)) + (export "stackSave" (func $stackSave)) + (export "stackAlloc" (func $stackAlloc)) + (export "stackRestore" (func $stackRestore)) + (func $main (; 1 ;) (result i32) + (return + (call $foo + (i32.const 15) + ) + ) + ) + (func $stackSave (; 2 ;) (result i32) + (i32.load offset=4 + (i32.const 0) + ) + ) + (func $stackAlloc (; 3 ;) (param $0 i32) (result i32) + (local $1 i32) + (i32.store offset=4 + (i32.const 0) + (tee_local $1 + (i32.and + (i32.sub + (i32.load offset=4 + (i32.const 0) + ) + (get_local $0) + ) + (i32.const -16) + ) + ) + ) + (get_local $1) + ) + (func $stackRestore (; 4 ;) (param $0 i32) + (i32.store offset=4 + (i32.const 0) + (get_local $0) + ) + ) +) +;; METADATA: { "asmConsts": {},"emJsFuncs": {"foo": "(int x)<::>{ Module.print(\"got x=\" + x); }"},"staticBump": 59, "initializers": [], "declares": [], "externs": [], "implementedFunctions": ["_main","_stackSave","_stackAlloc","_stackRestore"], "exports": ["main","stackSave","stackAlloc","stackRestore"] } |