diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dot_s/globals.s | 72 | ||||
-rw-r--r-- | test/dot_s/globals.wast | 81 |
2 files changed, 153 insertions, 0 deletions
diff --git a/test/dot_s/globals.s b/test/dot_s/globals.s new file mode 100644 index 000000000..4ea8041a9 --- /dev/null +++ b/test/dot_s/globals.s @@ -0,0 +1,72 @@ + .text + .globl globals + .type globals,@function +globals: + i32.const $push0=, 0 + i32.const $push1=, 7 + i32.store local_global($pop0), $pop1 + i32.const $push2=, 0 + i32.load $drop=, local_global($pop2) + i32.const $drop=, local_global + .endfunc +.Lfunc_end0: + .size globals, .Lfunc_end0-globals + + .globl import_globals + .type import_globals,@function +import_globals: + i32.const $push0=, 0 + i32.const $push1=, 7 + i32.store imported_global($pop0), $pop1 + i32.const $push2=, 0 + i32.load $drop=, imported_global($pop2) + i32.const $drop=, imported_global + .endfunc +.Lfunc_end0: + .size import_globals, .Lfunc_end0-import_globals + + .globl globals_offset + .type globals_offset,@function +globals_offset: + i32.const $push0=, 4 + i32.const $push1=, 7 + i32.store local_global+12($pop0), $pop1 + i32.const $push2=, 8 + i32.load $drop=, local_global-4($pop2) + i32.const $drop=, local_global+16 + .endfunc +.Lfunc_end0: + .size globals_offset, .Lfunc_end0-globals_offset + + .globl import_globals_offset + .type import_globals_offset,@function +import_globals_offset: + i32.const $push0=, 4 + i32.const $push1=, 7 + i32.store imported_global+12($pop0), $pop1 + i32.const $push2=, 8 + i32.load $drop=, imported_global-4($pop2) + i32.const $drop=, imported_global+16 + .endfunc +.Lfunc_end0: + .size import_globals_offset, .Lfunc_end0-import_globals_offset + + .type local_global,@object + .p2align 2 +local_global: + .int32 17 + .size local_global, 4 + + .type initialized_with_global,@object + .p2align 2 +initialized_with_global: + .int32 local_global + .size initialized_with_global, 4 + + .type initialized_with_global_offset,@object + .p2align 2 +initialized_with_global_offset: + .int32 local_global+2 + .size initialized_with_global_offset, 4 + + .import_global imported_global diff --git a/test/dot_s/globals.wast b/test/dot_s/globals.wast new file mode 100644 index 000000000..d6a164de6 --- /dev/null +++ b/test/dot_s/globals.wast @@ -0,0 +1,81 @@ +(module + (import "env" "memory" (memory $0 1)) + (import "env" "imported_global" (global $imported_global i32)) + (table 0 anyfunc) + (data (i32.const 12) "\11\00\00\00") + (data (i32.const 16) "\0c\00\00\00") + (data (i32.const 20) "\0e\00\00\00") + (export "globals" (func $globals)) + (export "import_globals" (func $import_globals)) + (export "globals_offset" (func $globals_offset)) + (export "import_globals_offset" (func $import_globals_offset)) + (func $globals + (i32.store offset=12 + (i32.const 0) + (i32.const 7) + ) + (drop + (i32.load offset=12 + (i32.const 0) + ) + ) + (drop + (i32.const 12) + ) + ) + (func $import_globals + (i32.store + (get_global $imported_global) + (i32.const 7) + ) + (drop + (i32.load + (get_global $imported_global) + ) + ) + (drop + (get_global $imported_global) + ) + ) + (func $globals_offset + (i32.store offset=24 + (i32.const 4) + (i32.const 7) + ) + (drop + (i32.load offset=8 + (i32.const 8) + ) + ) + (drop + (i32.const 28) + ) + ) + (func $import_globals_offset + (i32.store offset=12 + (i32.add + (i32.const 4) + (get_global $imported_global) + ) + (i32.const 7) + ) + (drop + (i32.load + (i32.add + (i32.const 8) + (i32.add + (i32.const -4) + (get_global $imported_global) + ) + ) + ) + ) + (drop + (i32.add + (i32.const 16) + (get_global $imported_global) + ) + ) + ) +) +;; METADATA: { "asmConsts": {},"staticBump": 24, "initializers": [] } |