aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-10-05 14:23:47 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-10-05 14:24:00 +0200
commit7ddb4265d30ef30df6e7098c979334109378357c (patch)
tree95e9f5785ba5f46c8a362d6600e843363ac1fcf1 /tests
parent7a61f213fb9be8ab7f9bd0fb33940b21fa143b05 (diff)
downloadAGH-engineering-thesis-7ddb4265d30ef30df6e7098c979334109378357c.tar.gz
AGH-engineering-thesis-7ddb4265d30ef30df6e7098c979334109378357c.zip
fixes, add_sp instruciton and translation of br instruction from wasm
Diffstat (limited to 'tests')
l---------tests/wasm_compile_br/Makefile1
-rw-r--r--tests/wasm_compile_br/instructions.wat23
l---------tests/wasm_compile_br/test.v1
l---------tests/wasm_compile_br/words_to_verify.mem1
4 files changed, 26 insertions, 0 deletions
diff --git a/tests/wasm_compile_br/Makefile b/tests/wasm_compile_br/Makefile
new file mode 120000
index 0000000..e451c8b
--- /dev/null
+++ b/tests/wasm_compile_br/Makefile
@@ -0,0 +1 @@
+../wasm_compile_simple_module/Makefile \ No newline at end of file
diff --git a/tests/wasm_compile_br/instructions.wat b/tests/wasm_compile_br/instructions.wat
new file mode 100644
index 0000000..cc7b370
--- /dev/null
+++ b/tests/wasm_compile_br/instructions.wat
@@ -0,0 +1,23 @@
+;;; this test is based on wasm_compile_if_else
+(module
+ (memory 0 2)
+ (func $eq10 (param $x i32) (result i32)
+ (if (result i32)
+ (i32.sub
+ (get_local $x)
+ (i32.const 10))
+ (then
+ (br 1 (i32.add (i32.const -3) (i32.const 3)))
+ ;; unreachable instruction
+ ;; (i32.const 5)
+ )
+ (else
+ (i32.const -1))))
+ (func $main
+ ;; write 0x00000000 at MEMORY_BOTTOM_ADDR
+ (i32.store offset=0x0 align=2 (i32.const 0x0)
+ (call $eq10 (i32.const 12)))
+ ;; write 0xFFFFFFFF at MEMORY_BOTTOM_ADDR + 0x4
+ (i32.store offset=0x0 align=2 (i32.const 0x4)
+ (call $eq10 (i32.const 10))))
+ (export "main" (func $main)))
diff --git a/tests/wasm_compile_br/test.v b/tests/wasm_compile_br/test.v
new file mode 120000
index 0000000..f0235d8
--- /dev/null
+++ b/tests/wasm_compile_br/test.v
@@ -0,0 +1 @@
+../wasm_compile_simple_module/test.v \ No newline at end of file
diff --git a/tests/wasm_compile_br/words_to_verify.mem b/tests/wasm_compile_br/words_to_verify.mem
new file mode 120000
index 0000000..8e12d5b
--- /dev/null
+++ b/tests/wasm_compile_br/words_to_verify.mem
@@ -0,0 +1 @@
+../wasm_compile_if_else/words_to_verify.mem \ No newline at end of file