diff --git a/test/core/binary.wast b/test/core/binary.wast index c0e3f41586..c94e15a242 100644 --- a/test/core/binary.wast +++ b/test/core/binary.wast @@ -52,6 +52,44 @@ (assert_malformed (module binary "\00asm" "\01\00\00\00" "\ff\00\01\00") "malformed section id") +(module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; Memory section with 1 entry + "\00\00" ;; no max, minimum 0 + "\0b\06\01" ;; Data section with 1 entry + "\00" ;; Memory index 0 + "\41\00\0b\00" ;; (i32.const 0) with contents "" +) + +(module binary + "\00asm" "\01\00\00\00" + "\04\04\01" ;; Table section with 1 entry + "\70\00\00" ;; no max, minimum 0, funcref + "\09\06\01" ;; Element section with 1 entry + "\00" ;; Table index 0 + "\41\00\0b\00" ;; (i32.const 0) with no elements +) + +;; Data segment memory index can have non-minimal length +(module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; Memory section with 1 entry + "\00\00" ;; no max, minimum 0 + "\0b\07\01" ;; Data section with 1 entry + "\80\00" ;; Memory index 0, encoded with 2 bytes + "\41\00\0b\00" ;; (i32.const 0) with contents "" +) + +;; Element segment table index can have non-minimal length +(module binary + "\00asm" "\01\00\00\00" + "\04\04\01" ;; Table section with 1 entry + "\70\00\00" ;; no max, minimum 0, funcref + "\09\09\01" ;; Element section with 1 entry + "\02\80\00" ;; Table index 0, encoded with 2 bytes + "\41\00\0b\00\00" ;; (i32.const 0) with no elements +) + ;; Type section with signed LEB128 encoded type (assert_malformed (module binary @@ -176,7 +214,7 @@ "\1a" ;; drop "\0b" ;; end ) - "zero flag expected" + "zero byte expected" ) ;; memory.grow reserved byte should not be a "long" LEB128 zero. @@ -196,7 +234,7 @@ "\1a" ;; drop "\0b" ;; end ) - "zero flag expected" + "zero byte expected" ) ;; Same as above for 3, 4, and 5-byte zero encodings. @@ -216,7 +254,7 @@ "\1a" ;; drop "\0b" ;; end ) - "zero flag expected" + "zero byte expected" ) (assert_malformed @@ -235,7 +273,7 @@ "\1a" ;; drop "\0b" ;; end ) - "zero flag expected" + "zero byte expected" ) (assert_malformed @@ -254,7 +292,7 @@ "\1a" ;; drop "\0b" ;; end ) - "zero flag expected" + "zero byte expected" ) ;; memory.size reserved byte equal to zero. @@ -273,7 +311,7 @@ "\1a" ;; drop "\0b" ;; end ) - "zero flag expected" + "zero byte expected" ) ;; memory.size reserved byte should not be a "long" LEB128 zero. @@ -292,7 +330,7 @@ "\1a" ;; drop "\0b" ;; end ) - "zero flag expected" + "zero byte expected" ) ;; Same as above for 3, 4, and 5-byte zero encodings. @@ -311,7 +349,7 @@ "\1a" ;; drop "\0b" ;; end ) - "zero flag expected" + "zero byte expected" ) (assert_malformed @@ -329,7 +367,7 @@ "\1a" ;; drop "\0b" ;; end ) - "zero flag expected" + "zero byte expected" ) (assert_malformed @@ -347,7 +385,7 @@ "\1a" ;; drop "\0b" ;; end ) - "zero flag expected" + "zero byte expected" ) ;; Local number is unsigned 32 bit diff --git a/test/core/data.wast b/test/core/data.wast index e840a94674..dc152aba51 100644 --- a/test/core/data.wast +++ b/test/core/data.wast @@ -8,14 +8,26 @@ (data (i32.const 1) "a" "" "bcd") (data (offset (i32.const 0))) (data (offset (i32.const 0)) "" "a" "bc" "") - (data 0 (i32.const 0)) - (data 0x0 (i32.const 1) "a" "" "bcd") - (data 0x000 (offset (i32.const 0))) - (data 0 (offset (i32.const 0)) "" "a" "bc" "") - (data $m (i32.const 0)) - (data $m (i32.const 1) "a" "" "bcd") - (data $m (offset (i32.const 0))) - (data $m (offset (i32.const 0)) "" "a" "bc" "") + (data (memory 0) (i32.const 0)) + (data (memory 0x0) (i32.const 1) "a" "" "bcd") + (data (memory 0x000) (offset (i32.const 0))) + (data (memory 0) (offset (i32.const 0)) "" "a" "bc" "") + (data (memory $m) (i32.const 0)) + (data (memory $m) (i32.const 1) "a" "" "bcd") + (data (memory $m) (offset (i32.const 0))) + (data (memory $m) (offset (i32.const 0)) "" "a" "bc" "") + (data $d1 (i32.const 0)) + (data $d2 (i32.const 1) "a" "" "bcd") + (data $d3 (offset (i32.const 0))) + (data $d4 (offset (i32.const 0)) "" "a" "bc" "") + (data $d5 (memory 0) (i32.const 0)) + (data $d6 (memory 0x0) (i32.const 1) "a" "" "bcd") + (data $d7 (memory 0x000) (offset (i32.const 0))) + (data $d8 (memory 0) (offset (i32.const 0)) "" "a" "bc" "") + (data $d9 (memory $m) (i32.const 0)) + (data $d10 (memory $m) (i32.const 1) "a" "" "bcd") + (data $d11 (memory $m) (offset (i32.const 0))) + (data $d12 (memory $m) (offset (i32.const 0)) "" "a" "bc" "") ) ;; Basic use @@ -158,44 +170,42 @@ ;; Invalid bounds for data -(assert_unlinkable +(assert_trap (module (memory 0) (data (i32.const 0) "a") ) - "data segment does not fit" + "out of bounds memory access" ) -(assert_unlinkable +(assert_trap (module (memory 0 0) (data (i32.const 0) "a") ) - "data segment does not fit" + "out of bounds memory access" ) -(assert_unlinkable +(assert_trap (module (memory 0 1) (data (i32.const 0) "a") ) - "data segment does not fit" + "out of bounds memory access" ) - -(assert_unlinkable +(assert_trap (module (memory 0) (data (i32.const 1)) ) - "data segment does not fit" + "out of bounds memory access" ) - -(assert_unlinkable +(assert_trap (module (memory 0 1) (data (i32.const 1)) ) - "data segment does not fit" + "out of bounds memory access" ) ;; This seems to cause a time-out on Travis. @@ -204,77 +214,77 @@ (memory 0x10000) (data (i32.const 0xffffffff) "ab") ) - "" ;; either out of memory or segment does not fit + "" ;; either out of memory or out of bounds ;) -(assert_unlinkable +(assert_trap (module (global (import "spectest" "global_i32") i32) (memory 0) (data (global.get 0) "a") ) - "data segment does not fit" + "out of bounds memory access" ) -(assert_unlinkable +(assert_trap (module (memory 1 2) (data (i32.const 0x1_0000) "a") ) - "data segment does not fit" + "out of bounds memory access" ) -(assert_unlinkable +(assert_trap (module (import "spectest" "memory" (memory 1)) (data (i32.const 0x1_0000) "a") ) - "data segment does not fit" + "out of bounds memory access" ) -(assert_unlinkable +(assert_trap (module (memory 2) (data (i32.const 0x2_0000) "a") ) - "data segment does not fit" + "out of bounds memory access" ) -(assert_unlinkable +(assert_trap (module (memory 2 3) (data (i32.const 0x2_0000) "a") ) - "data segment does not fit" + "out of bounds memory access" ) -(assert_unlinkable +(assert_trap (module (memory 1) (data (i32.const -1) "a") ) - "data segment does not fit" + "out of bounds memory access" ) -(assert_unlinkable +(assert_trap (module (import "spectest" "memory" (memory 1)) (data (i32.const -1) "a") ) - "data segment does not fit" + "out of bounds memory access" ) -(assert_unlinkable +(assert_trap (module (memory 2) (data (i32.const -100) "a") ) - "data segment does not fit" + "out of bounds memory access" ) -(assert_unlinkable +(assert_trap (module (import "spectest" "memory" (memory 1)) (data (i32.const -100) "a") ) - "data segment does not fit" + "out of bounds memory access" ) ;; Data without memory diff --git a/test/core/elem.wast b/test/core/elem.wast index ce8ec1f60f..30f65d8dfd 100644 --- a/test/core/elem.wast +++ b/test/core/elem.wast @@ -139,107 +139,106 @@ ;; Invalid bounds for elements -(assert_unlinkable +(assert_trap (module (table 0 funcref) (func $f) (elem (i32.const 0) $f) ) - "elements segment does not fit" + "out of bounds table access" ) -(assert_unlinkable +(assert_trap (module (table 0 0 funcref) (func $f) (elem (i32.const 0) $f) ) - "elements segment does not fit" + "out of bounds table access" ) -(assert_unlinkable +(assert_trap (module (table 0 1 funcref) (func $f) (elem (i32.const 0) $f) ) - "elements segment does not fit" + "out of bounds table access" ) -(assert_unlinkable +(assert_trap (module (table 0 funcref) (elem (i32.const 1)) ) - "elements segment does not fit" + "out of bounds table access" ) - -(assert_unlinkable +(assert_trap (module (table 10 funcref) (func $f) (elem (i32.const 10) $f) ) - "elements segment does not fit" + "out of bounds table access" ) -(assert_unlinkable +(assert_trap (module (import "spectest" "table" (table 10 funcref)) (func $f) (elem (i32.const 10) $f) ) - "elements segment does not fit" + "out of bounds table access" ) -(assert_unlinkable +(assert_trap (module (table 10 20 funcref) (func $f) (elem (i32.const 10) $f) ) - "elements segment does not fit" + "out of bounds table access" ) -(assert_unlinkable +(assert_trap (module (import "spectest" "table" (table 10 funcref)) (func $f) (elem (i32.const 10) $f) ) - "elements segment does not fit" + "out of bounds table access" ) -(assert_unlinkable +(assert_trap (module (table 10 funcref) (func $f) (elem (i32.const -1) $f) ) - "elements segment does not fit" + "out of bounds table access" ) -(assert_unlinkable +(assert_trap (module (import "spectest" "table" (table 10 funcref)) (func $f) (elem (i32.const -1) $f) ) - "elements segment does not fit" + "out of bounds table access" ) -(assert_unlinkable +(assert_trap (module (table 10 funcref) (func $f) (elem (i32.const -10) $f) ) - "elements segment does not fit" + "out of bounds table access" ) -(assert_unlinkable +(assert_trap (module (import "spectest" "table" (table 10 funcref)) (func $f) (elem (i32.const -10) $f) ) - "elements segment does not fit" + "out of bounds table access" ) ;; Element without table diff --git a/test/core/imports.wast b/test/core/imports.wast index 6cfca2fc62..e6561df91d 100644 --- a/test/core/imports.wast +++ b/test/core/imports.wast @@ -14,6 +14,7 @@ (table (export "table-10-inf") 10 funcref) ;; (table (export "table-10-20") 10 20 funcref) (memory (export "memory-2-inf") 2) + ;; Multiple memories are not yet supported ;; (memory (export "memory-2-4") 2 4) ) @@ -451,7 +452,7 @@ (module (import "spectest" "memory" (memory 1 2)) - (data 0 (i32.const 10) "\10") + (data (memory 0) (i32.const 10) "\10") (func (export "load") (param i32) (result i32) (i32.load (local.get 0))) ) @@ -463,7 +464,7 @@ (module (memory (import "spectest" "memory") 1 2) - (data 0 (i32.const 10) "\10") + (data (memory 0) (i32.const 10) "\10") (func (export "load") (param i32) (result i32) (i32.load (local.get 0))) ) diff --git a/test/core/linking.wast b/test/core/linking.wast index 6868e8b709..cfb2363991 100644 --- a/test/core/linking.wast +++ b/test/core/linking.wast @@ -133,23 +133,23 @@ (assert_return (invoke $Nt "call" (i32.const 2)) (i32.const 5)) (assert_return (invoke $Nt "call Mt.call" (i32.const 2)) (i32.const 4)) -(assert_trap (invoke $Mt "call" (i32.const 1)) "uninitialized") -(assert_trap (invoke $Nt "Mt.call" (i32.const 1)) "uninitialized") +(assert_trap (invoke $Mt "call" (i32.const 1)) "uninitialized element") +(assert_trap (invoke $Nt "Mt.call" (i32.const 1)) "uninitialized element") (assert_return (invoke $Nt "call" (i32.const 1)) (i32.const 5)) -(assert_trap (invoke $Nt "call Mt.call" (i32.const 1)) "uninitialized") +(assert_trap (invoke $Nt "call Mt.call" (i32.const 1)) "uninitialized element") -(assert_trap (invoke $Mt "call" (i32.const 0)) "uninitialized") -(assert_trap (invoke $Nt "Mt.call" (i32.const 0)) "uninitialized") +(assert_trap (invoke $Mt "call" (i32.const 0)) "uninitialized element") +(assert_trap (invoke $Nt "Mt.call" (i32.const 0)) "uninitialized element") (assert_return (invoke $Nt "call" (i32.const 0)) (i32.const 5)) -(assert_trap (invoke $Nt "call Mt.call" (i32.const 0)) "uninitialized") +(assert_trap (invoke $Nt "call Mt.call" (i32.const 0)) "uninitialized element") -(assert_trap (invoke $Mt "call" (i32.const 20)) "undefined") -(assert_trap (invoke $Nt "Mt.call" (i32.const 20)) "undefined") -(assert_trap (invoke $Nt "call" (i32.const 7)) "undefined") -(assert_trap (invoke $Nt "call Mt.call" (i32.const 20)) "undefined") +(assert_trap (invoke $Mt "call" (i32.const 20)) "undefined element") +(assert_trap (invoke $Nt "Mt.call" (i32.const 20)) "undefined element") +(assert_trap (invoke $Nt "call" (i32.const 7)) "undefined element") +(assert_trap (invoke $Nt "call Mt.call" (i32.const 20)) "undefined element") (assert_return (invoke $Nt "call" (i32.const 3)) (i32.const -4)) -(assert_trap (invoke $Nt "call" (i32.const 4)) "indirect call") +(assert_trap (invoke $Nt "call" (i32.const 4)) "indirect call type mismatch") (module $Ot (type (func (result i32))) @@ -181,13 +181,13 @@ (assert_return (invoke $Nt "call Mt.call" (i32.const 1)) (i32.const 6)) (assert_return (invoke $Ot "call" (i32.const 1)) (i32.const 6)) -(assert_trap (invoke $Mt "call" (i32.const 0)) "uninitialized") -(assert_trap (invoke $Nt "Mt.call" (i32.const 0)) "uninitialized") +(assert_trap (invoke $Mt "call" (i32.const 0)) "uninitialized element") +(assert_trap (invoke $Nt "Mt.call" (i32.const 0)) "uninitialized element") (assert_return (invoke $Nt "call" (i32.const 0)) (i32.const 5)) -(assert_trap (invoke $Nt "call Mt.call" (i32.const 0)) "uninitialized") -(assert_trap (invoke $Ot "call" (i32.const 0)) "uninitialized") +(assert_trap (invoke $Nt "call Mt.call" (i32.const 0)) "uninitialized element") +(assert_trap (invoke $Ot "call" (i32.const 0)) "uninitialized element") -(assert_trap (invoke $Ot "call" (i32.const 20)) "undefined") +(assert_trap (invoke $Ot "call" (i32.const 20)) "undefined element") (module (table (import "Mt" "tab") 0 funcref) @@ -203,13 +203,13 @@ ) (assert_return (get $G2 "g") (i32.const 5)) -(assert_unlinkable +(assert_trap (module (table (import "Mt" "tab") 0 funcref) (elem (i32.const 10) $f) (func $f) ) - "elements segment does not fit" + "out of bounds table access" ) (assert_unlinkable @@ -222,28 +222,28 @@ ) "unknown import" ) -(assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized") +(assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized element") -(assert_unlinkable +(assert_trap (module (table (import "Mt" "tab") 10 funcref) (func $f (result i32) (i32.const 0)) (elem (i32.const 7) $f) - (elem (i32.const 12) $f) ;; out of bounds + (elem (i32.const 8) $f $f $f $f $f) ;; (partially) out of bounds ) - "elements segment does not fit" + "out of bounds table access" ) (assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized") -(assert_unlinkable +(assert_trap (module (table (import "Mt" "tab") 10 funcref) (func $f (result i32) (i32.const 0)) (elem (i32.const 7) $f) (memory 1) - (data (i32.const 0x10000) "d") ;; out of bounds + (data (i32.const 0x10000) "d") ;; out of bounds ) - "data segment does not fit" + "out of bounds memory access" ) (assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized") @@ -295,12 +295,12 @@ (data (i32.const 0xffff) "a") ) -(assert_unlinkable +(assert_trap (module (memory (import "Mm" "mem") 0) (data (i32.const 0x10000) "a") ) - "data segment does not fit" + "out of bounds memory access" ) (module $Pm @@ -331,25 +331,26 @@ ) (assert_return (invoke $Mm "load" (i32.const 0)) (i32.const 0)) -(assert_unlinkable +(assert_trap (module + ;; Note: the memory is 5 pages large by the time we get here. (memory (import "Mm" "mem") 1) (data (i32.const 0) "abc") - (data (i32.const 0x50000) "d") ;; out of bounds + (data (i32.const 327670) "zzzzzzzzzzzzzzzzzz") ;; (partially) out of bounds ) - "data segment does not fit" + "out of bounds memory access" ) (assert_return (invoke $Mm "load" (i32.const 0)) (i32.const 0)) -(assert_unlinkable +(assert_trap (module (memory (import "Mm" "mem") 1) (data (i32.const 0) "abc") (table 0 funcref) (func) - (elem (i32.const 0) 0) ;; out of bounds + (elem (i32.const 0) 0) ;; out of bounds ) - "elements segment does not fit" + "out of bounds table access" ) (assert_return (invoke $Mm "load" (i32.const 0)) (i32.const 0)) diff --git a/test/core/memory_grow.wast b/test/core/memory_grow.wast index 8a87c77c64..aa56297d25 100644 --- a/test/core/memory_grow.wast +++ b/test/core/memory_grow.wast @@ -312,8 +312,8 @@ (assert_invalid (module (memory 0) - (func $type-size-empty - (memory.grow) (drop) + (func $type-size-empty-vs-i32 (result i32) + (memory.grow) ) ) "type mismatch" @@ -321,9 +321,9 @@ (assert_invalid (module (memory 0) - (func $type-size-empty-in-block + (func $type-size-empty-vs-i32-in-block (result i32) (i32.const 0) - (block (memory.grow) (drop)) + (block (result i32) (memory.grow)) ) ) "type mismatch" @@ -331,9 +331,9 @@ (assert_invalid (module (memory 0) - (func $type-size-empty-in-loop + (func $type-size-empty-vs-i32-in-loop (result i32) (i32.const 0) - (loop (memory.grow) (drop)) + (loop (result i32) (memory.grow)) ) ) "type mismatch" @@ -341,15 +341,39 @@ (assert_invalid (module (memory 0) - (func $type-size-empty-in-then + (func $type-size-empty-vs-i32-in-then (result i32) (i32.const 0) (i32.const 0) - (if (then (memory.grow) (drop))) + (if (result i32) (then (memory.grow))) ) ) "type mismatch" ) +(assert_invalid + (module + (memory 1) + (func $type-size-f32-vs-i32 (result i32) + (memory.grow (f32.const 0)) + ) + ) + "type mismatch" +) -;; Type check - -(assert_invalid (module (memory 1) (func (result i32) (memory.grow (f32.const 0)))) "type mismatch") +(assert_invalid + (module + (memory 1) + (func $type-result-i32-vs-empty + (memory.grow (i32.const 0)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-result-i32-vs-f32 (result f32) + (memory.grow (i32.const 0)) + ) + ) + "type mismatch" +) diff --git a/test/core/select.wast b/test/core/select.wast index e40347e355..e7fa9adff7 100644 --- a/test/core/select.wast +++ b/test/core/select.wast @@ -1,30 +1,33 @@ (module - - (memory 1) - + ;; Auxiliary (func $dummy) + (memory 1) - (func (export "select_i32") (param $lhs i32) (param $rhs i32) (param $cond i32) (result i32) - (select (local.get $lhs) (local.get $rhs) (local.get $cond))) - - (func (export "select_i64") (param $lhs i64) (param $rhs i64) (param $cond i32) (result i64) - (select (local.get $lhs) (local.get $rhs) (local.get $cond))) - - (func (export "select_f32") (param $lhs f32) (param $rhs f32) (param $cond i32) (result f32) - (select (local.get $lhs) (local.get $rhs) (local.get $cond))) + (func (export "select-i32") (param i32 i32 i32) (result i32) + (select (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-i64") (param i64 i64 i32) (result i64) + (select (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-f32") (param f32 f32 i32) (result f32) + (select (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-f64") (param f64 f64 i32) (result f64) + (select (local.get 0) (local.get 1) (local.get 2)) + ) (func (export "select_f64") (param $lhs f64) (param $rhs f64) (param $cond i32) (result f64) (select (local.get $lhs) (local.get $rhs) (local.get $cond))) ;; Check that both sides of the select are evaluated - (func (export "select_trap_l") (param $cond i32) (result i32) + (func (export "select-trap-left") (param $cond i32) (result i32) (select (unreachable) (i32.const 0) (local.get $cond)) ) - (func (export "select_trap_r") (param $cond i32) (result i32) + (func (export "select-trap-right") (param $cond i32) (result i32) (select (i32.const 0) (unreachable) (local.get $cond)) ) - (func (export "select_unreached") + (func (export "select-unreached") (unreachable) (select) (unreachable) (i32.const 0) (select) (unreachable) (i32.const 0) (i32.const 0) (select) @@ -89,24 +92,24 @@ (func $func (param i32 i32) (result i32) (local.get 0)) (type $check (func (param i32 i32) (result i32))) - (table funcref (elem $func)) + (table $t funcref (elem $func)) (func (export "as-call_indirect-first") (param i32) (result i32) (block (result i32) - (call_indirect (type $check) + (call_indirect $t (type $check) (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 1) (i32.const 0) ) ) ) (func (export "as-call_indirect-mid") (param i32) (result i32) (block (result i32) - (call_indirect (type $check) + (call_indirect $t (type $check) (i32.const 1) (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 0) ) ) ) (func (export "as-call_indirect-last") (param i32) (result i32) (block (result i32) - (call_indirect (type $check) + (call_indirect $t (type $check) (i32.const 1) (i32.const 4) (select (i32.const 2) (i32.const 3) (local.get 0)) ) ) @@ -184,40 +187,46 @@ ) ) + (func (export "unreachable-num") + (unreachable) + (select) + (i32.eqz) + (drop) + ) ) -(assert_return (invoke "select_i32" (i32.const 1) (i32.const 2) (i32.const 1)) (i32.const 1)) -(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const 1)) (i64.const 2)) -(assert_return (invoke "select_f32" (f32.const 1) (f32.const 2) (i32.const 1)) (f32.const 1)) -(assert_return (invoke "select_f64" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1)) - -(assert_return (invoke "select_i32" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2)) -(assert_return (invoke "select_i32" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1)) -(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2)) -(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2)) - -(assert_return (invoke "select_f32" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan)) -(assert_return (invoke "select_f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304)) -(assert_return (invoke "select_f32" (f32.const nan) (f32.const 1) (i32.const 0)) (f32.const 1)) -(assert_return (invoke "select_f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 0)) (f32.const 1)) -(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan) (i32.const 1)) (f32.const 2)) -(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 1)) (f32.const 2)) -(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan) (i32.const 0)) (f32.const nan)) -(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 0)) (f32.const nan:0x20304)) - -(assert_return (invoke "select_f64" (f64.const nan) (f64.const 1) (i32.const 1)) (f64.const nan)) -(assert_return (invoke "select_f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 1)) (f64.const nan:0x20304)) -(assert_return (invoke "select_f64" (f64.const nan) (f64.const 1) (i32.const 0)) (f64.const 1)) -(assert_return (invoke "select_f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 0)) (f64.const 1)) -(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan) (i32.const 1)) (f64.const 2)) -(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 1)) (f64.const 2)) -(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan) (i32.const 0)) (f64.const nan)) -(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 0)) (f64.const nan:0x20304)) - -(assert_trap (invoke "select_trap_l" (i32.const 1)) "unreachable") -(assert_trap (invoke "select_trap_l" (i32.const 0)) "unreachable") -(assert_trap (invoke "select_trap_r" (i32.const 1)) "unreachable") -(assert_trap (invoke "select_trap_r" (i32.const 0)) "unreachable") +(assert_return (invoke "select-i32" (i32.const 1) (i32.const 2) (i32.const 1)) (i32.const 1)) +(assert_return (invoke "select-i64" (i64.const 2) (i64.const 1) (i32.const 1)) (i64.const 2)) +(assert_return (invoke "select-f32" (f32.const 1) (f32.const 2) (i32.const 1)) (f32.const 1)) +(assert_return (invoke "select-f64" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1)) + +(assert_return (invoke "select-i32" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2)) +(assert_return (invoke "select-i32" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1)) +(assert_return (invoke "select-i64" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2)) +(assert_return (invoke "select-i64" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2)) + +(assert_return (invoke "select-f32" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan)) +(assert_return (invoke "select-f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304)) +(assert_return (invoke "select-f32" (f32.const nan) (f32.const 1) (i32.const 0)) (f32.const 1)) +(assert_return (invoke "select-f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 0)) (f32.const 1)) +(assert_return (invoke "select-f32" (f32.const 2) (f32.const nan) (i32.const 1)) (f32.const 2)) +(assert_return (invoke "select-f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 1)) (f32.const 2)) +(assert_return (invoke "select-f32" (f32.const 2) (f32.const nan) (i32.const 0)) (f32.const nan)) +(assert_return (invoke "select-f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 0)) (f32.const nan:0x20304)) + +(assert_return (invoke "select-f64" (f64.const nan) (f64.const 1) (i32.const 1)) (f64.const nan)) +(assert_return (invoke "select-f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 1)) (f64.const nan:0x20304)) +(assert_return (invoke "select-f64" (f64.const nan) (f64.const 1) (i32.const 0)) (f64.const 1)) +(assert_return (invoke "select-f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 0)) (f64.const 1)) +(assert_return (invoke "select-f64" (f64.const 2) (f64.const nan) (i32.const 1)) (f64.const 2)) +(assert_return (invoke "select-f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 1)) (f64.const 2)) +(assert_return (invoke "select-f64" (f64.const 2) (f64.const nan) (i32.const 0)) (f64.const nan)) +(assert_return (invoke "select-f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 0)) (f64.const nan:0x20304)) + +(assert_trap (invoke "select-trap-left" (i32.const 1)) "unreachable") +(assert_trap (invoke "select-trap-left" (i32.const 0)) "unreachable") +(assert_trap (invoke "select-trap-right" (i32.const 1)) "unreachable") +(assert_trap (invoke "select-trap-right" (i32.const 0)) "unreachable") (assert_return (invoke "as-select-first" (i32.const 0)) (i32.const 1)) (assert_return (invoke "as-select-first" (i32.const 1)) (i32.const 0))