From 6f8dc347f2851d83209f92777926924aa41397d1 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 22 Jan 2020 12:40:45 -0800 Subject: [PATCH] Update repos simd: https://github.com/WebAssembly/simd/commit/04732346 sign-extension-ops: https://github.com/WebAssembly/sign-extension-ops/commit/a09a028e reference-types: https://github.com/WebAssembly/reference-types/commit/2719ec31 This change was automatically generated by `update-testsuite.sh` --- proposals/reference-types/elem.wast | 37 +- proposals/reference-types/linking.wast | 1 + proposals/reference-types/ref_func.wast | 24 +- proposals/reference-types/table_grow.wast | 2 + proposals/sign-extension-ops/i32.wast | 599 ++++++++++++++++++++-- proposals/sign-extension-ops/i64.wast | 98 ++-- proposals/simd/simd_align.wast | 345 ++++++++++--- proposals/simd/simd_const.wast | 4 + proposals/simd/simd_conversions.wast | 318 +----------- proposals/simd/simd_lane.wast | 398 +++++++++++--- proposals/simd/simd_load.wast | 28 +- 11 files changed, 1313 insertions(+), 541 deletions(-) diff --git a/proposals/reference-types/elem.wast b/proposals/reference-types/elem.wast index bb622ee..6661c9a 100644 --- a/proposals/reference-types/elem.wast +++ b/proposals/reference-types/elem.wast @@ -8,7 +8,7 @@ ;; Passive (elem funcref) - (elem funcref (ref.func $f) (ref.func $f) (ref.null) (ref.func $g)) + (elem funcref (ref.func $f) (item ref.func $f) (item (ref.null)) (ref.func $g)) (elem func) (elem func $f $f $g $g) @@ -63,6 +63,17 @@ (elem $a24 (i32.const 0) funcref (ref.func $f) (ref.null)) (elem $a25 (i32.const 0) func $f $f) (elem $a26 (i32.const 0) $f $f) + + ;; Declarative + (elem declare funcref) + (elem declare funcref (ref.func $f) (ref.func $f) (ref.null) (ref.func $g)) + (elem declare func) + (elem declare func $f $f $g $g) + + (elem $d1 declare funcref) + (elem $d2 declare funcref (ref.func $f) (ref.func $f) (ref.null) (ref.func $g)) + (elem $d3 declare func) + (elem $d4 declare func $f $f $g $g) ) (module @@ -71,6 +82,8 @@ (table $t funcref (elem (ref.func $f) (ref.null) (ref.func $g))) ) + + ;; Basic use (module @@ -294,6 +307,28 @@ "out of bounds" ) +;; Implicitly dropped elements + +(module + (table 10 funcref) + (elem $e (i32.const 0) func $f) + (func $f) + (func (export "init") + (table.init $e (i32.const 0) (i32.const 0) (i32.const 1)) + ) +) +(assert_trap (invoke "init") "out of bounds") + +(module + (table 10 funcref) + (elem $e declare func $f) + (func $f) + (func (export "init") + (table.init $e (i32.const 0) (i32.const 0) (i32.const 1)) + ) +) +(assert_trap (invoke "init") "out of bounds") + ;; Element without table (assert_invalid diff --git a/proposals/reference-types/linking.wast b/proposals/reference-types/linking.wast index bf6356f..49d5572 100644 --- a/proposals/reference-types/linking.wast +++ b/proposals/reference-types/linking.wast @@ -129,6 +129,7 @@ "incompatible import type" ) + (assert_unlinkable (module (global (import "Mref_ex" "g-var-null") (mut funcref))) "incompatible import type" diff --git a/proposals/reference-types/ref_func.wast b/proposals/reference-types/ref_func.wast index 393d3f8..e9033a3 100644 --- a/proposals/reference-types/ref_func.wast +++ b/proposals/reference-types/ref_func.wast @@ -5,7 +5,9 @@ (module (func $f (import "M" "f") (param i32) (result i32)) - (func $g (param $x i32) (result i32) (i32.add (local.get $x) (i32.const 1))) + (func $g (param $x i32) (result i32) + (i32.add (local.get $x) (i32.const 1)) + ) (global anyref (ref.func $f)) (global anyref (ref.func $g)) @@ -13,6 +15,16 @@ (global funcref (ref.func $g)) (global $v (mut funcref) (ref.func $f)) + (global funcref (ref.func $gf1)) + (global funcref (ref.func $gf2)) + (func (drop (ref.func $ff1)) (drop (ref.func $ff2))) + (elem declare func $gf1 $ff1) + (elem declare funcref (ref.func $gf2) (ref.func $ff2)) + (func $gf1) + (func $gf2) + (func $ff1) + (func $ff2) + (func (export "is_null-f") (result i32) (ref.is_null (ref.func $f)) ) @@ -27,6 +39,7 @@ (func (export "set-g") (global.set $v (ref.func $g))) (table $t 1 funcref) + (elem declare func $f $g) (func (export "call-f") (param $x i32) (result i32) (table.set $t (i32.const 0) (ref.func $f)) @@ -62,3 +75,12 @@ ) "unknown function 7" ) + +(assert_invalid + (module (func $f) (global funcref (ref.func $f))) + "undeclared function reference" +) +(assert_invalid + (module (func $f (drop (ref.func $f)))) + "undeclared function reference" +) diff --git a/proposals/reference-types/table_grow.wast b/proposals/reference-types/table_grow.wast index 158df3c..91fc096 100644 --- a/proposals/reference-types/table_grow.wast +++ b/proposals/reference-types/table_grow.wast @@ -38,6 +38,7 @@ ;; Reject growing to size outside i32 value range (module (table $t 0x10 anyref) + (elem declare func $f) (func $f (export "grow") (result i32) (table.grow $t (ref.func $f) (i32.const 0xffff_fff0)) ) @@ -82,6 +83,7 @@ (func (export "grow") (param i32) (result i32) (table.grow $t (ref.null) (local.get 0)) ) + (elem declare func 1) (func (export "check-table-null") (param i32 i32) (result anyref) (local anyref) (local.set 2 (ref.func 1)) diff --git a/proposals/sign-extension-ops/i32.wast b/proposals/sign-extension-ops/i32.wast index 2357dec..32862c3 100644 --- a/proposals/sign-extension-ops/i32.wast +++ b/proposals/sign-extension-ops/i32.wast @@ -1,37 +1,37 @@ ;; i32 operations (module - (func (export "add") (param $x i32) (param $y i32) (result i32) (i32.add (get_local $x) (get_local $y))) - (func (export "sub") (param $x i32) (param $y i32) (result i32) (i32.sub (get_local $x) (get_local $y))) - (func (export "mul") (param $x i32) (param $y i32) (result i32) (i32.mul (get_local $x) (get_local $y))) - (func (export "div_s") (param $x i32) (param $y i32) (result i32) (i32.div_s (get_local $x) (get_local $y))) - (func (export "div_u") (param $x i32) (param $y i32) (result i32) (i32.div_u (get_local $x) (get_local $y))) - (func (export "rem_s") (param $x i32) (param $y i32) (result i32) (i32.rem_s (get_local $x) (get_local $y))) - (func (export "rem_u") (param $x i32) (param $y i32) (result i32) (i32.rem_u (get_local $x) (get_local $y))) - (func (export "and") (param $x i32) (param $y i32) (result i32) (i32.and (get_local $x) (get_local $y))) - (func (export "or") (param $x i32) (param $y i32) (result i32) (i32.or (get_local $x) (get_local $y))) - (func (export "xor") (param $x i32) (param $y i32) (result i32) (i32.xor (get_local $x) (get_local $y))) - (func (export "shl") (param $x i32) (param $y i32) (result i32) (i32.shl (get_local $x) (get_local $y))) - (func (export "shr_s") (param $x i32) (param $y i32) (result i32) (i32.shr_s (get_local $x) (get_local $y))) - (func (export "shr_u") (param $x i32) (param $y i32) (result i32) (i32.shr_u (get_local $x) (get_local $y))) - (func (export "rotl") (param $x i32) (param $y i32) (result i32) (i32.rotl (get_local $x) (get_local $y))) - (func (export "rotr") (param $x i32) (param $y i32) (result i32) (i32.rotr (get_local $x) (get_local $y))) - (func (export "clz") (param $x i32) (result i32) (i32.clz (get_local $x))) - (func (export "ctz") (param $x i32) (result i32) (i32.ctz (get_local $x))) - (func (export "popcnt") (param $x i32) (result i32) (i32.popcnt (get_local $x))) - (func (export "extend8_s") (param $x i32) (result i32) (i32.extend8_s (get_local $x))) - (func (export "extend16_s") (param $x i32) (result i32) (i32.extend16_s (get_local $x))) - (func (export "eqz") (param $x i32) (result i32) (i32.eqz (get_local $x))) - (func (export "eq") (param $x i32) (param $y i32) (result i32) (i32.eq (get_local $x) (get_local $y))) - (func (export "ne") (param $x i32) (param $y i32) (result i32) (i32.ne (get_local $x) (get_local $y))) - (func (export "lt_s") (param $x i32) (param $y i32) (result i32) (i32.lt_s (get_local $x) (get_local $y))) - (func (export "lt_u") (param $x i32) (param $y i32) (result i32) (i32.lt_u (get_local $x) (get_local $y))) - (func (export "le_s") (param $x i32) (param $y i32) (result i32) (i32.le_s (get_local $x) (get_local $y))) - (func (export "le_u") (param $x i32) (param $y i32) (result i32) (i32.le_u (get_local $x) (get_local $y))) - (func (export "gt_s") (param $x i32) (param $y i32) (result i32) (i32.gt_s (get_local $x) (get_local $y))) - (func (export "gt_u") (param $x i32) (param $y i32) (result i32) (i32.gt_u (get_local $x) (get_local $y))) - (func (export "ge_s") (param $x i32) (param $y i32) (result i32) (i32.ge_s (get_local $x) (get_local $y))) - (func (export "ge_u") (param $x i32) (param $y i32) (result i32) (i32.ge_u (get_local $x) (get_local $y))) + (func (export "add") (param $x i32) (param $y i32) (result i32) (i32.add (local.get $x) (local.get $y))) + (func (export "sub") (param $x i32) (param $y i32) (result i32) (i32.sub (local.get $x) (local.get $y))) + (func (export "mul") (param $x i32) (param $y i32) (result i32) (i32.mul (local.get $x) (local.get $y))) + (func (export "div_s") (param $x i32) (param $y i32) (result i32) (i32.div_s (local.get $x) (local.get $y))) + (func (export "div_u") (param $x i32) (param $y i32) (result i32) (i32.div_u (local.get $x) (local.get $y))) + (func (export "rem_s") (param $x i32) (param $y i32) (result i32) (i32.rem_s (local.get $x) (local.get $y))) + (func (export "rem_u") (param $x i32) (param $y i32) (result i32) (i32.rem_u (local.get $x) (local.get $y))) + (func (export "and") (param $x i32) (param $y i32) (result i32) (i32.and (local.get $x) (local.get $y))) + (func (export "or") (param $x i32) (param $y i32) (result i32) (i32.or (local.get $x) (local.get $y))) + (func (export "xor") (param $x i32) (param $y i32) (result i32) (i32.xor (local.get $x) (local.get $y))) + (func (export "shl") (param $x i32) (param $y i32) (result i32) (i32.shl (local.get $x) (local.get $y))) + (func (export "shr_s") (param $x i32) (param $y i32) (result i32) (i32.shr_s (local.get $x) (local.get $y))) + (func (export "shr_u") (param $x i32) (param $y i32) (result i32) (i32.shr_u (local.get $x) (local.get $y))) + (func (export "rotl") (param $x i32) (param $y i32) (result i32) (i32.rotl (local.get $x) (local.get $y))) + (func (export "rotr") (param $x i32) (param $y i32) (result i32) (i32.rotr (local.get $x) (local.get $y))) + (func (export "clz") (param $x i32) (result i32) (i32.clz (local.get $x))) + (func (export "ctz") (param $x i32) (result i32) (i32.ctz (local.get $x))) + (func (export "popcnt") (param $x i32) (result i32) (i32.popcnt (local.get $x))) + (func (export "extend8_s") (param $x i32) (result i32) (i32.extend8_s (local.get $x))) + (func (export "extend16_s") (param $x i32) (result i32) (i32.extend16_s (local.get $x))) + (func (export "eqz") (param $x i32) (result i32) (i32.eqz (local.get $x))) + (func (export "eq") (param $x i32) (param $y i32) (result i32) (i32.eq (local.get $x) (local.get $y))) + (func (export "ne") (param $x i32) (param $y i32) (result i32) (i32.ne (local.get $x) (local.get $y))) + (func (export "lt_s") (param $x i32) (param $y i32) (result i32) (i32.lt_s (local.get $x) (local.get $y))) + (func (export "lt_u") (param $x i32) (param $y i32) (result i32) (i32.lt_u (local.get $x) (local.get $y))) + (func (export "le_s") (param $x i32) (param $y i32) (result i32) (i32.le_s (local.get $x) (local.get $y))) + (func (export "le_u") (param $x i32) (param $y i32) (result i32) (i32.le_u (local.get $x) (local.get $y))) + (func (export "gt_s") (param $x i32) (param $y i32) (result i32) (i32.gt_s (local.get $x) (local.get $y))) + (func (export "gt_u") (param $x i32) (param $y i32) (result i32) (i32.gt_u (local.get $x) (local.get $y))) + (func (export "ge_s") (param $x i32) (param $y i32) (result i32) (i32.ge_s (local.get $x) (local.get $y))) + (func (export "ge_u") (param $x i32) (param $y i32) (result i32) (i32.ge_u (local.get $x) (local.get $y))) ) (assert_return (invoke "add" (i32.const 1) (i32.const 1)) (i32.const 2)) @@ -64,6 +64,7 @@ (assert_trap (invoke "div_s" (i32.const 1) (i32.const 0)) "integer divide by zero") (assert_trap (invoke "div_s" (i32.const 0) (i32.const 0)) "integer divide by zero") (assert_trap (invoke "div_s" (i32.const 0x80000000) (i32.const -1)) "integer overflow") +(assert_trap (invoke "div_s" (i32.const 0x80000000) (i32.const 0)) "integer divide by zero") (assert_return (invoke "div_s" (i32.const 1) (i32.const 1)) (i32.const 1)) (assert_return (invoke "div_s" (i32.const 0) (i32.const 1)) (i32.const 0)) (assert_return (invoke "div_s" (i32.const 0) (i32.const -1)) (i32.const 0)) @@ -437,3 +438,539 @@ (assert_return (invoke "ge_u" (i32.const -1) (i32.const 0x80000000)) (i32.const 1)) (assert_return (invoke "ge_u" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 1)) (assert_return (invoke "ge_u" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 0)) + + +(assert_invalid + (module + (func $type-unary-operand-empty + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-block + (i32.const 0) + (block (i32.eqz) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-loop + (i32.const 0) + (loop (i32.eqz) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-if + (i32.const 0) (i32.const 0) + (if (then (i32.eqz) (drop))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-else + (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (i32.eqz))) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-br + (i32.const 0) + (block (br 0 (i32.eqz)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-br_if + (i32.const 0) + (block (br_if 0 (i32.eqz) (i32.const 1)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-br_table + (i32.const 0) + (block (br_table 0 (i32.eqz)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-return + (return (i32.eqz)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-select + (select (i32.eqz) (i32.const 1) (i32.const 2)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-call + (call 1 (i32.eqz)) (drop) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-unary-operand-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (i32.eqz) (i32.const 0) + ) + (drop) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-local.set + (local i32) + (local.set 0 (i32.eqz)) (local.get 0) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-local.tee + (local i32) + (local.tee 0 (i32.eqz)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-unary-operand-empty-in-global.set + (global.set $x (i32.eqz)) (global.get $x) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-unary-operand-empty-in-memory.grow + (memory.grow (i32.eqz)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-unary-operand-empty-in-load + (i32.load (i32.eqz)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-unary-operand-empty-in-store + (i32.store (i32.eqz) (i32.const 1)) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (func $type-binary-1st-operand-empty + (i32.add) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty + (i32.const 0) (i32.add) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-block + (i32.const 0) (i32.const 0) + (block (i32.add) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-block + (i32.const 0) + (block (i32.const 0) (i32.add) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-loop + (i32.const 0) (i32.const 0) + (loop (i32.add) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-loop + (i32.const 0) + (loop (i32.const 0) (i32.add) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-if + (i32.const 0) (i32.const 0) (i32.const 0) + (if (i32.add) (then (drop))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-if + (i32.const 0) (i32.const 0) + (if (i32.const 0) (then (i32.add)) (else (drop))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-else + (i32.const 0) (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (i32.add) (i32.const 0))) + (drop) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-else + (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (i32.add))) + (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-br + (i32.const 0) (i32.const 0) + (block (br 0 (i32.add)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-br + (i32.const 0) + (block (br 0 (i32.const 0) (i32.add)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-br_if + (i32.const 0) (i32.const 0) + (block (br_if 0 (i32.add) (i32.const 1)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-br_if + (i32.const 0) + (block (br_if 0 (i32.const 0) (i32.add) (i32.const 1)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-br_table + (i32.const 0) (i32.const 0) + (block (br_table 0 (i32.add)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-br_table + (i32.const 0) + (block (br_table 0 (i32.const 0) (i32.add)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-return + (return (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-return + (return (i32.const 0) (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-select + (select (i32.add) (i32.const 1) (i32.const 2)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-select + (select (i32.const 0) (i32.add) (i32.const 1) (i32.const 2)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-call + (call 1 (i32.add)) (drop) + ) + (func (param i32 i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-call + (call 1 (i32.const 0) (i32.add)) (drop) + ) + (func (param i32 i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-binary-1st-operand-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (i32.add) (i32.const 0) + ) + (drop) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-binary-2nd-operand-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (i32.const 0) (i32.add) (i32.const 0) + ) + (drop) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-local.set + (local i32) + (local.set 0 (i32.add)) (local.get 0) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-local.set + (local i32) + (local.set 0 (i32.const 0) (i32.add)) (local.get 0) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-local.tee + (local i32) + (local.tee 0 (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-local.tee + (local i32) + (local.tee 0 (i32.const 0) (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-binary-1st-operand-empty-in-global.set + (global.set $x (i32.add)) (global.get $x) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-binary-2nd-operand-empty-in-global.set + (global.set $x (i32.const 0) (i32.add)) (global.get $x) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-binary-1st-operand-empty-in-memory.grow + (memory.grow (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-binary-2nd-operand-empty-in-memory.grow + (memory.grow (i32.const 0) (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-binary-1st-operand-empty-in-load + (i32.load (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-binary-2nd-operand-empty-in-load + (i32.load (i32.const 0) (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-binary-1st-operand-empty-in-store + (i32.store (i32.add) (i32.const 1)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-binary-2nd-operand-empty-in-store + (i32.store (i32.const 1) (i32.add) (i32.const 0)) + ) + ) + "type mismatch" +) + + +;; Type check + +(assert_invalid (module (func (result i32) (i32.add (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.and (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.div_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.div_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.mul (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.or (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.rem_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.rem_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.rotl (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.rotr (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.shl (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.shr_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.shr_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.sub (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.xor (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.eqz (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.clz (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.ctz (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.popcnt (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.eq (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.ge_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.ge_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.gt_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.gt_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.le_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.le_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.lt_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.lt_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.ne (i64.const 0) (f32.const 0)))) "type mismatch") diff --git a/proposals/sign-extension-ops/i64.wast b/proposals/sign-extension-ops/i64.wast index 9454171..baeed0c 100644 --- a/proposals/sign-extension-ops/i64.wast +++ b/proposals/sign-extension-ops/i64.wast @@ -1,38 +1,38 @@ ;; i64 operations (module - (func (export "add") (param $x i64) (param $y i64) (result i64) (i64.add (get_local $x) (get_local $y))) - (func (export "sub") (param $x i64) (param $y i64) (result i64) (i64.sub (get_local $x) (get_local $y))) - (func (export "mul") (param $x i64) (param $y i64) (result i64) (i64.mul (get_local $x) (get_local $y))) - (func (export "div_s") (param $x i64) (param $y i64) (result i64) (i64.div_s (get_local $x) (get_local $y))) - (func (export "div_u") (param $x i64) (param $y i64) (result i64) (i64.div_u (get_local $x) (get_local $y))) - (func (export "rem_s") (param $x i64) (param $y i64) (result i64) (i64.rem_s (get_local $x) (get_local $y))) - (func (export "rem_u") (param $x i64) (param $y i64) (result i64) (i64.rem_u (get_local $x) (get_local $y))) - (func (export "and") (param $x i64) (param $y i64) (result i64) (i64.and (get_local $x) (get_local $y))) - (func (export "or") (param $x i64) (param $y i64) (result i64) (i64.or (get_local $x) (get_local $y))) - (func (export "xor") (param $x i64) (param $y i64) (result i64) (i64.xor (get_local $x) (get_local $y))) - (func (export "shl") (param $x i64) (param $y i64) (result i64) (i64.shl (get_local $x) (get_local $y))) - (func (export "shr_s") (param $x i64) (param $y i64) (result i64) (i64.shr_s (get_local $x) (get_local $y))) - (func (export "shr_u") (param $x i64) (param $y i64) (result i64) (i64.shr_u (get_local $x) (get_local $y))) - (func (export "rotl") (param $x i64) (param $y i64) (result i64) (i64.rotl (get_local $x) (get_local $y))) - (func (export "rotr") (param $x i64) (param $y i64) (result i64) (i64.rotr (get_local $x) (get_local $y))) - (func (export "clz") (param $x i64) (result i64) (i64.clz (get_local $x))) - (func (export "ctz") (param $x i64) (result i64) (i64.ctz (get_local $x))) - (func (export "popcnt") (param $x i64) (result i64) (i64.popcnt (get_local $x))) - (func (export "extend8_s") (param $x i64) (result i64) (i64.extend8_s (get_local $x))) - (func (export "extend16_s") (param $x i64) (result i64) (i64.extend16_s (get_local $x))) - (func (export "extend32_s") (param $x i64) (result i64) (i64.extend32_s (get_local $x))) - (func (export "eqz") (param $x i64) (result i32) (i64.eqz (get_local $x))) - (func (export "eq") (param $x i64) (param $y i64) (result i32) (i64.eq (get_local $x) (get_local $y))) - (func (export "ne") (param $x i64) (param $y i64) (result i32) (i64.ne (get_local $x) (get_local $y))) - (func (export "lt_s") (param $x i64) (param $y i64) (result i32) (i64.lt_s (get_local $x) (get_local $y))) - (func (export "lt_u") (param $x i64) (param $y i64) (result i32) (i64.lt_u (get_local $x) (get_local $y))) - (func (export "le_s") (param $x i64) (param $y i64) (result i32) (i64.le_s (get_local $x) (get_local $y))) - (func (export "le_u") (param $x i64) (param $y i64) (result i32) (i64.le_u (get_local $x) (get_local $y))) - (func (export "gt_s") (param $x i64) (param $y i64) (result i32) (i64.gt_s (get_local $x) (get_local $y))) - (func (export "gt_u") (param $x i64) (param $y i64) (result i32) (i64.gt_u (get_local $x) (get_local $y))) - (func (export "ge_s") (param $x i64) (param $y i64) (result i32) (i64.ge_s (get_local $x) (get_local $y))) - (func (export "ge_u") (param $x i64) (param $y i64) (result i32) (i64.ge_u (get_local $x) (get_local $y))) + (func (export "add") (param $x i64) (param $y i64) (result i64) (i64.add (local.get $x) (local.get $y))) + (func (export "sub") (param $x i64) (param $y i64) (result i64) (i64.sub (local.get $x) (local.get $y))) + (func (export "mul") (param $x i64) (param $y i64) (result i64) (i64.mul (local.get $x) (local.get $y))) + (func (export "div_s") (param $x i64) (param $y i64) (result i64) (i64.div_s (local.get $x) (local.get $y))) + (func (export "div_u") (param $x i64) (param $y i64) (result i64) (i64.div_u (local.get $x) (local.get $y))) + (func (export "rem_s") (param $x i64) (param $y i64) (result i64) (i64.rem_s (local.get $x) (local.get $y))) + (func (export "rem_u") (param $x i64) (param $y i64) (result i64) (i64.rem_u (local.get $x) (local.get $y))) + (func (export "and") (param $x i64) (param $y i64) (result i64) (i64.and (local.get $x) (local.get $y))) + (func (export "or") (param $x i64) (param $y i64) (result i64) (i64.or (local.get $x) (local.get $y))) + (func (export "xor") (param $x i64) (param $y i64) (result i64) (i64.xor (local.get $x) (local.get $y))) + (func (export "shl") (param $x i64) (param $y i64) (result i64) (i64.shl (local.get $x) (local.get $y))) + (func (export "shr_s") (param $x i64) (param $y i64) (result i64) (i64.shr_s (local.get $x) (local.get $y))) + (func (export "shr_u") (param $x i64) (param $y i64) (result i64) (i64.shr_u (local.get $x) (local.get $y))) + (func (export "rotl") (param $x i64) (param $y i64) (result i64) (i64.rotl (local.get $x) (local.get $y))) + (func (export "rotr") (param $x i64) (param $y i64) (result i64) (i64.rotr (local.get $x) (local.get $y))) + (func (export "clz") (param $x i64) (result i64) (i64.clz (local.get $x))) + (func (export "ctz") (param $x i64) (result i64) (i64.ctz (local.get $x))) + (func (export "popcnt") (param $x i64) (result i64) (i64.popcnt (local.get $x))) + (func (export "extend8_s") (param $x i64) (result i64) (i64.extend8_s (local.get $x))) + (func (export "extend16_s") (param $x i64) (result i64) (i64.extend16_s (local.get $x))) + (func (export "extend32_s") (param $x i64) (result i64) (i64.extend32_s (local.get $x))) + (func (export "eqz") (param $x i64) (result i32) (i64.eqz (local.get $x))) + (func (export "eq") (param $x i64) (param $y i64) (result i32) (i64.eq (local.get $x) (local.get $y))) + (func (export "ne") (param $x i64) (param $y i64) (result i32) (i64.ne (local.get $x) (local.get $y))) + (func (export "lt_s") (param $x i64) (param $y i64) (result i32) (i64.lt_s (local.get $x) (local.get $y))) + (func (export "lt_u") (param $x i64) (param $y i64) (result i32) (i64.lt_u (local.get $x) (local.get $y))) + (func (export "le_s") (param $x i64) (param $y i64) (result i32) (i64.le_s (local.get $x) (local.get $y))) + (func (export "le_u") (param $x i64) (param $y i64) (result i32) (i64.le_u (local.get $x) (local.get $y))) + (func (export "gt_s") (param $x i64) (param $y i64) (result i32) (i64.gt_s (local.get $x) (local.get $y))) + (func (export "gt_u") (param $x i64) (param $y i64) (result i32) (i64.gt_u (local.get $x) (local.get $y))) + (func (export "ge_s") (param $x i64) (param $y i64) (result i32) (i64.ge_s (local.get $x) (local.get $y))) + (func (export "ge_u") (param $x i64) (param $y i64) (result i32) (i64.ge_u (local.get $x) (local.get $y))) ) (assert_return (invoke "add" (i64.const 1) (i64.const 1)) (i64.const 2)) @@ -65,6 +65,7 @@ (assert_trap (invoke "div_s" (i64.const 1) (i64.const 0)) "integer divide by zero") (assert_trap (invoke "div_s" (i64.const 0) (i64.const 0)) "integer divide by zero") (assert_trap (invoke "div_s" (i64.const 0x8000000000000000) (i64.const -1)) "integer overflow") +(assert_trap (invoke "div_s" (i64.const 0x8000000000000000) (i64.const 0)) "integer divide by zero") (assert_return (invoke "div_s" (i64.const 1) (i64.const 1)) (i64.const 1)) (assert_return (invoke "div_s" (i64.const 0) (i64.const 1)) (i64.const 0)) (assert_return (invoke "div_s" (i64.const 0) (i64.const -1)) (i64.const 0)) @@ -449,3 +450,36 @@ (assert_return (invoke "ge_u" (i64.const -1) (i64.const 0x8000000000000000)) (i32.const 1)) (assert_return (invoke "ge_u" (i64.const 0x8000000000000000) (i64.const 0x7fffffffffffffff)) (i32.const 1)) (assert_return (invoke "ge_u" (i64.const 0x7fffffffffffffff) (i64.const 0x8000000000000000)) (i32.const 0)) + + +;; Type check + +(assert_invalid (module (func (result i64) (i64.add (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.and (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.div_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.div_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.mul (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.or (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.rem_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.rem_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.rotl (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.rotr (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.shl (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.shr_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.shr_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.sub (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.xor (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.eqz (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.clz (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.ctz (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.popcnt (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.eq (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.ge_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.ge_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.gt_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.gt_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.le_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.le_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.lt_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.lt_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.ne (i32.const 0) (f32.const 0)))) "type mismatch") diff --git a/proposals/simd/simd_align.wast b/proposals/simd/simd_align.wast index 1dc95c9..35fb680 100644 --- a/proposals/simd/simd_align.wast +++ b/proposals/simd/simd_align.wast @@ -1,116 +1,307 @@ -;; Vaild alignment (align=1, 2, 4, 8, 16) +;; Valid alignment -(module - (memory 1) - (data (i32.const 0) "\00\01\02\03\04\05\06\07\08\09\10\11\12\13\14\15") +(module (memory 1) (func (drop (v128.load align=1 (i32.const 0))))) +(module (memory 1) (func (drop (v128.load align=2 (i32.const 0))))) +(module (memory 1) (func (drop (v128.load align=4 (i32.const 0))))) +(module (memory 1) (func (drop (v128.load align=8 (i32.const 0))))) +(module (memory 1) (func (drop (v128.load align=16 (i32.const 0))))) + +(module (memory 1) (func (v128.store align=1 (i32.const 0) (v128.const i32x4 0 1 2 3)))) +(module (memory 1) (func (v128.store align=2 (i32.const 0) (v128.const i32x4 0 1 2 3)))) +(module (memory 1) (func (v128.store align=4 (i32.const 0) (v128.const i32x4 0 1 2 3)))) +(module (memory 1) (func (v128.store align=8 (i32.const 0) (v128.const i32x4 0 1 2 3)))) +(module (memory 1) (func (v128.store align=16 (i32.const 0) (v128.const i32x4 0 1 2 3)))) + +(module (memory 1) (func (drop (i16x8.load8x8_s align=1 (i32.const 0))))) +(module (memory 1) (func (drop (i16x8.load8x8_s align=2 (i32.const 0))))) +(module (memory 1) (func (drop (i16x8.load8x8_s align=4 (i32.const 0))))) +(module (memory 1) (func (drop (i16x8.load8x8_s align=8 (i32.const 0))))) +(module (memory 1) (func (drop (i16x8.load8x8_u align=1 (i32.const 0))))) +(module (memory 1) (func (drop (i16x8.load8x8_u align=2 (i32.const 0))))) +(module (memory 1) (func (drop (i16x8.load8x8_u align=4 (i32.const 0))))) +(module (memory 1) (func (drop (i16x8.load8x8_u align=8 (i32.const 0))))) +(module (memory 1) (func (drop (i32x4.load16x4_s align=1 (i32.const 0))))) +(module (memory 1) (func (drop (i32x4.load16x4_s align=2 (i32.const 0))))) +(module (memory 1) (func (drop (i32x4.load16x4_s align=4 (i32.const 0))))) +(module (memory 1) (func (drop (i32x4.load16x4_s align=8 (i32.const 0))))) +(module (memory 1) (func (drop (i32x4.load16x4_u align=1 (i32.const 0))))) +(module (memory 1) (func (drop (i32x4.load16x4_u align=2 (i32.const 0))))) +(module (memory 1) (func (drop (i32x4.load16x4_u align=4 (i32.const 0))))) +(module (memory 1) (func (drop (i32x4.load16x4_u align=8 (i32.const 0))))) +(module (memory 1) (func (drop (i64x2.load32x2_s align=1 (i32.const 0))))) +(module (memory 1) (func (drop (i64x2.load32x2_s align=2 (i32.const 0))))) +(module (memory 1) (func (drop (i64x2.load32x2_s align=4 (i32.const 0))))) +(module (memory 1) (func (drop (i64x2.load32x2_s align=8 (i32.const 0))))) +(module (memory 1) (func (drop (i64x2.load32x2_u align=1 (i32.const 0))))) +(module (memory 1) (func (drop (i64x2.load32x2_u align=2 (i32.const 0))))) +(module (memory 1) (func (drop (i64x2.load32x2_u align=4 (i32.const 0))))) +(module (memory 1) (func (drop (i64x2.load32x2_u align=8 (i32.const 0))))) + +(module (memory 1) (func (drop (v8x16.load_splat align=1 (i32.const 0))))) +(module (memory 1) (func (drop (v16x8.load_splat align=1 (i32.const 0))))) +(module (memory 1) (func (drop (v16x8.load_splat align=2 (i32.const 0))))) +(module (memory 1) (func (drop (v32x4.load_splat align=1 (i32.const 0))))) +(module (memory 1) (func (drop (v32x4.load_splat align=2 (i32.const 0))))) +(module (memory 1) (func (drop (v32x4.load_splat align=4 (i32.const 0))))) +(module (memory 1) (func (drop (v64x2.load_splat align=1 (i32.const 0))))) +(module (memory 1) (func (drop (v64x2.load_splat align=2 (i32.const 0))))) +(module (memory 1) (func (drop (v64x2.load_splat align=4 (i32.const 0))))) +(module (memory 1) (func (drop (v64x2.load_splat align=8 (i32.const 0))))) + +;; Invalid alignment + +(assert_invalid + (module (memory 1) (func (drop (v128.load align=32 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func(v128.store align=32 (i32.const 0) (v128.const i32x4 0 0 0 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 1) (func (result v128) (i16x8.load8x8_s align=16 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 1) (func (result v128) (i16x8.load8x8_u align=16 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 1) (func (result v128) (i32x4.load16x4_s align=16 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 1) (func (result v128) (i32x4.load16x4_u align=16 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 1) (func (result v128) (i64x2.load32x2_s align=16 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 1) (func (result v128) (i64x2.load32x2_u align=16 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 1) (func (result v128) (v8x16.load_splat align=2 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 1) (func (result v128) (v16x8.load_splat align=4 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 1) (func (result v128) (v32x4.load_splat align=8 (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 1) (func (result v128) (v64x2.load_splat align=16 (i32.const 0)))) + "alignment must not be larger than natural" +) + +;; Malformed alignment - (func (export "v128.load_align_1") (result v128) - (v128.load align=1 (i32.const 0)) +(assert_malformed + (module quote + "(memory 1) (func (drop (v128.load align=-1 (i32.const 0))))" ) - (func (export "v128.load_align_2") (result v128) - (v128.load align=2 (i32.const 0)) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (drop (v128.load align=0 (i32.const 0))))" ) - (func (export "v128.load_align_4") (result v128) - (v128.load align=4 (i32.const 0)) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (drop (v128.load align=7 (i32.const 0))))" ) - (func (export "v128.load_align_8") (result v128) - (v128.load align=8 (i32.const 0)) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (v128.store align=-1 (i32.const 0) (v128.const i32x4 0 0 0 0)))" ) - (func (export "v128.load_align_16") (result v128) - (v128.load align=16 (i32.const 0)) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 0) (func (v128.store align=0 (i32.const 0) (v128.const i32x4 0 0 0 0)))" ) - - (func (export "v128.store_align_1") (result v128) - (v128.store align=1 (i32.const 0) (v128.const i32x4 0 1 2 3)) - (v128.load (i32.const 0)) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 0) (func (v128.store align=7 (i32.const 0) (v128.const i32x4 0 0 0 0)))" ) - (func (export "v128.store_align_2") (result v128) - (v128.store align=2 (i32.const 0) (v128.const i32x4 0 1 2 3)) - (v128.load (i32.const 0)) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i16x8.load8x8_s align=-1 (i32.const 0)))" ) - (func (export "v128.store_align_4") (result v128) - (v128.store align=4 (i32.const 0) (v128.const i32x4 0 1 2 3)) - (v128.load (i32.const 0)) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i16x8.load8x8_s align=0 (i32.const 0)))" ) - (func (export "v128.store_align_8") (result v128) - (v128.store align=8 (i32.const 0) (v128.const i32x4 0 1 2 3)) - (v128.load (i32.const 0)) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i16x8.load8x8_s align=7 (i32.const 0)))" ) - (func (export "v128.store_align_16") (result v128) - (v128.store align=16 (i32.const 0) (v128.const i32x4 0 1 2 3)) - (v128.load (i32.const 0)) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i16x8.load8x8_u align=-1 (i32.const 0)))" ) + "alignment must be a power of two" ) - -(assert_return (invoke "v128.load_align_1") (v128.const i32x4 0x03020100 0x07060504 0x11100908 0x15141312)) -(assert_return (invoke "v128.load_align_2") (v128.const i32x4 0x03020100 0x07060504 0x11100908 0x15141312)) -(assert_return (invoke "v128.load_align_4") (v128.const i32x4 0x03020100 0x07060504 0x11100908 0x15141312)) -(assert_return (invoke "v128.load_align_8") (v128.const i32x4 0x03020100 0x07060504 0x11100908 0x15141312)) -(assert_return (invoke "v128.load_align_16") (v128.const i32x4 0x03020100 0x07060504 0x11100908 0x15141312)) - -(assert_return (invoke "v128.store_align_1") (v128.const i32x4 0 1 2 3)) -(assert_return (invoke "v128.store_align_2") (v128.const i32x4 0 1 2 3)) -(assert_return (invoke "v128.store_align_4") (v128.const i32x4 0 1 2 3)) -(assert_return (invoke "v128.store_align_8") (v128.const i32x4 0 1 2 3)) -(assert_return (invoke "v128.store_align_16") (v128.const i32x4 0 1 2 3)) - - -;; Invalid alignment - -(assert_invalid - (module - (memory 1) - (func (drop (v128.load align=32 (i32.const 0)))) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i16x8.load8x8_u align=0 (i32.const 0)))" ) - "alignment must not be larger than natural" + "alignment must be a power of two" ) (assert_malformed (module quote - "(memory 1)" - "(func (drop (v128.load align=-1 (i32.const 0))))" + "(memory 1) (func (result v128) (i16x8.load8x8_u align=7 (i32.const 0)))" ) - "unknown operator" + "alignment must be a power of two" ) (assert_malformed (module quote - "(memory 1)" - "(func (drop (v128.load align=0 (i32.const 0))))" + "(memory 1) (func (result v128) (i32x4.load16x4_s align=-1 (i32.const 0)))" ) "alignment must be a power of two" ) (assert_malformed (module quote - "(memory 1)" - "(func (drop (v128.load align=7 (i32.const 0))))" + "(memory 1) (func (result v128) (i32x4.load16x4_s align=0 (i32.const 0)))" ) "alignment must be a power of two" ) - -(assert_invalid - (module - (memory 0) - (func(v128.store align=32 (i32.const 0) (v128.const i32x4 0 0 0 0))) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i32x4.load16x4_s align=7 (i32.const 0)))" ) - "alignment must not be larger than natural" + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i32x4.load16x4_u align=-1 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i32x4.load16x4_u align=0 (i32.const 0)))" + ) + "alignment must be a power of two" ) (assert_malformed (module quote - "(memory 1)" - " (func (v128.store align=-1 (i32.const 0) (v128.const i32x4 0 0 0 0)))" + "(memory 1) (func (result v128) (i32x4.load16x4_u align=7 (i32.const 0)))" ) - "unknown operator" + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i64x2.load32x2_s align=-1 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i64x2.load32x2_s align=0 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i64x2.load32x2_s align=7 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i64x2.load32x2_u align=-1 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i64x2.load32x2_u align=0 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (i64x2.load32x2_u align=7 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (v8x16.load_splat align=-1 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (v8x16.load_splat align=0 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (v16x8.load_splat align=-1 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (v16x8.load_splat align=0 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (v32x4.load_splat align=-1 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (v32x4.load_splat align=0 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (v32x4.load_splat align=3 (i32.const 0)))" + ) + "alignment must be a power of two" +) +(assert_malformed + (module quote + "(memory 1) (func (result v128) (v64x2.load_splat align=-1 (i32.const 0)))" + ) + "alignment must be a power of two" ) (assert_malformed (module quote - "(memory 0)" - " (func (v128.store align=0 (i32.const 0) (v128.const i32x4 0 0 0 0)))" + "(memory 1) (func (result v128) (v64x2.load_splat align=0 (i32.const 0)))" ) "alignment must be a power of two" ) (assert_malformed (module quote - "(memory 0)" - " (func (v128.store align=7 (i32.const 0) (v128.const i32x4 0 0 0 0)))" + "(memory 1) (func (result v128) (v64x2.load_splat align=7 (i32.const 0)))" ) "alignment must be a power of two" ) @@ -136,7 +327,7 @@ (module (memory 1) - (func (export "v128_unalign_read_and_write") (result v128) + (func (export "v128_unaligned_read_and_write") (result v128) (local v128) (v128.store (i32.const 0) (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)) (v128.load (i32.const 0)) @@ -146,19 +337,19 @@ (v128.store align=2 (i32.const 0) (v128.const i16x8 0 1 2 3 4 5 6 7)) (v128.load align=2 (i32.const 0)) ) - (func (export "v128_aligned_read_and_unalign_write") (result v128) + (func (export "v128_aligned_read_and_unaligned_write") (result v128) (local v128) (v128.store (i32.const 0) (v128.const i32x4 0 1 2 3)) (v128.load align=2 (i32.const 0)) ) - (func (export "v128_unalign_read_and_aligned_write") (result v128) + (func (export "v128_unaligned_read_and_aligned_write") (result v128) (local v128) (v128.store align=2 (i32.const 0) (v128.const i32x4 0 1 2 3)) (v128.load (i32.const 0)) ) ) -(assert_return (invoke "v128_unalign_read_and_write") (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)) +(assert_return (invoke "v128_unaligned_read_and_write") (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)) (assert_return (invoke "v128_aligned_read_and_write") (v128.const i16x8 0 1 2 3 4 5 6 7)) -(assert_return (invoke "v128_aligned_read_and_unalign_write") (v128.const i32x4 0 1 2 3)) -(assert_return (invoke "v128_unalign_read_and_aligned_write") (v128.const i32x4 0 1 2 3)) +(assert_return (invoke "v128_aligned_read_and_unaligned_write") (v128.const i32x4 0 1 2 3)) +(assert_return (invoke "v128_unaligned_read_and_aligned_write") (v128.const i32x4 0 1 2 3)) \ No newline at end of file diff --git a/proposals/simd/simd_const.wast b/proposals/simd/simd_const.wast index b0c1423..ebc734c 100644 --- a/proposals/simd/simd_const.wast +++ b/proposals/simd/simd_const.wast @@ -228,6 +228,10 @@ "unexpected token" ) +(assert_malformed + (module quote "(func (v128.const 0 0 0 0) drop)") + "unexpected token" +) (assert_malformed (module quote "(func (v128.const i8x16) drop)") "wrong number of lane literals" diff --git a/proposals/simd/simd_conversions.wast b/proposals/simd/simd_conversions.wast index 5a06db7..e1c2ff2 100644 --- a/proposals/simd/simd_conversions.wast +++ b/proposals/simd/simd_conversions.wast @@ -6,20 +6,12 @@ (i32x4.trunc_sat_f32x4_s (local.get 0))) (func (export "i32x4.trunc_sat_f32x4_u") (param v128) (result v128) (i32x4.trunc_sat_f32x4_u (local.get 0))) - (func (export "i64x2.trunc_sat_f64x2_s") (param v128) (result v128) - (i64x2.trunc_sat_f64x2_s (local.get 0))) - (func (export "i64x2.trunc_sat_f64x2_u") (param v128) (result v128) - (i64x2.trunc_sat_f64x2_u (local.get 0))) ;; Integer to floating point (func (export "f32x4.convert_i32x4_s") (param v128) (result v128) (f32x4.convert_i32x4_s (local.get 0))) (func (export "f32x4.convert_i32x4_u") (param v128) (result v128) (f32x4.convert_i32x4_u (local.get 0))) - (func (export "f64x2.convert_i64x2_s") (param v128) (result v128) - (f64x2.convert_i64x2_s (local.get 0))) - (func (export "f64x2.convert_i64x2_u") (param v128) (result v128) - (f64x2.convert_i64x2_u (local.get 0))) ;; Integer to integer narrowing (func (export "i8x16.narrow_i16x8_s") (param v128 v128) (result v128) @@ -224,183 +216,6 @@ (v128.const i32x4 123456792 123456792 123456792 123456792)) (assert_return (invoke "i32x4.trunc_sat_f32x4_u" (v128.const f32x4 -0123456789.0 -0123456789.0 -0123456789.0 -0123456789.0)) (v128.const i32x4 0 0 0 0)) -;; i64x2.trunc_sat_f64x2_s - -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 0.0 0.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -0.0 -0.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 1.0 1.0)) - (v128.const i64x2 1 1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -1.0 -1.0)) - (v128.const i64x2 -1 -1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 1.5 1.5)) - (v128.const i64x2 1 1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -1.5 -1.5)) - (v128.const i64x2 -1 -1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 1.9 1.9)) - (v128.const i64x2 1 1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -1.9 -1.9)) - (v128.const i64x2 -1 -1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 2.0 2.0)) - (v128.const i64x2 2 2)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -2.0 -2.0)) - (v128.const i64x2 -2 -2)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 4294967296.0 4294967296.0)) - (v128.const i64x2 4294967296 4294967296)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -4294967296.0 -4294967296.0)) - (v128.const i64x2 -4294967296 -4294967296)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 9223372036854774784.0 9223372036854774784.0)) - (v128.const i64x2 9223372036854774784 9223372036854774784)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -9223372036854774784.0 -9223372036854774784.0)) - (v128.const i64x2 -9223372036854774784 -9223372036854774784)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 9223372036854775808.0 9223372036854775808.0)) - (v128.const i64x2 9223372036854775807 9223372036854775807)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -9223372036854775808.0 -9223372036854775808.0)) - (v128.const i64x2 -9223372036854775808 -9223372036854775808)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 10000000000000000000.0 10000000000000000000.0)) - (v128.const i64x2 9223372036854775807 9223372036854775807)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -10000000000000000000.0 -10000000000000000000.0)) - (v128.const i64x2 -9223372036854775808 -9223372036854775808)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 9223372036854775807.0 9223372036854775807.0)) - (v128.const i64x2 9223372036854775807 9223372036854775807)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -9223372036854775807.0 -9223372036854775807.0)) - (v128.const i64x2 -9223372036854775808 -9223372036854775808)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 0x0.0000000000001p-1022 0x0.0000000000001p-1022)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -0x0.0000000000001p-1022 -0x0.0000000000001p-1022)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 0x1p-1022 0x1p-1022)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -0x1p-1022 -0x1p-1022)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 0x1p-1 0x1p-1)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -0x1p-1 -0x1p-1)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 0x1p+0 0x1p+0)) - (v128.const i64x2 1 1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -0x1p+0 -0x1p+0)) - (v128.const i64x2 -1 -1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 0x1.921fb54442d18p+2 0x1.921fb54442d18p+2)) - (v128.const i64x2 6 6)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -0x1.921fb54442d18p+2 -0x1.921fb54442d18p+2)) - (v128.const i64x2 -6 -6)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 0x1.fffffffffffffp+1023 0x1.fffffffffffffp+1023)) - (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -0x1.fffffffffffffp+1023 -0x1.fffffffffffffp+1023)) - (v128.const i64x2 -0x8000000000000000 -0x8000000000000000)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 inf inf)) - (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -inf -inf)) - (v128.const i64x2 -0x8000000000000000 -0x8000000000000000)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 nan nan)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -nan -nan)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 nan:0x4000000000000 nan:0x4000000000000)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -nan:0x4000000000000 -nan:0x4000000000000)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 3.14 nan)) - (v128.const i64x2 3 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 -3.14 -inf)) - (v128.const i64x2 -3 -0x8000000000000000)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 01234567890123456768.0 01234567890123456768.0)) - (v128.const i64x2 1234567890123456768 1234567890123456768)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_s" (v128.const f64x2 01234567890123456789.0 01234567890123456789.0)) - (v128.const i64x2 0x112210f47de98100 0x112210f47de98100)) -;; i64x2.trunc_sat_f64x2_u - -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 0.0 0.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -0.0 -0.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 1.0 1.0)) - (v128.const i64x2 1 1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -1.0 -1.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 1.5 1.5)) - (v128.const i64x2 1 1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -1.5 -1.5)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 1.9 1.9)) - (v128.const i64x2 1 1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -1.9 -1.9)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 2.0 2.0)) - (v128.const i64x2 2 2)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -2.0 -2.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 4294967296.0 4294967296.0)) - (v128.const i64x2 4294967296 4294967296)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -4294967296.0 -4294967296.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 9223372036854774784.0 9223372036854774784.0)) - (v128.const i64x2 9223372036854774784 9223372036854774784)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -9223372036854774784.0 -9223372036854774784.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 9223372036854775808.0 9223372036854775808.0)) - (v128.const i64x2 9223372036854775808 9223372036854775808)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -9223372036854775808.0 -9223372036854775808.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 10000000000000000000.0 10000000000000000000.0)) - (v128.const i64x2 10000000000000000000 10000000000000000000)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -10000000000000000000.0 -10000000000000000000.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 18446744073709551615.0 18446744073709551615.0)) - (v128.const i64x2 18446744073709551615 18446744073709551615)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -18446744073709551615.0 -18446744073709551615.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 9223372036854775807.0 9223372036854775807.0)) - (v128.const i64x2 9223372036854775808 9223372036854775808)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -9223372036854775807.0 -9223372036854775807.0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 0x0.0000000000001p-1022 0x0.0000000000001p-1022)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -0x0.0000000000001p-1022 -0x0.0000000000001p-1022)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 0x1p-1022 0x1p-1022)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -0x1p-1022 -0x1p-1022)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 0x1p-1 0x1p-1)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -0x1p-1 -0x1p-1)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 0x1p+0 0x1p+0)) - (v128.const i64x2 1 1)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -0x1p+0 -0x1p+0)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 0x1.921fb54442d18p+2 0x1.921fb54442d18p+2)) - (v128.const i64x2 6 6)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -0x1.921fb54442d18p+2 -0x1.921fb54442d18p+2)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 0x1.fffffffffffffp+1023 0x1.fffffffffffffp+1023)) - (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -0x1.fffffffffffffp+1023 -0x1.fffffffffffffp+1023)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 inf inf)) - (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -inf -inf)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 nan nan)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -nan -nan)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 nan:0x4000000000000 nan:0x4000000000000)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -nan:0x4000000000000 -nan:0x4000000000000)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 3.14 nan)) - (v128.const i64x2 3 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -3.14 -inf)) - (v128.const i64x2 0 0)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 01234567890123456768.0 01234567890123456768.0)) - (v128.const i64x2 1234567890123456768 1234567890123456768)) -(assert_return (invoke "i64x2.trunc_sat_f64x2_u" (v128.const f64x2 -01234567890123456789.0 -01234567890123456789.0)) - (v128.const i64x2 0 0)) - ;; Integer to floating point ;; f32x4.convert_i32x4_s @@ -433,34 +248,6 @@ (assert_return (invoke "f32x4.convert_i32x4_s" (v128.const i32x4 0 -1 0x7fffffff 0x80000000)) (v128.const f32x4 0.0 -1.0 2147483647.0 -2147483648.0)) -;; f64x2.convert_i64x2_s - -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 0 0)) - (v128.const f64x2 0.0 0.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 1 1)) - (v128.const f64x2 1.0 1.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 -1 -1)) - (v128.const f64x2 -1.0 -1.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 9223372036854775807 9223372036854775807)) - (v128.const f64x2 9223372036854775807.0 9223372036854775807.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 -9223372036854775808 -9223372036854775808)) - (v128.const f64x2 -9223372036854775808.0 -9223372036854775808.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 4669201609102990 4669201609102990)) - (v128.const f64x2 4669201609102990.0 4669201609102990.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 9007199254740993 9007199254740993)) - (v128.const f64x2 9007199254740992.0 9007199254740992.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 -9007199254740993 -9007199254740993)) - (v128.const f64x2 -9007199254740992.0 -9007199254740992.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 9007199254740995 9007199254740995)) - (v128.const f64x2 9007199254740996.0 9007199254740996.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 -9007199254740995 -9007199254740995)) - (v128.const f64x2 -9007199254740996.0 -9007199254740996.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 0x7fffffffffffffff 0x8000000000000000)) - (v128.const f64x2 9223372036854775807.0 -9223372036854775808.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 01_234_567_890_123_456_789 01_234_567_890_123_456_789)) - (v128.const f64x2 1.2345678901234568e+18 1.2345678901234568e+18)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 0x0_1234_5678_90AB_cdef 0x0_1234_5678_90AB_cdef)) - (v128.const f64x2 1.3117684672948997e+18 1.3117684672948997e+18)) ;; f32x4.convert_i32x4_u (assert_return (invoke "f32x4.convert_i32x4_u" (v128.const i32x4 0 0 0 0)) @@ -500,42 +287,6 @@ (assert_return (invoke "f32x4.convert_i32x4_u" (v128.const i32x4 0 -1 0x7fffffff 0x80000000)) (v128.const f32x4 0.0 4294967295.0 2147483647.0 2147483648.0)) -;; f64x2.convert_i64x2_u - -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 0 0)) - (v128.const f64x2 0.0 0.0)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 1 1)) - (v128.const f64x2 1.0 1.0)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 -1 -1)) - (v128.const f64x2 18446744073709551615.0 18446744073709551615.0)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 9223372036854775807 9223372036854775807)) - (v128.const f64x2 9223372036854775807.0 9223372036854775807.0)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 -9223372036854775808 -9223372036854775808)) - (v128.const f64x2 9223372036854775808.0 9223372036854775808.0)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 0xffffffffffffffff 0xffffffffffffffff)) - (v128.const f64x2 18446744073709551616.0 18446744073709551616.0)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 0x8000000000000400 0x8000000000000400)) - (v128.const f64x2 0x1.0000000000000p+63 0x1.0000000000000p+63)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 0x8000000000000401 0x8000000000000401)) - (v128.const f64x2 0x1.0000000000001p+63 0x1.0000000000001p+63)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 0x8000000000000402 0x8000000000000402)) - (v128.const f64x2 0x1.0000000000001p+63 0x1.0000000000001p+63)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 0xfffffffffffff400 0xfffffffffffff400)) - (v128.const f64x2 0x1.ffffffffffffep+63 0x1.ffffffffffffep+63)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 0xfffffffffffff401 0xfffffffffffff401)) - (v128.const f64x2 0x1.fffffffffffffp+63 0x1.fffffffffffffp+63)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 0xfffffffffffff402 0xfffffffffffff402)) - (v128.const f64x2 0x1.fffffffffffffp+63 0x1.fffffffffffffp+63)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 9007199254740993 9007199254740993)) - (v128.const f64x2 9007199254740992.0 9007199254740992.0)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 9007199254740995 9007199254740995)) - (v128.const f64x2 9007199254740996.0 9007199254740996.0)) -(assert_return (invoke "f64x2.convert_i64x2_u" (v128.const i64x2 0x7fffffffffffffff 0x8000000000000000)) - (v128.const f64x2 9223372036854775807.0 9223372036854775808.0)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 01_234_567_890_123_456_789 01_234_567_890_123_456_789)) - (v128.const f64x2 1.2345678901234568e+18 1.2345678901234568e+18)) -(assert_return (invoke "f64x2.convert_i64x2_s" (v128.const i64x2 0x0_fedc_BA09_8765_4321 0x0_fedc_BA09_8765_4321)) - (v128.const f64x2 -8.198614311047907e+16 -8.198614311047907e+16)) ;; Integer to integer narrowing ;; i8x16.narrow_i16x8_s @@ -1254,22 +1005,16 @@ "unknown operator") (assert_malformed (module quote - "(func (result v128) (i64x2.trunc_sat_f64x2 (v128.const f64x2 0.0 0.0)))") - "unknown operator") -(assert_malformed (module quote - "(func (result v128) (i64x2.trunc_s_sat_f64x2 (v128.const f64x2 -2.0 -1.0)))") - "unknown operator") -(assert_malformed (module quote - "(func (result v128) (i64x2.trunc_u_sat_f64x2 (v128.const f64x2 1.0 2.0)))") + "(func (result v128) (i64x2.trunc_sat_f64x2_s (v128.const f64x2 0.0 0.0)))") "unknown operator") (assert_malformed (module quote - "(func (result v128) (f64x2.convert_i64x2 (v128.const i64x2 -1 0)))") + "(func (result v128) (i64x2.trunc_sat_f64x2_u (v128.const f64x2 -2.0 -1.0)))") "unknown operator") (assert_malformed (module quote - "(func (result v128) (f64x2.convert_s_i64x2 (v128.const i64x2 1 2)))") + "(func (result v128) (f64x2.convert_i64x2_s (v128.const i64x2 1 2)))") "unknown operator") (assert_malformed (module quote - "(func (result v128) (f64x2.convert_u_i64x2 (v128.const i64x2 1 2)))") + "(func (result v128) (f64x2.convert_i64x2_u (v128.const i64x2 1 2)))") "unknown operator") (assert_malformed (module quote @@ -1345,14 +1090,6 @@ (assert_invalid (module (func (result v128) (f32x4.convert_i32x4_s (i64.const 0)))) "type mismatch") (assert_invalid (module (func (result v128) (f32x4.convert_i32x4_u (i32.const 0)))) "type mismatch") (assert_invalid (module (func (result v128) (f32x4.convert_i32x4_u (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result v128) (i64x2.trunc_sat_f64x2_s (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result v128) (i64x2.trunc_sat_f64x2_s (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result v128) (i64x2.trunc_sat_f64x2_u (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result v128) (i64x2.trunc_sat_f64x2_u (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result v128) (f64x2.convert_i64x2_s (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result v128) (f64x2.convert_i64x2_s (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result v128) (f64x2.convert_i64x2_u (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result v128) (f64x2.convert_i64x2_u (i64.const 0)))) "type mismatch") (assert_invalid (module (func (result v128) (i8x16.narrow_i16x8_s (i32.const 0) (i64.const 0)))) "type mismatch") (assert_invalid (module (func (result v128) (i8x16.narrow_i16x8_u (i32.const 0) (i64.const 0)))) "type mismatch") @@ -1378,12 +1115,6 @@ (f32x4.convert_i32x4_s (i32x4.sub (local.get 0) (local.get 1)))) (func (export "f32x4_convert_i32x4_u_mul") (param v128 v128) (result v128) (f32x4.convert_i32x4_u (i32x4.mul (local.get 0) (local.get 1)))) - (func (export "f64x2_convert_i64x2_s_add") (param v128 v128) (result v128) - (f64x2.convert_i64x2_s (i64x2.add (local.get 0) (local.get 1)))) - (func (export "f64x2_convert_i64x2_s_sub") (param v128 v128) (result v128) - (f64x2.convert_i64x2_s (i64x2.sub (local.get 0) (local.get 1)))) - (func (export "f64x2_convert_i64x2_u_mul") (param v128 v128) (result v128) - (f64x2.convert_i64x2_u (i64x2.mul (local.get 0) (local.get 1)))) (func (export "i16x8_low_widen_narrow_ss") (param v128 v128) (result v128) (i16x8.widen_low_i8x16_s (i8x16.narrow_i16x8_s (local.get 0) (local.get 1)))) @@ -1429,15 +1160,6 @@ (assert_return (invoke "f32x4_convert_i32x4_u_mul" (v128.const i32x4 1 2 3 4) (v128.const i32x4 1 2 3 4)) (v128.const f32x4 1.0 4.0 9.0 16.0)) -(assert_return (invoke "f64x2_convert_i64x2_s_add" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff) - (v128.const i64x2 0x8000000000000000 0x8000000000000000)) - (v128.const f64x2 -1.0 -1.0)) -(assert_return (invoke "f64x2_convert_i64x2_s_sub" (v128.const i64x2 0x7fffffffffffffff 0x7fffffffffffffff) - (v128.const i64x2 0x8000000000000000 0x8000000000000000)) - (v128.const f64x2 -1.0 -1.0)) -(assert_return (invoke "f64x2_convert_i64x2_u_mul" (v128.const i64x2 0x7fffffff 0x7fffffff) - (v128.const i64x2 0x80000000 0x80000000)) - (v128.const f64x2 4611686016279904256.0 4611686016279904256.0)) (assert_return (invoke "i16x8_low_widen_narrow_ss" (v128.const i16x8 -0x8000 -0x7fff 0x7fff 0x8000 -0x8000 -0x7fff 0x7fff 0x8000) (v128.const i16x8 -0x8000 -0x7fff 0x7fff 0x8000 -0x8000 -0x7fff 0x7fff 0x8000)) @@ -1507,22 +1229,6 @@ ) "type mismatch" ) -(assert_invalid - (module - (func $i64x2.trunc_sat_f64x2_s-arg-empty (result v128) - (i64x2.trunc_sat_f64x2_s) - ) - ) - "type mismatch" -) -(assert_invalid - (module - (func $i64x2.trunc_sat_f64x2_u-arg-empty (result v128) - (i64x2.trunc_sat_f64x2_u) - ) - ) - "type mismatch" -) (assert_invalid (module (func $f32x4.convert_i32x4_s-arg-empty (result v128) @@ -1539,22 +1245,6 @@ ) "type mismatch" ) -(assert_invalid - (module - (func $f64x2.convert_i64x2_s-arg-empty (result v128) - (f64x2.convert_i64x2_s) - ) - ) - "type mismatch" -) -(assert_invalid - (module - (func $f64x2.convert_i64x2_u-arg-empty (result v128) - (f64x2.convert_i64x2_u) - ) - ) - "type mismatch" -) (assert_invalid (module (func $i8x16.narrow_i16x8_s-1st-arg-empty (result v128) diff --git a/proposals/simd/simd_lane.wast b/proposals/simd/simd_lane.wast index 96b7812..e174df3 100644 --- a/proposals/simd/simd_lane.wast +++ b/proposals/simd/simd_lane.wast @@ -393,36 +393,67 @@ (v128.const i64x2 01_234_567_890_123_456_789_0 0x0_1234_5678_90AB_cdef)) (v128.const i32x4 0xeb1f_0ad2 0xab54_a98c 0x90ab_cdef 0x1234_5678)) +;; Malformed lane index value + +(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_s -1 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_s 256 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_u -1 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_u 256 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane_s -1 (v128.const i16x8 0 0 0 0 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane_s 256 (v128.const i16x8 0 0 0 0 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane_u -1 (v128.const i16x8 0 0 0 0 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result i32) (i16x8.extract_lane_u 256 (v128.const i16x8 0 0 0 0 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result i32) (i32x4.extract_lane -1 (v128.const i32x4 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result i32) (i32x4.extract_lane 256 (v128.const i32x4 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result f32) (f32x4.extract_lane -1 (v128.const f32x4 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result f32) (f32x4.extract_lane 256 (v128.const f32x4 0 0 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (i8x16.replace_lane -1 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (i8x16.replace_lane 256 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (i16x8.replace_lane -1 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (i16x8.replace_lane 256 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (i32x4.replace_lane -1 (v128.const i32x4 0 0 0 0) (i32.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (i32x4.replace_lane 256 (v128.const i32x4 0 0 0 0) (i32.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (f32x4.replace_lane -1 (v128.const f32x4 0 0 0 0) (i32.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (f32x4.replace_lane 256 (v128.const f32x4 0 0 0 0) (i32.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result i64) (i64x2.extract_lane -1 (v128.const i64x2 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result i64) (i64x2.extract_lane 256 (v128.const i64x2 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result f64) (f64x2.extract_lane -1 (v128.const f64x2 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result f64) (f64x2.extract_lane 256 (v128.const f64x2 0 0)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (i64x2.replace_lane -1 (v128.const i64x2 0 0) (i64.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (i64x2.replace_lane 256 (v128.const i64x2 0 0) (i64.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (f64x2.replace_lane -1 (v128.const f64x2 0 0) (f64.const 1)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128) (f64x2.replace_lane 256 (v128.const f64x2 0 0) (f64.const 1)))") "malformed lane index") + ;; Invalid lane index value -(assert_invalid (module (func (result i32) (i8x16.extract_lane_s -1 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index") (assert_invalid (module (func (result i32) (i8x16.extract_lane_s 16 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index") -(assert_invalid (module (func (result i32) (i8x16.extract_lane_u -1 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index") +(assert_invalid (module (func (result i32) (i8x16.extract_lane_s 255 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index") (assert_invalid (module (func (result i32) (i8x16.extract_lane_u 16 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index") -(assert_invalid (module (func (result i32) (i16x8.extract_lane_s -1 (v128.const i16x8 0 0 0 0 0 0 0 0)))) "invalid lane index") +(assert_invalid (module (func (result i32) (i8x16.extract_lane_u 255 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) "invalid lane index") (assert_invalid (module (func (result i32) (i16x8.extract_lane_s 8 (v128.const i16x8 0 0 0 0 0 0 0 0)))) "invalid lane index") -(assert_invalid (module (func (result i32) (i16x8.extract_lane_u -1 (v128.const i16x8 0 0 0 0 0 0 0 0)))) "invalid lane index") +(assert_invalid (module (func (result i32) (i16x8.extract_lane_s 255 (v128.const i16x8 0 0 0 0 0 0 0 0)))) "invalid lane index") (assert_invalid (module (func (result i32) (i16x8.extract_lane_u 8 (v128.const i16x8 0 0 0 0 0 0 0 0)))) "invalid lane index") -(assert_invalid (module (func (result i32) (i32x4.extract_lane -1 (v128.const i32x4 0 0 0 0)))) "invalid lane index") +(assert_invalid (module (func (result i32) (i16x8.extract_lane_u 255 (v128.const i16x8 0 0 0 0 0 0 0 0)))) "invalid lane index") (assert_invalid (module (func (result i32) (i32x4.extract_lane 4 (v128.const i32x4 0 0 0 0)))) "invalid lane index") -(assert_invalid (module (func (result f32) (f32x4.extract_lane -1 (v128.const f32x4 0 0 0 0)))) "invalid lane index") +(assert_invalid (module (func (result i32) (i32x4.extract_lane 255 (v128.const i32x4 0 0 0 0)))) "invalid lane index") (assert_invalid (module (func (result f32) (f32x4.extract_lane 4 (v128.const f32x4 0 0 0 0)))) "invalid lane index") -(assert_invalid (module (func (result v128) (i8x16.replace_lane -1 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index") +(assert_invalid (module (func (result f32) (f32x4.extract_lane 255 (v128.const f32x4 0 0 0 0)))) "invalid lane index") (assert_invalid (module (func (result v128) (i8x16.replace_lane 16 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index") -(assert_invalid (module (func (result v128) (i16x8.replace_lane -1 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index") -(assert_invalid (module (func (result v128) (i16x8.replace_lane 8 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index") -(assert_invalid (module (func (result v128) (i32x4.replace_lane -1 (v128.const i32x4 0 0 0 0) (i32.const 1)))) "invalid lane index") +(assert_invalid (module (func (result v128) (i8x16.replace_lane 255 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index") +(assert_invalid (module (func (result v128) (i16x8.replace_lane 16 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index") +(assert_invalid (module (func (result v128) (i16x8.replace_lane 255 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))) "invalid lane index") (assert_invalid (module (func (result v128) (i32x4.replace_lane 4 (v128.const i32x4 0 0 0 0) (i32.const 1)))) "invalid lane index") -(assert_invalid (module (func (result v128) (f32x4.replace_lane -1 (v128.const f32x4 0 0 0 0) (i32.const 1)))) "invalid lane index") +(assert_invalid (module (func (result v128) (i32x4.replace_lane 255 (v128.const i32x4 0 0 0 0) (i32.const 1)))) "invalid lane index") (assert_invalid (module (func (result v128) (f32x4.replace_lane 4 (v128.const f32x4 0 0 0 0) (i32.const 1)))) "invalid lane index") -(assert_invalid (module (func (result i64) (i64x2.extract_lane -1 (v128.const i64x2 0 0)))) "invalid lane index") +(assert_invalid (module (func (result v128) (f32x4.replace_lane 255 (v128.const f32x4 0 0 0 0) (i32.const 1)))) "invalid lane index") (assert_invalid (module (func (result i64) (i64x2.extract_lane 2 (v128.const i64x2 0 0)))) "invalid lane index") -(assert_invalid (module (func (result f64) (f64x2.extract_lane -1 (v128.const f64x2 0 0)))) "invalid lane index") +(assert_invalid (module (func (result i64) (i64x2.extract_lane 255 (v128.const i64x2 0 0)))) "invalid lane index") (assert_invalid (module (func (result f64) (f64x2.extract_lane 2 (v128.const f64x2 0 0)))) "invalid lane index") -(assert_invalid (module (func (result v128) (i64x2.replace_lane -1 (v128.const i64x2 0 0) (i64.const 1)))) "invalid lane index") +(assert_invalid (module (func (result f64) (f64x2.extract_lane 255 (v128.const f64x2 0 0)))) "invalid lane index") (assert_invalid (module (func (result v128) (i64x2.replace_lane 2 (v128.const i64x2 0 0) (i64.const 1)))) "invalid lane index") -(assert_invalid (module (func (result v128) (f64x2.replace_lane -1 (v128.const f64x2 0 0) (f64.const 1)))) "invalid lane index") -(assert_invalid (module (func (result v128) (f64x2.replace_lane 2 (v128.const f64x2 0 0) (f64.const 1.0)))) "invalid lane index") +(assert_invalid (module (func (result v128) (i64x2.replace_lane 255 (v128.const i64x2 0 0) (i64.const 1)))) "invalid lane index") +(assert_invalid (module (func (result v128) (f64x2.replace_lane 2 (v128.const f64x2 0 0) (f64.const 1)))) "invalid lane index") +(assert_invalid (module (func (result v128) (f64x2.replace_lane 255 (v128.const f64x2 0 0) (f64.const 1.0)))) "invalid lane index") ;; Lane index is determined by the instruction's interpretation only. @@ -488,12 +519,16 @@ "local.get 0" "v8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16)") "invalid lane length") +(assert_malformed (module quote "(func (result v128)" + "(v8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -1" + "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)" + "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))") "malformed lane index") +(assert_malformed (module quote "(func (result v128)" + "(v8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 256" + "(v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0)" + "(v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))") "malformed lane index") (assert_invalid (module (func (result v128) - (v8x16.shuffle -1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 - (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) - (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))) "invalid lane index") -(assert_invalid (module (func (result v128) - (v8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 32 + (v8x16.shuffle 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 255 (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)))) "invalid lane index") @@ -847,149 +882,394 @@ (assert_return (invoke "as-local_set-value-1" (v128.const i64x2 -1 -1)) (i64.const -1)) (assert_return (invoke "as-global_set-value-3" (v128.const f64x2 0 0)(f64.const 3.14)) (v128.const f64x2 3.14 0)) +;; Lane index literal + +(module (func (result i32) (i8x16.extract_lane_s 0x0f (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) +(module (func (result i32) (i8x16.extract_lane_u +0x0f (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))) +(module (func (result i32) (i16x8.extract_lane_s 0x07 (v128.const i16x8 0 0 0 0 0 0 0 0)))) +(module (func (result i32) (i16x8.extract_lane_u 0x0_7 (v128.const i16x8 0 0 0 0 0 0 0 0)))) +(module (func (result i32) (i32x4.extract_lane 03 (v128.const i32x4 0 0 0 0)))) +(module (func (result f32) (f32x4.extract_lane +03 (v128.const f32x4 0 0 0 0)))) +(module (func (result i64) (i64x2.extract_lane +1 (v128.const i64x2 0 0)))) +(module (func (result f64) (f64x2.extract_lane 0x1 (v128.const f64x2 0 0)))) +(module (func (result v128) (i8x16.replace_lane +015 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1)))) +(module (func (result v128) (i16x8.replace_lane +0x7 (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1)))) +(module (func (result v128) (i32x4.replace_lane +3 (v128.const i32x4 0 0 0 0) (i32.const 1)))) +(module (func (result v128) (f32x4.replace_lane 0x3 (v128.const f32x4 0 0 0 0) (f32.const 1.0)))) +(module (func (result v128) (i64x2.replace_lane 01 (v128.const i64x2 0 0) (i64.const 1)))) +(module (func (result v128) (f64x2.replace_lane +0x01 (v128.const f64x2 0 0) (f64.const 1.0)))) +(module (func (result v128) (v8x16.shuffle 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f + (v128.const i8x16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0) (v128.const i8x16 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15))) +) + +;; 1.0 is malformed lane index + +(assert_malformed (module quote "(func (result i32) (i8x16.extract_lane_s 1.0 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)))") "malformed lane index") + ;; Test operation with empty argument +(assert_malformed + (module quote + "(func $i8x16.extract_lane_s-1st-arg-empty (result i32)" + " (i8x16.extract_lane_s (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0))" + ")" + ) + "type mismatch" +) (assert_invalid - (module - (func $i8x16.extract_lane_s-1st-arg-empty (result i32) - (i8x16.extract_lane_s (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) - ) + (module quote + "(func $i8x16.extract_lane_s-2nd-arg-empty (result i32)" + " (i8x16.extract_lane_s 0)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $i8x16.extract_lane_s-arg-empty (result i32)" + " (i8x16.extract_lane_s)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $i16x8.extract_lane_u-1st-arg-empty (result i32)" + " (i16x8.extract_lane_u (v128.const i16x8 0 0 0 0 0 0 0 0))" + ")" + ) + "type mismatch" +) +(assert_invalid + (module quote + "(func $i16x8.extract_lane_u-2nd-arg-empty (result i32)" + " (i16x8.extract_lane_u 0)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $i16x8.extract_lane_u-arg-empty (result i32)" + " (i16x8.extract_lane_u)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $i32x4.extract_lane-1st-arg-empty (result i32)" + " (i32x4.extract_lane (v128.const i32x4 0 0 0 0))" + ")" ) "type mismatch" ) (assert_invalid (module - (func $i8x16.extract_lane_s-2nd-arg-empty (result i32) - (i8x16.extract_lane_s 0) + (func $i32x4.extract_lane-2nd-arg-empty (result i32) + (i32x4.extract_lane 0) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $i32x4.extract_lane-arg-empty (result i32)" + " (i32x4.extract_lane)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $i64x2.extract_lane-1st-arg-empty (result i64)" + " (i64x2.extract_lane (v128.const i64x2 0 0))" + ")" + ) + "type mismatch" +) (assert_invalid (module - (func $i8x16.extract_lane_s-arg-empty (result i32) - (i8x16.extract_lane_s) + (func $i64x2.extract_lane-2nd-arg-empty (result i64) + (i64x2.extract_lane 0) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $i64x2.extract_lane-arg-empty (result i64)" + " (i64x2.extract_lane)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $f32x4.extract_lane-1st-arg-empty (result f32)" + " (f32x4.extract_lane (v128.const f32x4 0 0 0 0))" + ")" + ) + "type mismatch" +) (assert_invalid (module - (func $i16x8.extract_lane_u-1st-arg-empty (result i32) - (i16x8.extract_lane_u (v128.const i16x8 0 0 0 0 0 0 0 0)) + (func $f32x4.extract_lane-2nd-arg-empty (result f32) + (f32x4.extract_lane 0) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $f32x4.extract_lane-arg-empty (result f32)" + " (f32x4.extract_lane)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $f64x2.extract_lane-1st-arg-empty (result f64)" + " (f64x2.extract_lane (v128.const f64x2 0 0))" + ")" + ) + "type mismatch" +) (assert_invalid (module - (func $i16x8.extract_lane_u-2nd-arg-empty (result i32) - (i16x8.extract_lane_u 0) + (func $f64x2.extract_lane-2nd-arg-empty (result f64) + (f64x2.extract_lane 0) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $f64x2.extract_lane-arg-empty (result f64)" + " (f64x2.extract_lane)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $i8x16.replace_lane-1st-arg-empty (result v128)" + " (i8x16.replace_lane (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) (i32.const 1))" + ")" + ) + "type mismatch" +) (assert_invalid (module - (func $i16x8.extract_lane_u-arg-empty (result i32) - (i16x8.extract_lane_u) + (func $i8x16.replace_lane-2nd-arg-empty (result v128) + (i8x16.replace_lane 0 (i32.const 1)) ) ) "type mismatch" ) (assert_invalid (module - (func $i32x4.extract_lane-1st-arg-empty (result i32) - (i32x4.extract_lane (v128.const i32x4 0 0 0 0)) + (func $i8x16.replace_lane-3rd-arg-empty (result v128) + (i8x16.replace_lane 0 (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $i8x16.replace_lane-arg-empty (result v128)" + " (i8x16.replace_lane)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $i16x8.replace_lane-1st-arg-empty (result v128)" + " (i16x8.replace_lane (v128.const i16x8 0 0 0 0 0 0 0 0) (i32.const 1))" + ")" + ) + "type mismatch" +) (assert_invalid (module - (func $i32x4.extract_lane-2nd-arg-empty (result i32) - (i32x4.extract_lane 0) + (func $i16x8.replace_lane-2nd-arg-empty (result v128) + (i16x8.replace_lane 0 (i32.const 1)) ) ) "type mismatch" ) (assert_invalid (module - (func $i32x4.extract_lane-arg-empty (result i32) - (i32x4.extract_lane) + (func $i16x8.replace_lane-3rd-arg-empty (result v128) + (i16x8.replace_lane 0 (v128.const i16x8 0 0 0 0 0 0 0 0)) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $i16x8.replace_lane-arg-empty (result v128)" + " (i16x8.replace_lane)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $i32x4.replace_lane-1st-arg-empty (result v128)" + " (i32x4.replace_lane (v128.const i32x4 0 0 0 0) (i32.const 1))" + ")" + ) + "type mismatch" +) (assert_invalid (module - (func $i64x2.extract_lane-1st-arg-empty (result i64) - (i64x2.extract_lane (v128.const i64x2 0 0)) + (func $i32x4.replace_lane-2nd-arg-empty (result v128) + (i32x4.replace_lane 0 (i32.const 1)) ) ) "type mismatch" ) (assert_invalid (module - (func $i64x2.extract_lane-2nd-arg-empty (result i64) - (i64x2.extract_lane 0) + (func $i32x4.replace_lane-3rd-arg-empty (result v128) + (i32x4.replace_lane 0 (v128.const i32x4 0 0 0 0)) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $i32x4.replace_lane-arg-empty (result v128)" + " (i32x4.replace_lane)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $f32x4.replace_lane-1st-arg-empty (result v128)" + " (f32x4.replace_lane (v128.const f32x4 0 0 0 0) (f32.const 1.0))" + ")" + ) + "type mismatch" +) (assert_invalid (module - (func $i64x2.extract_lane-arg-empty (result i64) - (i64x2.extract_lane) + (func $f32x4.replace_lane-2nd-arg-empty (result v128) + (f32x4.replace_lane 0 (f32.const 1.0)) ) ) "type mismatch" ) (assert_invalid (module - (func $f32x4.extract_lane-1st-arg-empty (result f32) - (f32x4.extract_lane (v128.const f32x4 0 0 0 0)) + (func $f32x4.replace_lane-3rd-arg-empty (result v128) + (f32x4.replace_lane 0 (v128.const f32x4 0 0 0 0)) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $f32x4.replace_lane-arg-empty (result v128)" + " (f32x4.replace_lane)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $i64x2.replace_lane-1st-arg-empty (result v128)" + " (i64x2.replace_lane (v128.const i64x2 0 0) (i64.const 1))" + ")" + ) + "type mismatch" +) (assert_invalid (module - (func $f32x4.extract_lane-2nd-arg-empty (result f32) - (f32x4.extract_lane 0) + (func $i64x2.replace_lane-2nd-arg-empty (result v128) + (i64x2.replace_lane 0 (i64.const 1)) ) ) "type mismatch" ) (assert_invalid (module - (func $f32x4.extract_lane-arg-empty (result f32) - (f32x4.extract_lane) + (func $i64x2.replace_lane-3rd-arg-empty (result v128) + (i64x2.replace_lane 0 (v128.const i64x2 0 0)) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $i64x2.replace_lane-arg-empty (result v128)" + " (i64x2.replace_lane)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $f64x2.replace_lane-1st-arg-empty (result v128)" + " (f64x2.replace_lane (v128.const f64x2 0 0) (f64.const 1.0))" + ")" + ) + "type mismatch" +) (assert_invalid (module - (func $f64x2.extract_lane-1st-arg-empty (result f64) - (f64x2.extract_lane (v128.const f64x2 0 0)) + (func $f64x2.replace_lane-2nd-arg-empty (result v128) + (f64x2.replace_lane 0 (f64.const 1.0)) ) ) "type mismatch" ) (assert_invalid (module - (func $f64x2.extract_lane-2nd-arg-empty (result f64) - (f64x2.extract_lane 0) + (func $f64x2.replace_lane-3rd-arg-empty (result v128) + (f64x2.replace_lane 0 (v128.const f64x2 0 0)) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $f64x2.replace_lane-arg-empty (result v128)" + " (f64x2.replace_lane)" + ")" + ) + "type mismatch" +) +(assert_malformed + (module quote + "(func $v8x16.shuffle-1st-arg-empty (result v128)" + " (v8x16.shuffle" + " (v128.const i8x16 0 1 2 3 5 6 6 7 8 9 10 11 12 13 14 15)" + " (v128.const i8x16 1 2 3 5 6 6 7 8 9 10 11 12 13 14 15 16)" + " )" + ")" + ) + "type mismatch" +) (assert_invalid (module - (func $f64x2.extract_lane-arg-empty (result f64) - (f64x2.extract_lane) + (func $v8x16.shuffle-2nd-arg-empty (result v128) + (v8x16.shuffle 0 1 2 3 5 6 6 7 8 9 10 11 12 13 14 15 + (v128.const i8x16 1 2 3 5 6 6 7 8 9 10 11 12 13 14 15 16) + ) ) ) "type mismatch" ) +(assert_malformed + (module quote + "(func $v8x16.shuffle-arg-empty (result v128)" + " (v8x16.shuffle)" + ")" + ) + "type mismatch" +) \ No newline at end of file diff --git a/proposals/simd/simd_load.wast b/proposals/simd/simd_load.wast index 1cc2045..78c6c93 100644 --- a/proposals/simd/simd_load.wast +++ b/proposals/simd/simd_load.wast @@ -182,31 +182,7 @@ (module (memory 1) (func (drop (v128.load (local.get 2))))) "unknown local 2" ) - - -;; Test operation with empty argument - -(assert_invalid - (module - (func $v128.const-arg-empty (result v128) - (v128.const) - ) - ) - "type mismatch" -) (assert_invalid - (module - (func $v128.const-1st-arg-empty (result v128) - (v128.const 0 0 0 0) - ) - ) - "type mismatch" -) -(assert_invalid - (module - (func $v128.const-2nd-arg-empty (result v128) - (v128.const i32x4) - ) - ) + (module (memory 1) (func (drop (v128.load)))) "type mismatch" -) +) \ No newline at end of file