diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dot_s/basics.wast | 3 | ||||
-rw-r--r-- | test/dot_s/bcp-1.wast | 72 | ||||
m--------- | test/emscripten | 0 | ||||
-rw-r--r-- | test/llvm_autogenerated/call.wast | 6 | ||||
-rw-r--r-- | test/llvm_autogenerated/memory-addr32.wast | 4 | ||||
-rw-r--r-- | test/llvm_autogenerated/memory-addr64.wast | 4 | ||||
-rw-r--r-- | test/min.asm.js | 18 | ||||
-rw-r--r-- | test/min.fromasm | 13 | ||||
-rw-r--r-- | test/min.fromasm.imprecise | 13 | ||||
-rw-r--r-- | test/unit.asm.js | 19 | ||||
-rw-r--r-- | test/unit.fromasm | 13 | ||||
-rw-r--r-- | test/unit.fromasm.imprecise | 13 | ||||
-rw-r--r-- | test/wasm_backend/hello_world_real.cpp | 6 | ||||
-rw-r--r-- | test/wasm_backend/hello_world_real.txt | 1 | ||||
-rw-r--r-- | test/wasm_backend/indirect_call.cpp | 4 | ||||
-rw-r--r-- | test/wasm_backend/indirect_call.txt | 8 |
16 files changed, 143 insertions, 54 deletions
diff --git a/test/dot_s/basics.wast b/test/dot_s/basics.wast index 8fc8c3d67..91620910c 100644 --- a/test/dot_s/basics.wast +++ b/test/dot_s/basics.wast @@ -6,10 +6,11 @@ ) (export "memory" memory) (type $FUNCSIG$vi (func (param i32))) + (type $FUNCSIG$iii (func (param i32 i32) (result i32))) (import $puts "env" "puts" (param i32)) (export "main" $main) (table $main) - (func $main (param $$0 i32) (param $$1 i32) (result i32) + (func $main (type $FUNCSIG$iii) (param $$0 i32) (param $$1 i32) (result i32) (call_import $puts (i32.const 16) ) diff --git a/test/dot_s/bcp-1.wast b/test/dot_s/bcp-1.wast index f558e06e0..091dff695 100644 --- a/test/dot_s/bcp-1.wast +++ b/test/dot_s/bcp-1.wast @@ -9,8 +9,8 @@ (segment 100 "\00\00\00\00") ) (export "memory" memory) - (type $FUNCSIG_i (func (result i32))) - (type $FUNCSIG_ii (func (param i32) (result i32))) + (type $FUNCSIG$i (func (result i32))) + (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$vi (func (param i32))) (type $FUNCSIG$v (func)) (import $exit "env" "exit" (param i32)) @@ -34,87 +34,87 @@ (export "opt2" $opt2) (export "main" $main) (table $bad0 $bad1 $bad5 $bad7 $bad8 $bad10 $bad2 $bad3 $bad6 $bad4 $bad9 $good0 $good1 $good2 $opt0 $opt1 $opt2) - (func $bad0 (result i32) + (func $bad0 (type $FUNCSIG$i) (result i32) (return (i32.const 0) ) ) - (func $bad1 (result i32) + (func $bad1 (type $FUNCSIG$i) (result i32) (return (i32.const 0) ) ) - (func $bad2 (param $$0 i32) (result i32) + (func $bad2 (type $FUNCSIG$ii) (param $$0 i32) (result i32) (return (i32.const 0) ) ) - (func $bad3 (param $$0 i32) (result i32) + (func $bad3 (type $FUNCSIG$ii) (param $$0 i32) (result i32) (return (i32.const 0) ) ) - (func $bad4 (param $$0 i32) (result i32) + (func $bad4 (type $FUNCSIG$ii) (param $$0 i32) (result i32) (return (i32.const 0) ) ) - (func $bad5 (result i32) + (func $bad5 (type $FUNCSIG$i) (result i32) (return (i32.const 0) ) ) - (func $bad6 (param $$0 i32) (result i32) + (func $bad6 (type $FUNCSIG$ii) (param $$0 i32) (result i32) (return (i32.const 0) ) ) - (func $bad7 (result i32) + (func $bad7 (type $FUNCSIG$i) (result i32) (return (i32.const 0) ) ) - (func $bad8 (result i32) + (func $bad8 (type $FUNCSIG$i) (result i32) (return (i32.const 0) ) ) - (func $bad9 (param $$0 i32) (result i32) + (func $bad9 (type $FUNCSIG$ii) (param $$0 i32) (result i32) (return (i32.const 0) ) ) - (func $bad10 (result i32) + (func $bad10 (type $FUNCSIG$i) (result i32) (return (i32.const 0) ) ) - (func $good0 (result i32) + (func $good0 (type $FUNCSIG$i) (result i32) (return (i32.const 1) ) ) - (func $good1 (result i32) + (func $good1 (type $FUNCSIG$i) (result i32) (return (i32.const 1) ) ) - (func $good2 (result i32) + (func $good2 (type $FUNCSIG$i) (result i32) (return (i32.const 1) ) ) - (func $opt0 (result i32) + (func $opt0 (type $FUNCSIG$i) (result i32) (return (i32.const 0) ) ) - (func $opt1 (result i32) + (func $opt1 (type $FUNCSIG$i) (result i32) (return (i32.const 0) ) ) - (func $opt2 (result i32) + (func $opt2 (type $FUNCSIG$i) (result i32) (return (i32.const 1) ) @@ -128,42 +128,42 @@ ) (block $label$0 (br_if $label$0 - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=16 (get_local $$0) ) ) ) (br_if $label$0 - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=20 (get_local $$0) ) ) ) (br_if $label$0 - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=24 (get_local $$0) ) ) ) (br_if $label$0 - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=28 (get_local $$0) ) ) ) (br_if $label$0 - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=32 (get_local $$0) ) ) ) (br_if $label$0 - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=36 (get_local $$0) ) @@ -179,13 +179,13 @@ ) (block $label$1 (br_if $label$1 - (call_indirect $FUNCSIG_ii + (call_indirect $FUNCSIG$ii (get_local $$1) (get_local $$2) ) ) (br_if $label$1 - (call_indirect $FUNCSIG_ii + (call_indirect $FUNCSIG$ii (i32.load offset=44 (get_local $$0) ) @@ -193,7 +193,7 @@ ) ) (br_if $label$1 - (call_indirect $FUNCSIG_ii + (call_indirect $FUNCSIG$ii (i32.load offset=48 (get_local $$0) ) @@ -210,13 +210,13 @@ ) (block $label$2 (br_if $label$2 - (call_indirect $FUNCSIG_ii + (call_indirect $FUNCSIG$ii (get_local $$1) (get_local $$2) ) ) (br_if $label$2 - (call_indirect $FUNCSIG_ii + (call_indirect $FUNCSIG$ii (i32.load offset=56 (get_local $$0) ) @@ -226,7 +226,7 @@ (block $label$3 (br_if $label$3 (i32.eq - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=60 (get_local $$0) ) @@ -236,7 +236,7 @@ ) (br_if $label$3 (i32.eq - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=64 (get_local $$0) ) @@ -246,7 +246,7 @@ ) (br_if $label$3 (i32.eq - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=68 (get_local $$0) ) @@ -257,7 +257,7 @@ (block $label$4 (br_if $label$4 (i32.eq - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=72 (get_local $$0) ) @@ -267,7 +267,7 @@ ) (br_if $label$4 (i32.eq - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=76 (get_local $$0) ) @@ -277,7 +277,7 @@ ) (br_if $label$4 (i32.eq - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (i32.load offset=80 (get_local $$0) ) diff --git a/test/emscripten b/test/emscripten -Subproject 27c6f3a613a8c8bfddf6658c3f3eb3daa8ffe5d +Subproject e480c6ed0194fc72c866c9d2eef697c221d1ae2 diff --git a/test/llvm_autogenerated/call.wast b/test/llvm_autogenerated/call.wast index cebd9dd6e..9f6c3dfb8 100644 --- a/test/llvm_autogenerated/call.wast +++ b/test/llvm_autogenerated/call.wast @@ -8,8 +8,6 @@ (type $FUNCSIG$v (func)) (type $FUNCSIG$ii (func (param i32) (result i32))) (type $FUNCSIG$iii (func (param i32 i32) (result i32))) - (type $FUNCSIG_v (func)) - (type $FUNCSIG_i (func (result i32))) (import $i32_nullary "env" "i32_nullary" (result i32)) (import $i64_nullary "env" "i64_nullary" (result i64)) (import $float_nullary "env" "float_nullary" (result f32)) @@ -69,14 +67,14 @@ ) ) (func $call_indirect_void (param $$0 i32) - (call_indirect $FUNCSIG_v + (call_indirect $FUNCSIG$v (get_local $$0) ) (return) ) (func $call_indirect_i32 (param $$0 i32) (result i32) (return - (call_indirect $FUNCSIG_i + (call_indirect $FUNCSIG$i (get_local $$0) ) ) diff --git a/test/llvm_autogenerated/memory-addr32.wast b/test/llvm_autogenerated/memory-addr32.wast index 00d1829b2..6e42c7b59 100644 --- a/test/llvm_autogenerated/memory-addr32.wast +++ b/test/llvm_autogenerated/memory-addr32.wast @@ -9,7 +9,9 @@ ) ) (func $grow_memory (param $$0 i32) - (memory_size) + (grow_memory + (get_local $$0) + ) (return) ) ) diff --git a/test/llvm_autogenerated/memory-addr64.wast b/test/llvm_autogenerated/memory-addr64.wast index 06bbf6e11..a7085e3d2 100644 --- a/test/llvm_autogenerated/memory-addr64.wast +++ b/test/llvm_autogenerated/memory-addr64.wast @@ -9,7 +9,9 @@ ) ) (func $grow_memory (param $$0 i64) - (memory_size) + (grow_memory + (get_local $$0) + ) (return) ) ) diff --git a/test/min.asm.js b/test/min.asm.js index 77e54caab..ed5d186f5 100644 --- a/test/min.asm.js +++ b/test/min.asm.js @@ -6,6 +6,17 @@ function (global, env, buffer) { var fr = global.Math.fround; + var tDP = env.tempDoublePtr | 0; + + var h8 = new global.Int8Array(buffer); + var h16 = new global.Int16Array(buffer); + var h32 = new global.Int32Array(buffer); + var hU8 = new global.Uint8Array(buffer); + var hU16 = new global.Uint16Array(buffer); + var hU32 = new global.Uint32Array(buffer); + var hF32 = new global.Float32Array(buffer); + var hF64 = new global.Float64Array(buffer); + function floats(f) { f = fr(f); var t = fr(0); @@ -18,6 +29,13 @@ function (global, env, buffer) { n = fr(-(c[k >> 2] = p, fr(g[k >> 2]))); return n; } + function bitcasts(i, f) { + i = i | 0; + f = Math_fround(f); + (h32[tDP >> 2] = i, fr(hF32[tDP >> 2])); // i32->f32 + (h32[tDP >> 2] = i, +hF32[tDP >> 2]); // i32->f32, no fround + (hF32[tDP >> 2] = f, h32[tDP >> 2] | 0); // f32->i32 + } return { floats: floats }; } diff --git a/test/min.fromasm b/test/min.fromasm index 839fd167c..564980a96 100644 --- a/test/min.fromasm +++ b/test/min.fromasm @@ -30,4 +30,17 @@ (get_local $n) ) ) + (func $bitcasts (param $i i32) (param $f f32) + (f32.reinterpret/i32 + (get_local $i) + ) + (f64.promote/f32 + (f32.reinterpret/i32 + (get_local $i) + ) + ) + (i32.reinterpret/f32 + (get_local $f) + ) + ) ) diff --git a/test/min.fromasm.imprecise b/test/min.fromasm.imprecise index 839fd167c..564980a96 100644 --- a/test/min.fromasm.imprecise +++ b/test/min.fromasm.imprecise @@ -30,4 +30,17 @@ (get_local $n) ) ) + (func $bitcasts (param $i i32) (param $f f32) + (f32.reinterpret/i32 + (get_local $i) + ) + (f64.promote/f32 + (f32.reinterpret/i32 + (get_local $i) + ) + ) + (i32.reinterpret/f32 + (get_local $f) + ) + ) ) diff --git a/test/unit.asm.js b/test/unit.asm.js index 5bb84bdcd..cd432da5c 100644 --- a/test/unit.asm.js +++ b/test/unit.asm.js @@ -1,4 +1,4 @@ -function asm() { +function asm(global, env, buffer) { "use asm"; var t = global.NaN, u = global.Infinity; @@ -7,11 +7,21 @@ function asm() { var Math_fround = global.Math.fround; var Math_abs = global.Math.abs; var Math_ceil = global.Math.ceil; + var tempDoublePtr = env.tempDoublePtr | 0; var abort = env.abort; var print = env.print; var h = env.h; + var HEAP8 = new global.Int8Array(buffer); + var HEAP16 = new global.Int16Array(buffer); + var HEAP32 = new global.Int32Array(buffer); + var HEAPU8 = new global.Uint8Array(buffer); + var HEAPU16 = new global.Uint16Array(buffer); + var HEAPU32 = new global.Uint32Array(buffer); + var HEAPF32 = new global.Float32Array(buffer); + var HEAPF64 = new global.Float64Array(buffer); + function big_negative() { var temp = 0.0; temp = +-2147483648; @@ -190,6 +200,13 @@ function asm() { print(2); } } + function bitcasts(i, f) { + i = i | 0; + f = Math_fround(f); + (HEAP32[tempDoublePtr >> 2] = i, Math_fround(HEAPF32[tempDoublePtr >> 2])); // i32->f32 + (HEAP32[tempDoublePtr >> 2] = i, +HEAPF32[tempDoublePtr >> 2]); // i32->f32, no fround + (HEAPF32[tempDoublePtr >> 2] = f, HEAP32[tempDoublePtr >> 2] | 0); // f32->i32 + } function z() { } diff --git a/test/unit.fromasm b/test/unit.fromasm index 3db25c78b..d7fce8b8f 100644 --- a/test/unit.fromasm +++ b/test/unit.fromasm @@ -516,6 +516,19 @@ (br $while-in$1) ) ) + (func $bitcasts (param $i i32) (param $f f32) + (f32.reinterpret/i32 + (get_local $i) + ) + (f64.promote/f32 + (f32.reinterpret/i32 + (get_local $i) + ) + ) + (i32.reinterpret/f32 + (get_local $f) + ) + ) (func $z (nop) ) diff --git a/test/unit.fromasm.imprecise b/test/unit.fromasm.imprecise index ef9ccaa5d..6383d6e87 100644 --- a/test/unit.fromasm.imprecise +++ b/test/unit.fromasm.imprecise @@ -512,6 +512,19 @@ (br $while-in$1) ) ) + (func $bitcasts (param $i i32) (param $f f32) + (f32.reinterpret/i32 + (get_local $i) + ) + (f64.promote/f32 + (f32.reinterpret/i32 + (get_local $i) + ) + ) + (i32.reinterpret/f32 + (get_local $f) + ) + ) (func $z (nop) ) diff --git a/test/wasm_backend/hello_world_real.cpp b/test/wasm_backend/hello_world_real.cpp new file mode 100644 index 000000000..1e39e8bd4 --- /dev/null +++ b/test/wasm_backend/hello_world_real.cpp @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main() { + printf("hello, world!\n"); +} + diff --git a/test/wasm_backend/hello_world_real.txt b/test/wasm_backend/hello_world_real.txt new file mode 100644 index 000000000..270c611ee --- /dev/null +++ b/test/wasm_backend/hello_world_real.txt @@ -0,0 +1 @@ +hello, world! diff --git a/test/wasm_backend/indirect_call.cpp b/test/wasm_backend/indirect_call.cpp index 75c459199..ef52a4ad1 100644 --- a/test/wasm_backend/indirect_call.cpp +++ b/test/wasm_backend/indirect_call.cpp @@ -37,13 +37,13 @@ int main(int argc, char **argv) { for (int i = 0; i < 4 && i < argc*4; i++) { print("i", i); v curr = f1[i]; - print("curr address to call", (int)curr); + //print("curr address to call", (int)curr); curr(); } vi f2[4] = { other, yet, other, yet }; for (int i = 0; i < 4 && i < argc*4; i++) { vi curr = f2[i]; - print("curr", (int)curr); + //print("curr", (int)curr); curr(i); } } diff --git a/test/wasm_backend/indirect_call.txt b/test/wasm_backend/indirect_call.txt index 8d60cc1ff..8e10834ad 100644 --- a/test/wasm_backend/indirect_call.txt +++ b/test/wasm_backend/indirect_call.txt @@ -2,22 +2,14 @@ print: argc : 1 print: addr of something : 0 print: addr of more : 1 print: i : 0 -print: curr address to call : 0 print: something : 12 print: i : 1 -print: curr address to call : 1 print: more : -1 print: i : 2 -print: curr address to call : 0 print: something : 12 print: i : 3 -print: curr address to call : 1 print: more : -1 -print: curr : 2 print: other : 40 -print: curr : 3 print: yet : 100 -print: curr : 2 print: other : 42 -print: curr : 3 print: yet : 102 |