aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-09-21 11:53:13 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-09-21 11:53:13 +0200
commitca4e5c1cca9f0e6db5f564e6786a356bcdffb956 (patch)
treed0d53f9f13bf29271f8207996707d9cd6a7bb76b /tests
parent6dfb056f484e98f627d16a44eca8f6fff87f5f0e (diff)
downloadAGH-engineering-thesis-ca4e5c1cca9f0e6db5f564e6786a356bcdffb956.tar.gz
AGH-engineering-thesis-ca4e5c1cca9f0e6db5f564e6786a356bcdffb956.zip
put function call wasm_compile test in separate bench
Diffstat (limited to 'tests')
l---------tests/wasm_compile_function_call/Makefile1
-rw-r--r--tests/wasm_compile_function_call/instructions.wat13
l---------tests/wasm_compile_function_call/test.v1
-rw-r--r--tests/wasm_compile_function_call/words_to_verify.mem3
-rw-r--r--tests/wasm_compile_simple_module/instructions.wat12
-rw-r--r--tests/wasm_compile_simple_module/words_to_verify.mem2
6 files changed, 24 insertions, 8 deletions
diff --git a/tests/wasm_compile_function_call/Makefile b/tests/wasm_compile_function_call/Makefile
new file mode 120000
index 0000000..e451c8b
--- /dev/null
+++ b/tests/wasm_compile_function_call/Makefile
@@ -0,0 +1 @@
+../wasm_compile_simple_module/Makefile \ No newline at end of file
diff --git a/tests/wasm_compile_function_call/instructions.wat b/tests/wasm_compile_function_call/instructions.wat
new file mode 100644
index 0000000..ad37037
--- /dev/null
+++ b/tests/wasm_compile_function_call/instructions.wat
@@ -0,0 +1,13 @@
+(module
+ (memory 0 2)
+ (func $main
+ i32.const 0x17 ;; dynamic offset for memory store instruction
+ i32.const 0x32 ;; value to substract from
+ i32.const 0x14 ;; value to substract
+ call $sub
+ i32.store offset=0x25 align=2) ;; we store the difference at 0x23C
+ (func $sub (param $lhs i32) (param $rhs i32) (result i32)
+ local.get $lhs
+ local.get $rhs
+ i32.sub)
+ (export "main" (func $main)))
diff --git a/tests/wasm_compile_function_call/test.v b/tests/wasm_compile_function_call/test.v
new file mode 120000
index 0000000..f0235d8
--- /dev/null
+++ b/tests/wasm_compile_function_call/test.v
@@ -0,0 +1 @@
+../wasm_compile_simple_module/test.v \ No newline at end of file
diff --git a/tests/wasm_compile_function_call/words_to_verify.mem b/tests/wasm_compile_function_call/words_to_verify.mem
new file mode 100644
index 0000000..bd24e95
--- /dev/null
+++ b/tests/wasm_compile_function_call/words_to_verify.mem
@@ -0,0 +1,3 @@
+// address value
+ 0FFFFC 23
+ 23C 1E // Address is 0x200 + 0x25 + 0x17
diff --git a/tests/wasm_compile_simple_module/instructions.wat b/tests/wasm_compile_simple_module/instructions.wat
index 7579a46..bdf8a16 100644
--- a/tests/wasm_compile_simple_module/instructions.wat
+++ b/tests/wasm_compile_simple_module/instructions.wat
@@ -1,9 +1,7 @@
(module
(memory 0 2)
- (func $sub (param $lhs i32) (param $rhs i32);; (result i32)
- i32.const 0x17
- local.get $lhs
- local.get $rhs
- i32.sub
- i32.store offset=0x25 align=2)
- (export "main" (func $sub)))
+ (func $main
+ i32.const 0x1D ;; dynamic offset for memory store instruction
+ i32.const 0x1E ;; value to store
+ i32.store offset=0x1F align=2) ;; we store the difference at 0x23C
+ (export "main" (func $main)))
diff --git a/tests/wasm_compile_simple_module/words_to_verify.mem b/tests/wasm_compile_simple_module/words_to_verify.mem
index bd24e95..d6a16c1 100644
--- a/tests/wasm_compile_simple_module/words_to_verify.mem
+++ b/tests/wasm_compile_simple_module/words_to_verify.mem
@@ -1,3 +1,3 @@
// address value
0FFFFC 23
- 23C 1E // Address is 0x200 + 0x25 + 0x17
+ 23C 1E // Address is 0x200 + 0x1F + 0x1D