diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/wasm-only.asm.js (renamed from test/i64.asm.js) | 85 | ||||
-rw-r--r-- | test/wasm-only.fromasm (renamed from test/i64.fromasm) | 134 | ||||
-rw-r--r-- | test/wasm-only.fromasm.imprecise (renamed from test/i64.fromasm.imprecise) | 104 | ||||
-rw-r--r-- | test/wasm-only.fromasm.imprecise.no-opts (renamed from test/i64.fromasm.imprecise.no-opts) | 233 | ||||
-rw-r--r-- | test/wasm-only.fromasm.no-opts (renamed from test/i64.fromasm.no-opts) | 235 |
5 files changed, 757 insertions, 34 deletions
diff --git a/test/i64.asm.js b/test/wasm-only.asm.js index 8f9bd8626..568687904 100644 --- a/test/i64.asm.js +++ b/test/wasm-only.asm.js @@ -1,5 +1,5 @@ // -// Test i64 support in wasm-only builds. In this case, fastcomp emits code that is +// Test wasm-only builds. In this case, fastcomp emits code that is // not asm.js, it will only ever run as wasm, and contains special intrinsics for // asm2wasm that map LLVM IR into i64s. // @@ -21,7 +21,66 @@ function asm(global, env, buffer) { var illegalImport = env.illegalImport; var illegalImportResult = env.illegalImportResult; + function loads() { + var i = 0, f = fround(0), d = +0; + i = load1(100); + i = load1(101, 0); + i = load2(102); + i = load2(103, 0); + i = load2(104, 1); + i = load2(105, 2); + i = load4(106); + i = load4(107, 0); + i = load4(108, 1); + i = load4(109, 2); + i = load4(110, 4); + f = loadf(111); + f = loadf(112, 0); + f = loadf(113, 1); + f = loadf(114, 2); + f = loadf(115, 4); + d = loadd(116); + d = loadd(117, 0); + d = loadd(118, 1); + d = loadd(119, 2); + d = loadd(120, 4); + d = loadd(121, 8); + } + + function stores() { + var i = 0, f = fround(0), d = +0; + store1(100, i); + store1(101, i, 0); + store2(102, i); + store2(103, i, 0); + store2(104, i, 1); + store2(105, i, 2); + store4(106, i); + store4(107, i, 0); + store4(108, i, 1); + store4(109, i, 2); + store4(110, i, 4); + storef(111, f); + storef(112, f, 0); + storef(113, f, 1); + storef(114, f, 2); + storef(115, f, 4); + stored(116, d); + stored(117, d, 0); + stored(118, d, 1); + stored(119, d, 2); + stored(120, d, 4); + stored(121, d, 8); + } + function test() { + var i = 0, f = fround(0); + // bitcasts + i = i32_bc2i(f); + f = i32_bc2f(i); + } + + function test64() { var x = i64(), y = i64(), z = 0; // define i64 variables using special intrinsic var int32 = 0, float32 = fround(0), float64 = +0; x = i64_const(100, 0); // i64 constant @@ -39,14 +98,16 @@ function asm(global, env, buffer) { x = i64_shl(x, y); x = i64_ashr(x, y); x = i64_lshr(x, y); - x = i64_load(120, 0); // load and store - x = i64_load(120, 2); - x = i64_load(120, 4); - x = i64_load(120, 8); - i64_store(120, x, 0); - i64_store(120, x, 2); - i64_store(120, x, 4); - i64_store(120, x, 8); + x = load8(120, 0); // load and store + x = load8(120); + x = load8(120, 2); + x = load8(120, 4); + x = load8(120, 8); + store8(120, x, 0); + store8(120, x); + store8(120, x, 2); + store8(120, x, 4); + store8(120, x, 8); // comps z = i64_eq(x, y); z = i64_ne(x, y); @@ -83,14 +144,14 @@ function asm(global, env, buffer) { } function arg(x) { // illegal param, but not exported x = i64(x); - i64_store(100, x, 0); + store8(100, x, 0); arg(i64(x)); // "coercion"/"cast" } function illegalParam(a, x, c) { a = 0; x = i64(x); b = +0; - i64_store(100, x, 0); + store8(100, x, 0); illegalParam(0, i64(x), 12.34); // "coercion"/"cast" } function result() { // illegal result, but not exported @@ -158,6 +219,6 @@ function asm(global, env, buffer) { return $waka | 0; } - return { test: test, illegalParam : illegalParam, illegalResult: illegalResult }; + return { test64: test64, illegalParam : illegalParam, illegalResult: illegalResult }; } diff --git a/test/i64.fromasm b/test/wasm-only.fromasm index 5c4a48578..8f3b2fa5c 100644 --- a/test/i64.fromasm +++ b/test/wasm-only.fromasm @@ -1,5 +1,5 @@ (module - (data (get_global $memoryBase) "i64.asm.js") + (data (get_global $memoryBase) "wasm-only.asm.js") (type $FUNCSIG$vdji (func (param f64 i64 i32))) (type $FUNCSIG$j (func (result i64))) (type $legaltype$illegalImport (func (param f64 i32 i32 i32))) @@ -12,9 +12,105 @@ (import "env" "table" (table 0 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) (import "env" "tableBase" (global $tableBase i32)) - (export "test" (func $test)) + (export "test64" (func $test64)) (export "illegalParam" (func $legalstub$illegalParam)) (export "illegalResult" (func $legalstub$result)) + (func $loads + (nop) + ) + (func $stores + (local $0 i32) + (local $1 f64) + (local $2 f32) + (i32.store8 + (i32.const 100) + (get_local $0) + ) + (i32.store8 + (i32.const 101) + (get_local $0) + ) + (i32.store16 + (i32.const 102) + (get_local $0) + ) + (i32.store16 + (i32.const 103) + (get_local $0) + ) + (i32.store16 align=1 + (i32.const 104) + (get_local $0) + ) + (i32.store16 + (i32.const 105) + (get_local $0) + ) + (i32.store + (i32.const 106) + (get_local $0) + ) + (i32.store + (i32.const 107) + (get_local $0) + ) + (i32.store align=1 + (i32.const 108) + (get_local $0) + ) + (i32.store align=2 + (i32.const 109) + (get_local $0) + ) + (i32.store + (i32.const 110) + (get_local $0) + ) + (f32.store + (i32.const 111) + (get_local $2) + ) + (f32.store + (i32.const 112) + (get_local $2) + ) + (f32.store align=1 + (i32.const 113) + (get_local $2) + ) + (f32.store align=2 + (i32.const 114) + (get_local $2) + ) + (f32.store + (i32.const 115) + (get_local $2) + ) + (f64.store + (i32.const 116) + (get_local $1) + ) + (f64.store + (i32.const 117) + (get_local $1) + ) + (f64.store align=1 + (i32.const 118) + (get_local $1) + ) + (f64.store align=2 + (i32.const 119) + (get_local $1) + ) + (f64.store align=4 + (i32.const 120) + (get_local $1) + ) + (f64.store + (i32.const 121) + (get_local $1) + ) + ) (func $i64u-div (param $0 i64) (param $1 i64) (result i64) (select (i64.const 0) @@ -63,7 +159,7 @@ ) ) ) - (func $test + (func $test64 (local $0 i64) (local $1 i64) (local $2 i32) @@ -77,56 +173,60 @@ (i64.sub (i64.add (i64.const 100) - (tee_local $0 + (tee_local $1 (i64.const 128849018897) ) ) - (get_local $0) + (get_local $1) ) - (get_local $0) + (get_local $1) ) - (get_local $0) + (get_local $1) ) - (get_local $0) + (get_local $1) ) - (get_local $0) + (get_local $1) ) - (get_local $0) + (get_local $1) ) ) (i64.store (i32.const 120) - (tee_local $1 + (tee_local $0 (i64.load (i32.const 120) ) ) ) + (i64.store + (i32.const 120) + (get_local $0) + ) (i64.store align=2 (i32.const 120) - (get_local $1) + (get_local $0) ) (i64.store align=4 (i32.const 120) - (get_local $1) + (get_local $0) ) (i64.store (i32.const 120) - (get_local $1) + (get_local $0) ) (set_local $2 (i32.wrap/i64 - (get_local $1) + (get_local $0) ) ) - (set_local $1 + (set_local $0 (i64.extend_u/i32 (get_local $2) ) ) (set_local $3 (f64.convert_u/i64 - (get_local $1) + (get_local $0) ) ) ) diff --git a/test/i64.fromasm.imprecise b/test/wasm-only.fromasm.imprecise index 742d4cf31..ac76c6c90 100644 --- a/test/i64.fromasm.imprecise +++ b/test/wasm-only.fromasm.imprecise @@ -11,10 +11,106 @@ (import "env" "table" (table 0 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) (import "env" "tableBase" (global $tableBase i32)) - (export "test" (func $test)) + (export "test64" (func $test64)) (export "illegalParam" (func $legalstub$illegalParam)) (export "illegalResult" (func $legalstub$result)) - (func $test + (func $loads + (nop) + ) + (func $stores + (local $0 i32) + (local $1 f64) + (local $2 f32) + (i32.store8 + (i32.const 100) + (get_local $0) + ) + (i32.store8 + (i32.const 101) + (get_local $0) + ) + (i32.store16 + (i32.const 102) + (get_local $0) + ) + (i32.store16 + (i32.const 103) + (get_local $0) + ) + (i32.store16 align=1 + (i32.const 104) + (get_local $0) + ) + (i32.store16 + (i32.const 105) + (get_local $0) + ) + (i32.store + (i32.const 106) + (get_local $0) + ) + (i32.store + (i32.const 107) + (get_local $0) + ) + (i32.store align=1 + (i32.const 108) + (get_local $0) + ) + (i32.store align=2 + (i32.const 109) + (get_local $0) + ) + (i32.store + (i32.const 110) + (get_local $0) + ) + (f32.store + (i32.const 111) + (get_local $2) + ) + (f32.store + (i32.const 112) + (get_local $2) + ) + (f32.store align=1 + (i32.const 113) + (get_local $2) + ) + (f32.store align=2 + (i32.const 114) + (get_local $2) + ) + (f32.store + (i32.const 115) + (get_local $2) + ) + (f64.store + (i32.const 116) + (get_local $1) + ) + (f64.store + (i32.const 117) + (get_local $1) + ) + (f64.store align=1 + (i32.const 118) + (get_local $1) + ) + (f64.store align=2 + (i32.const 119) + (get_local $1) + ) + (f64.store align=4 + (i32.const 120) + (get_local $1) + ) + (f64.store + (i32.const 121) + (get_local $1) + ) + ) + (func $test64 (local $0 i64) (local $1 i32) (local $2 i64) @@ -30,6 +126,10 @@ ) ) ) + (i64.store + (i32.const 120) + (get_local $0) + ) (i64.store align=2 (i32.const 120) (get_local $0) diff --git a/test/i64.fromasm.imprecise.no-opts b/test/wasm-only.fromasm.imprecise.no-opts index 5d0939273..78050d9cd 100644 --- a/test/i64.fromasm.imprecise.no-opts +++ b/test/wasm-only.fromasm.imprecise.no-opts @@ -11,10 +11,232 @@ (import "env" "table" (table 0 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) (import "env" "tableBase" (global $tableBase i32)) - (export "test" (func $test)) + (export "test64" (func $test64)) (export "illegalParam" (func $legalstub$illegalParam)) (export "illegalResult" (func $legalstub$illegalResult)) + (func $loads + (local $i i32) + (local $f f32) + (local $d f64) + (set_local $i + (i32.load8_s + (i32.const 100) + ) + ) + (set_local $i + (i32.load8_s + (i32.const 101) + ) + ) + (set_local $i + (i32.load16_s + (i32.const 102) + ) + ) + (set_local $i + (i32.load16_s + (i32.const 103) + ) + ) + (set_local $i + (i32.load16_s align=1 + (i32.const 104) + ) + ) + (set_local $i + (i32.load16_s + (i32.const 105) + ) + ) + (set_local $i + (i32.load + (i32.const 106) + ) + ) + (set_local $i + (i32.load + (i32.const 107) + ) + ) + (set_local $i + (i32.load align=1 + (i32.const 108) + ) + ) + (set_local $i + (i32.load align=2 + (i32.const 109) + ) + ) + (set_local $i + (i32.load + (i32.const 110) + ) + ) + (set_local $f + (f32.load + (i32.const 111) + ) + ) + (set_local $f + (f32.load + (i32.const 112) + ) + ) + (set_local $f + (f32.load align=1 + (i32.const 113) + ) + ) + (set_local $f + (f32.load align=2 + (i32.const 114) + ) + ) + (set_local $f + (f32.load + (i32.const 115) + ) + ) + (set_local $d + (f64.load + (i32.const 116) + ) + ) + (set_local $d + (f64.load + (i32.const 117) + ) + ) + (set_local $d + (f64.load align=1 + (i32.const 118) + ) + ) + (set_local $d + (f64.load align=2 + (i32.const 119) + ) + ) + (set_local $d + (f64.load align=4 + (i32.const 120) + ) + ) + (set_local $d + (f64.load + (i32.const 121) + ) + ) + ) + (func $stores + (local $i i32) + (local $f f32) + (local $d f64) + (i32.store8 + (i32.const 100) + (get_local $i) + ) + (i32.store8 + (i32.const 101) + (get_local $i) + ) + (i32.store16 + (i32.const 102) + (get_local $i) + ) + (i32.store16 + (i32.const 103) + (get_local $i) + ) + (i32.store16 align=1 + (i32.const 104) + (get_local $i) + ) + (i32.store16 + (i32.const 105) + (get_local $i) + ) + (i32.store + (i32.const 106) + (get_local $i) + ) + (i32.store + (i32.const 107) + (get_local $i) + ) + (i32.store align=1 + (i32.const 108) + (get_local $i) + ) + (i32.store align=2 + (i32.const 109) + (get_local $i) + ) + (i32.store + (i32.const 110) + (get_local $i) + ) + (f32.store + (i32.const 111) + (get_local $f) + ) + (f32.store + (i32.const 112) + (get_local $f) + ) + (f32.store align=1 + (i32.const 113) + (get_local $f) + ) + (f32.store align=2 + (i32.const 114) + (get_local $f) + ) + (f32.store + (i32.const 115) + (get_local $f) + ) + (f64.store + (i32.const 116) + (get_local $d) + ) + (f64.store + (i32.const 117) + (get_local $d) + ) + (f64.store align=1 + (i32.const 118) + (get_local $d) + ) + (f64.store align=2 + (i32.const 119) + (get_local $d) + ) + (f64.store align=4 + (i32.const 120) + (get_local $d) + ) + (f64.store + (i32.const 121) + (get_local $d) + ) + ) (func $test + (local $i i32) + (local $f f32) + (set_local $i + (i32.reinterpret/f32 + (get_local $f) + ) + ) + (set_local $f + (f32.reinterpret/i32 + (get_local $i) + ) + ) + ) + (func $test64 (local $x i64) (local $y i64) (local $z i32) @@ -111,6 +333,11 @@ ) ) (set_local $x + (i64.load + (i32.const 120) + ) + ) + (set_local $x (i64.load align=2 (i32.const 120) ) @@ -129,6 +356,10 @@ (i32.const 120) (get_local $x) ) + (i64.store + (i32.const 120) + (get_local $x) + ) (i64.store align=2 (i32.const 120) (get_local $x) diff --git a/test/i64.fromasm.no-opts b/test/wasm-only.fromasm.no-opts index 85d7018e3..31840158b 100644 --- a/test/i64.fromasm.no-opts +++ b/test/wasm-only.fromasm.no-opts @@ -11,9 +11,231 @@ (import "env" "table" (table 0 anyfunc)) (import "env" "memoryBase" (global $memoryBase i32)) (import "env" "tableBase" (global $tableBase i32)) - (export "test" (func $test)) + (export "test64" (func $test64)) (export "illegalParam" (func $legalstub$illegalParam)) (export "illegalResult" (func $legalstub$illegalResult)) + (func $loads + (local $i i32) + (local $f f32) + (local $d f64) + (set_local $i + (i32.load8_s + (i32.const 100) + ) + ) + (set_local $i + (i32.load8_s + (i32.const 101) + ) + ) + (set_local $i + (i32.load16_s + (i32.const 102) + ) + ) + (set_local $i + (i32.load16_s + (i32.const 103) + ) + ) + (set_local $i + (i32.load16_s align=1 + (i32.const 104) + ) + ) + (set_local $i + (i32.load16_s + (i32.const 105) + ) + ) + (set_local $i + (i32.load + (i32.const 106) + ) + ) + (set_local $i + (i32.load + (i32.const 107) + ) + ) + (set_local $i + (i32.load align=1 + (i32.const 108) + ) + ) + (set_local $i + (i32.load align=2 + (i32.const 109) + ) + ) + (set_local $i + (i32.load + (i32.const 110) + ) + ) + (set_local $f + (f32.load + (i32.const 111) + ) + ) + (set_local $f + (f32.load + (i32.const 112) + ) + ) + (set_local $f + (f32.load align=1 + (i32.const 113) + ) + ) + (set_local $f + (f32.load align=2 + (i32.const 114) + ) + ) + (set_local $f + (f32.load + (i32.const 115) + ) + ) + (set_local $d + (f64.load + (i32.const 116) + ) + ) + (set_local $d + (f64.load + (i32.const 117) + ) + ) + (set_local $d + (f64.load align=1 + (i32.const 118) + ) + ) + (set_local $d + (f64.load align=2 + (i32.const 119) + ) + ) + (set_local $d + (f64.load align=4 + (i32.const 120) + ) + ) + (set_local $d + (f64.load + (i32.const 121) + ) + ) + ) + (func $stores + (local $i i32) + (local $f f32) + (local $d f64) + (i32.store8 + (i32.const 100) + (get_local $i) + ) + (i32.store8 + (i32.const 101) + (get_local $i) + ) + (i32.store16 + (i32.const 102) + (get_local $i) + ) + (i32.store16 + (i32.const 103) + (get_local $i) + ) + (i32.store16 align=1 + (i32.const 104) + (get_local $i) + ) + (i32.store16 + (i32.const 105) + (get_local $i) + ) + (i32.store + (i32.const 106) + (get_local $i) + ) + (i32.store + (i32.const 107) + (get_local $i) + ) + (i32.store align=1 + (i32.const 108) + (get_local $i) + ) + (i32.store align=2 + (i32.const 109) + (get_local $i) + ) + (i32.store + (i32.const 110) + (get_local $i) + ) + (f32.store + (i32.const 111) + (get_local $f) + ) + (f32.store + (i32.const 112) + (get_local $f) + ) + (f32.store align=1 + (i32.const 113) + (get_local $f) + ) + (f32.store align=2 + (i32.const 114) + (get_local $f) + ) + (f32.store + (i32.const 115) + (get_local $f) + ) + (f64.store + (i32.const 116) + (get_local $d) + ) + (f64.store + (i32.const 117) + (get_local $d) + ) + (f64.store align=1 + (i32.const 118) + (get_local $d) + ) + (f64.store align=2 + (i32.const 119) + (get_local $d) + ) + (f64.store align=4 + (i32.const 120) + (get_local $d) + ) + (f64.store + (i32.const 121) + (get_local $d) + ) + ) + (func $test + (local $i i32) + (local $f f32) + (set_local $i + (i32.reinterpret/f32 + (get_local $f) + ) + ) + (set_local $f + (f32.reinterpret/i32 + (get_local $i) + ) + ) + ) (func $i64u-div (param $0 i64) (param $1 i64) (result i64) (if i64 (i64.eqz @@ -62,7 +284,7 @@ ) ) ) - (func $test + (func $test64 (local $x i64) (local $y i64) (local $z i32) @@ -159,6 +381,11 @@ ) ) (set_local $x + (i64.load + (i32.const 120) + ) + ) + (set_local $x (i64.load align=2 (i32.const 120) ) @@ -177,6 +404,10 @@ (i32.const 120) (get_local $x) ) + (i64.store + (i32.const 120) + (get_local $x) + ) (i64.store align=2 (i32.const 120) (get_local $x) |