From 9ea2796e334cfd1343fef76458b2d9de50fb35f1 Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 25 Dec 2023 22:00:31 +0100 Subject: [PATCH] chore: pass more tests Signed-off-by: Henry --- .gitignore | 3 +- crates/tinywasm/src/runtime/executor/mod.rs | 10 +- crates/tinywasm/tests/generated/mvp.csv | 2 +- examples/wasm/test.wat | 7 + examples/wast/conversions.wast | 702 -------------------- examples/wast/select.wast | 531 --------------- 6 files changed, 18 insertions(+), 1237 deletions(-) create mode 100644 examples/wasm/test.wat delete mode 100644 examples/wast/conversions.wast delete mode 100644 examples/wast/select.wast diff --git a/.gitignore b/.gitignore index 0d6dc9e..1e56606 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target notes.md -examples/tinywasm.wat \ No newline at end of file +examples/tinywasm.wat +examples/wast/* \ No newline at end of file diff --git a/crates/tinywasm/src/runtime/executor/mod.rs b/crates/tinywasm/src/runtime/executor/mod.rs index 6e57b2b..95c17cb 100644 --- a/crates/tinywasm/src/runtime/executor/mod.rs +++ b/crates/tinywasm/src/runtime/executor/mod.rs @@ -125,8 +125,6 @@ fn exec_one( return Ok(ExecResult::Call); } - Return => todo!("called function returned"), - If(args, else_offset, end_offset) => { let end_instr_ptr = cf.instr_ptr + *end_offset; @@ -210,6 +208,14 @@ fn exec_one( }; } + Return => match stack.call_stack.is_empty() { + true => return Ok(ExecResult::Return), + false => { + *cf = stack.call_stack.pop()?; + return Ok(ExecResult::Call); + } + }, + EndFunc => { if cf.labels.len() > 0 { panic!("endfunc: block frames not empty, this should have been validated by the parser"); diff --git a/crates/tinywasm/tests/generated/mvp.csv b/crates/tinywasm/tests/generated/mvp.csv index f4a5cae..47cb8ec 100644 --- a/crates/tinywasm/tests/generated/mvp.csv +++ b/crates/tinywasm/tests/generated/mvp.csv @@ -1,4 +1,4 @@ 0.0.3,9258,7567,[{"name":"address.wast","passed":0,"failed":54},{"name":"align.wast","passed":0,"failed":109},{"name":"binary-leb128.wast","passed":66,"failed":25},{"name":"binary.wast","passed":104,"failed":8},{"name":"block.wast","passed":0,"failed":171},{"name":"br.wast","passed":0,"failed":21},{"name":"br_if.wast","passed":0,"failed":30},{"name":"br_table.wast","passed":0,"failed":25},{"name":"call.wast","passed":0,"failed":22},{"name":"call_indirect.wast","passed":0,"failed":56},{"name":"comments.wast","passed":4,"failed":4},{"name":"const.wast","passed":702,"failed":76},{"name":"conversions.wast","passed":0,"failed":93},{"name":"custom.wast","passed":10,"failed":1},{"name":"data.wast","passed":0,"failed":61},{"name":"elem.wast","passed":0,"failed":76},{"name":"endianness.wast","passed":0,"failed":1},{"name":"exports.wast","passed":21,"failed":73},{"name":"f32.wast","passed":1005,"failed":1509},{"name":"f32_bitwise.wast","passed":1,"failed":363},{"name":"f32_cmp.wast","passed":2401,"failed":6},{"name":"f64.wast","passed":1005,"failed":1509},{"name":"f64_bitwise.wast","passed":1,"failed":363},{"name":"f64_cmp.wast","passed":2401,"failed":6},{"name":"fac.wast","passed":0,"failed":2},{"name":"float_exprs.wast","passed":269,"failed":591},{"name":"float_literals.wast","passed":34,"failed":129},{"name":"float_memory.wast","passed":0,"failed":6},{"name":"float_misc.wast","passed":138,"failed":303},{"name":"forward.wast","passed":1,"failed":4},{"name":"func.wast","passed":4,"failed":75},{"name":"func_ptrs.wast","passed":0,"failed":16},{"name":"global.wast","passed":4,"failed":49},{"name":"i32.wast","passed":0,"failed":96},{"name":"i64.wast","passed":0,"failed":42},{"name":"if.wast","passed":0,"failed":118},{"name":"imports.wast","passed":1,"failed":156},{"name":"inline-module.wast","passed":0,"failed":1},{"name":"int_exprs.wast","passed":38,"failed":70},{"name":"int_literals.wast","passed":5,"failed":46},{"name":"labels.wast","passed":1,"failed":28},{"name":"left-to-right.wast","passed":0,"failed":1},{"name":"linking.wast","passed":1,"failed":66},{"name":"load.wast","passed":0,"failed":60},{"name":"local_get.wast","passed":2,"failed":34},{"name":"local_set.wast","passed":5,"failed":48},{"name":"local_tee.wast","passed":0,"failed":42},{"name":"loop.wast","passed":0,"failed":43},{"name":"memory.wast","passed":0,"failed":34},{"name":"memory_grow.wast","passed":0,"failed":19},{"name":"memory_redundancy.wast","passed":0,"failed":1},{"name":"memory_size.wast","passed":0,"failed":6},{"name":"memory_trap.wast","passed":0,"failed":172},{"name":"names.wast","passed":484,"failed":1},{"name":"nop.wast","passed":0,"failed":5},{"name":"return.wast","passed":0,"failed":21},{"name":"select.wast","passed":0,"failed":32},{"name":"skip-stack-guard-page.wast","passed":0,"failed":11},{"name":"stack.wast","passed":0,"failed":2},{"name":"start.wast","passed":0,"failed":10},{"name":"store.wast","passed":0,"failed":59},{"name":"switch.wast","passed":1,"failed":27},{"name":"token.wast","passed":16,"failed":42},{"name":"traps.wast","passed":3,"failed":33},{"name":"type.wast","passed":1,"failed":2},{"name":"unreachable.wast","passed":0,"failed":59},{"name":"unreached-invalid.wast","passed":0,"failed":118},{"name":"unwind.wast","passed":1,"failed":49},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":0,"failed":176}] 0.0.4,9258,10909,[{"name":"address.wast","passed":0,"failed":54},{"name":"align.wast","passed":0,"failed":109},{"name":"binary-leb128.wast","passed":66,"failed":25},{"name":"binary.wast","passed":104,"failed":8},{"name":"block.wast","passed":0,"failed":171},{"name":"br.wast","passed":0,"failed":21},{"name":"br_if.wast","passed":0,"failed":30},{"name":"br_table.wast","passed":0,"failed":25},{"name":"call.wast","passed":0,"failed":22},{"name":"call_indirect.wast","passed":0,"failed":56},{"name":"comments.wast","passed":4,"failed":4},{"name":"const.wast","passed":702,"failed":76},{"name":"conversions.wast","passed":0,"failed":93},{"name":"custom.wast","passed":10,"failed":1},{"name":"data.wast","passed":0,"failed":61},{"name":"elem.wast","passed":0,"failed":76},{"name":"endianness.wast","passed":0,"failed":1},{"name":"exports.wast","passed":21,"failed":73},{"name":"f32.wast","passed":1005,"failed":1509},{"name":"f32_bitwise.wast","passed":1,"failed":363},{"name":"f32_cmp.wast","passed":2401,"failed":6},{"name":"f64.wast","passed":1005,"failed":1509},{"name":"f64_bitwise.wast","passed":1,"failed":363},{"name":"f64_cmp.wast","passed":2401,"failed":6},{"name":"fac.wast","passed":0,"failed":2},{"name":"float_exprs.wast","passed":269,"failed":591},{"name":"float_literals.wast","passed":34,"failed":129},{"name":"float_memory.wast","passed":0,"failed":6},{"name":"float_misc.wast","passed":138,"failed":303},{"name":"forward.wast","passed":1,"failed":4},{"name":"func.wast","passed":4,"failed":75},{"name":"func_ptrs.wast","passed":0,"failed":16},{"name":"global.wast","passed":4,"failed":49},{"name":"i32.wast","passed":0,"failed":96},{"name":"i64.wast","passed":0,"failed":42},{"name":"if.wast","passed":0,"failed":118},{"name":"imports.wast","passed":1,"failed":156},{"name":"inline-module.wast","passed":0,"failed":1},{"name":"int_exprs.wast","passed":38,"failed":70},{"name":"int_literals.wast","passed":5,"failed":46},{"name":"labels.wast","passed":1,"failed":28},{"name":"left-to-right.wast","passed":0,"failed":1},{"name":"linking.wast","passed":1,"failed":66},{"name":"load.wast","passed":0,"failed":60},{"name":"local_get.wast","passed":2,"failed":34},{"name":"local_set.wast","passed":5,"failed":48},{"name":"local_tee.wast","passed":0,"failed":42},{"name":"loop.wast","passed":0,"failed":43},{"name":"memory.wast","passed":0,"failed":34},{"name":"memory_grow.wast","passed":0,"failed":19},{"name":"memory_redundancy.wast","passed":0,"failed":1},{"name":"memory_size.wast","passed":0,"failed":6},{"name":"memory_trap.wast","passed":0,"failed":172},{"name":"names.wast","passed":484,"failed":1},{"name":"nop.wast","passed":0,"failed":5},{"name":"return.wast","passed":0,"failed":21},{"name":"select.wast","passed":0,"failed":32},{"name":"skip-stack-guard-page.wast","passed":0,"failed":11},{"name":"stack.wast","passed":0,"failed":2},{"name":"start.wast","passed":0,"failed":10},{"name":"store.wast","passed":0,"failed":59},{"name":"switch.wast","passed":1,"failed":27},{"name":"token.wast","passed":16,"failed":42},{"name":"traps.wast","passed":3,"failed":33},{"name":"type.wast","passed":1,"failed":2},{"name":"unreachable.wast","passed":0,"failed":59},{"name":"unreached-invalid.wast","passed":0,"failed":118},{"name":"unwind.wast","passed":1,"failed":49},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":0,"failed":176}] 0.0.5,11135,9093,[{"name":"address.wast","passed":1,"failed":259},{"name":"align.wast","passed":108,"failed":48},{"name":"binary-leb128.wast","passed":78,"failed":13},{"name":"binary.wast","passed":107,"failed":5},{"name":"block.wast","passed":170,"failed":53},{"name":"br.wast","passed":20,"failed":77},{"name":"br_if.wast","passed":29,"failed":89},{"name":"br_table.wast","passed":24,"failed":150},{"name":"call.wast","passed":18,"failed":73},{"name":"call_indirect.wast","passed":34,"failed":136},{"name":"comments.wast","passed":5,"failed":3},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":25,"failed":594},{"name":"custom.wast","passed":10,"failed":1},{"name":"data.wast","passed":22,"failed":39},{"name":"elem.wast","passed":27,"failed":72},{"name":"endianness.wast","passed":1,"failed":68},{"name":"exports.wast","passed":90,"failed":6},{"name":"f32.wast","passed":1018,"failed":1496},{"name":"f32_bitwise.wast","passed":4,"failed":360},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":1018,"failed":1496},{"name":"f64_bitwise.wast","passed":4,"failed":360},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":1,"failed":7},{"name":"float_exprs.wast","passed":275,"failed":625},{"name":"float_literals.wast","passed":112,"failed":51},{"name":"float_memory.wast","passed":0,"failed":90},{"name":"float_misc.wast","passed":138,"failed":303},{"name":"forward.wast","passed":1,"failed":4},{"name":"func.wast","passed":81,"failed":91},{"name":"func_ptrs.wast","passed":7,"failed":29},{"name":"global.wast","passed":50,"failed":60},{"name":"i32.wast","passed":85,"failed":375},{"name":"i64.wast","passed":31,"failed":385},{"name":"if.wast","passed":116,"failed":125},{"name":"imports.wast","passed":23,"failed":160},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":38,"failed":70},{"name":"int_literals.wast","passed":25,"failed":26},{"name":"labels.wast","passed":13,"failed":16},{"name":"left-to-right.wast","passed":0,"failed":96},{"name":"linking.wast","passed":5,"failed":127},{"name":"load.wast","passed":59,"failed":38},{"name":"local_get.wast","passed":18,"failed":18},{"name":"local_set.wast","passed":38,"failed":15},{"name":"local_tee.wast","passed":41,"failed":56},{"name":"loop.wast","passed":42,"failed":78},{"name":"memory.wast","passed":30,"failed":49},{"name":"memory_grow.wast","passed":11,"failed":85},{"name":"memory_redundancy.wast","passed":1,"failed":7},{"name":"memory_size.wast","passed":6,"failed":36},{"name":"memory_trap.wast","passed":1,"failed":181},{"name":"names.wast","passed":484,"failed":2},{"name":"nop.wast","passed":4,"failed":84},{"name":"return.wast","passed":20,"failed":64},{"name":"select.wast","passed":28,"failed":120},{"name":"skip-stack-guard-page.wast","passed":1,"failed":10},{"name":"stack.wast","passed":2,"failed":5},{"name":"start.wast","passed":4,"failed":16},{"name":"store.wast","passed":59,"failed":9},{"name":"switch.wast","passed":2,"failed":26},{"name":"token.wast","passed":39,"failed":19},{"name":"traps.wast","passed":4,"failed":32},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":0,"failed":64},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":9,"failed":41},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}] -0.0.6-alpha.0,13410,6818,[{"name":"address.wast","passed":5,"failed":255},{"name":"align.wast","passed":108,"failed":48},{"name":"binary-leb128.wast","passed":91,"failed":0},{"name":"binary.wast","passed":110,"failed":2},{"name":"block.wast","passed":192,"failed":31},{"name":"br.wast","passed":84,"failed":13},{"name":"br_if.wast","passed":86,"failed":32},{"name":"br_table.wast","passed":25,"failed":149},{"name":"call.wast","passed":29,"failed":62},{"name":"call_indirect.wast","passed":36,"failed":134},{"name":"comments.wast","passed":5,"failed":3},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":187,"failed":432},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":47,"failed":14},{"name":"elem.wast","passed":50,"failed":49},{"name":"endianness.wast","passed":1,"failed":68},{"name":"exports.wast","passed":90,"failed":6},{"name":"f32.wast","passed":1174,"failed":1340},{"name":"f32_bitwise.wast","passed":4,"failed":360},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":1018,"failed":1496},{"name":"f64_bitwise.wast","passed":4,"failed":360},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":2,"failed":6},{"name":"float_exprs.wast","passed":511,"failed":389},{"name":"float_literals.wast","passed":163,"failed":0},{"name":"float_memory.wast","passed":6,"failed":84},{"name":"float_misc.wast","passed":328,"failed":113},{"name":"forward.wast","passed":1,"failed":4},{"name":"func.wast","passed":116,"failed":56},{"name":"func_ptrs.wast","passed":10,"failed":26},{"name":"global.wast","passed":51,"failed":59},{"name":"i32.wast","passed":460,"failed":0},{"name":"i64.wast","passed":416,"failed":0},{"name":"if.wast","passed":118,"failed":123},{"name":"imports.wast","passed":74,"failed":109},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":108,"failed":0},{"name":"int_literals.wast","passed":29,"failed":22},{"name":"labels.wast","passed":14,"failed":15},{"name":"left-to-right.wast","passed":1,"failed":95},{"name":"linking.wast","passed":21,"failed":111},{"name":"load.wast","passed":60,"failed":37},{"name":"local_get.wast","passed":30,"failed":6},{"name":"local_set.wast","passed":49,"failed":4},{"name":"local_tee.wast","passed":65,"failed":32},{"name":"loop.wast","passed":92,"failed":28},{"name":"memory.wast","passed":34,"failed":45},{"name":"memory_grow.wast","passed":12,"failed":84},{"name":"memory_redundancy.wast","passed":1,"failed":7},{"name":"memory_size.wast","passed":6,"failed":36},{"name":"memory_trap.wast","passed":2,"failed":180},{"name":"names.wast","passed":485,"failed":1},{"name":"nop.wast","passed":43,"failed":45},{"name":"return.wast","passed":21,"failed":63},{"name":"select.wast","passed":84,"failed":64},{"name":"skip-stack-guard-page.wast","passed":1,"failed":10},{"name":"stack.wast","passed":2,"failed":5},{"name":"start.wast","passed":9,"failed":11},{"name":"store.wast","passed":59,"failed":9},{"name":"switch.wast","passed":2,"failed":26},{"name":"token.wast","passed":58,"failed":0},{"name":"traps.wast","passed":14,"failed":22},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":50,"failed":14},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":27,"failed":23},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}] +0.0.6-alpha.0,13518,6710,[{"name":"address.wast","passed":5,"failed":255},{"name":"align.wast","passed":108,"failed":48},{"name":"binary-leb128.wast","passed":91,"failed":0},{"name":"binary.wast","passed":110,"failed":2},{"name":"block.wast","passed":193,"failed":30},{"name":"br.wast","passed":84,"failed":13},{"name":"br_if.wast","passed":90,"failed":28},{"name":"br_table.wast","passed":25,"failed":149},{"name":"call.wast","passed":29,"failed":62},{"name":"call_indirect.wast","passed":36,"failed":134},{"name":"comments.wast","passed":7,"failed":1},{"name":"const.wast","passed":778,"failed":0},{"name":"conversions.wast","passed":187,"failed":432},{"name":"custom.wast","passed":11,"failed":0},{"name":"data.wast","passed":47,"failed":14},{"name":"elem.wast","passed":50,"failed":49},{"name":"endianness.wast","passed":1,"failed":68},{"name":"exports.wast","passed":92,"failed":4},{"name":"f32.wast","passed":1174,"failed":1340},{"name":"f32_bitwise.wast","passed":4,"failed":360},{"name":"f32_cmp.wast","passed":2407,"failed":0},{"name":"f64.wast","passed":1018,"failed":1496},{"name":"f64_bitwise.wast","passed":4,"failed":360},{"name":"f64_cmp.wast","passed":2407,"failed":0},{"name":"fac.wast","passed":2,"failed":6},{"name":"float_exprs.wast","passed":511,"failed":389},{"name":"float_literals.wast","passed":163,"failed":0},{"name":"float_memory.wast","passed":6,"failed":84},{"name":"float_misc.wast","passed":328,"failed":113},{"name":"forward.wast","passed":1,"failed":4},{"name":"func.wast","passed":122,"failed":50},{"name":"func_ptrs.wast","passed":10,"failed":26},{"name":"global.wast","passed":51,"failed":59},{"name":"i32.wast","passed":460,"failed":0},{"name":"i64.wast","passed":416,"failed":0},{"name":"if.wast","passed":120,"failed":121},{"name":"imports.wast","passed":74,"failed":109},{"name":"inline-module.wast","passed":1,"failed":0},{"name":"int_exprs.wast","passed":108,"failed":0},{"name":"int_literals.wast","passed":51,"failed":0},{"name":"labels.wast","passed":14,"failed":15},{"name":"left-to-right.wast","passed":1,"failed":95},{"name":"linking.wast","passed":21,"failed":111},{"name":"load.wast","passed":60,"failed":37},{"name":"local_get.wast","passed":31,"failed":5},{"name":"local_set.wast","passed":50,"failed":3},{"name":"local_tee.wast","passed":66,"failed":31},{"name":"loop.wast","passed":93,"failed":27},{"name":"memory.wast","passed":34,"failed":45},{"name":"memory_grow.wast","passed":12,"failed":84},{"name":"memory_redundancy.wast","passed":1,"failed":7},{"name":"memory_size.wast","passed":6,"failed":36},{"name":"memory_trap.wast","passed":2,"failed":180},{"name":"names.wast","passed":485,"failed":1},{"name":"nop.wast","passed":46,"failed":42},{"name":"return.wast","passed":73,"failed":11},{"name":"select.wast","passed":86,"failed":62},{"name":"skip-stack-guard-page.wast","passed":1,"failed":10},{"name":"stack.wast","passed":2,"failed":5},{"name":"start.wast","passed":9,"failed":11},{"name":"store.wast","passed":59,"failed":9},{"name":"switch.wast","passed":2,"failed":26},{"name":"token.wast","passed":58,"failed":0},{"name":"traps.wast","passed":14,"failed":22},{"name":"type.wast","passed":3,"failed":0},{"name":"unreachable.wast","passed":50,"failed":14},{"name":"unreached-invalid.wast","passed":118,"failed":0},{"name":"unwind.wast","passed":35,"failed":15},{"name":"utf8-custom-section-id.wast","passed":176,"failed":0},{"name":"utf8-import-field.wast","passed":176,"failed":0},{"name":"utf8-import-module.wast","passed":176,"failed":0},{"name":"utf8-invalid-encoding.wast","passed":176,"failed":0}] diff --git a/examples/wasm/test.wat b/examples/wasm/test.wat new file mode 100644 index 0000000..563f382 --- /dev/null +++ b/examples/wasm/test.wat @@ -0,0 +1,7 @@ +(module + (func (export "test") (result i32) + (i32.const 1) + ;; comment + (return (i32.const 2)) + ) +) \ No newline at end of file diff --git a/examples/wast/conversions.wast b/examples/wast/conversions.wast deleted file mode 100644 index 5e460a8..0000000 --- a/examples/wast/conversions.wast +++ /dev/null @@ -1,702 +0,0 @@ -(module - (func (export "i64.extend_i32_s") (param $x i32) (result i64) (i64.extend_i32_s (local.get $x))) - (func (export "i64.extend_i32_u") (param $x i32) (result i64) (i64.extend_i32_u (local.get $x))) - (func (export "i32.wrap_i64") (param $x i64) (result i32) (i32.wrap_i64 (local.get $x))) - (func (export "i32.trunc_f32_s") (param $x f32) (result i32) (i32.trunc_f32_s (local.get $x))) - (func (export "i32.trunc_f32_u") (param $x f32) (result i32) (i32.trunc_f32_u (local.get $x))) - (func (export "i32.trunc_f64_s") (param $x f64) (result i32) (i32.trunc_f64_s (local.get $x))) - (func (export "i32.trunc_f64_u") (param $x f64) (result i32) (i32.trunc_f64_u (local.get $x))) - (func (export "i64.trunc_f32_s") (param $x f32) (result i64) (i64.trunc_f32_s (local.get $x))) - (func (export "i64.trunc_f32_u") (param $x f32) (result i64) (i64.trunc_f32_u (local.get $x))) - (func (export "i64.trunc_f64_s") (param $x f64) (result i64) (i64.trunc_f64_s (local.get $x))) - (func (export "i64.trunc_f64_u") (param $x f64) (result i64) (i64.trunc_f64_u (local.get $x))) - (func (export "i32.trunc_sat_f32_s") (param $x f32) (result i32) (i32.trunc_sat_f32_s (local.get $x))) - (func (export "i32.trunc_sat_f32_u") (param $x f32) (result i32) (i32.trunc_sat_f32_u (local.get $x))) - (func (export "i32.trunc_sat_f64_s") (param $x f64) (result i32) (i32.trunc_sat_f64_s (local.get $x))) - (func (export "i32.trunc_sat_f64_u") (param $x f64) (result i32) (i32.trunc_sat_f64_u (local.get $x))) - (func (export "i64.trunc_sat_f32_s") (param $x f32) (result i64) (i64.trunc_sat_f32_s (local.get $x))) - (func (export "i64.trunc_sat_f32_u") (param $x f32) (result i64) (i64.trunc_sat_f32_u (local.get $x))) - (func (export "i64.trunc_sat_f64_s") (param $x f64) (result i64) (i64.trunc_sat_f64_s (local.get $x))) - (func (export "i64.trunc_sat_f64_u") (param $x f64) (result i64) (i64.trunc_sat_f64_u (local.get $x))) - (func (export "f32.convert_i32_s") (param $x i32) (result f32) (f32.convert_i32_s (local.get $x))) - (func (export "f32.convert_i64_s") (param $x i64) (result f32) (f32.convert_i64_s (local.get $x))) - (func (export "f64.convert_i32_s") (param $x i32) (result f64) (f64.convert_i32_s (local.get $x))) - (func (export "f64.convert_i64_s") (param $x i64) (result f64) (f64.convert_i64_s (local.get $x))) - (func (export "f32.convert_i32_u") (param $x i32) (result f32) (f32.convert_i32_u (local.get $x))) - (func (export "f32.convert_i64_u") (param $x i64) (result f32) (f32.convert_i64_u (local.get $x))) - (func (export "f64.convert_i32_u") (param $x i32) (result f64) (f64.convert_i32_u (local.get $x))) - (func (export "f64.convert_i64_u") (param $x i64) (result f64) (f64.convert_i64_u (local.get $x))) - (func (export "f64.promote_f32") (param $x f32) (result f64) (f64.promote_f32 (local.get $x))) - (func (export "f32.demote_f64") (param $x f64) (result f32) (f32.demote_f64 (local.get $x))) - (func (export "f32.reinterpret_i32") (param $x i32) (result f32) (f32.reinterpret_i32 (local.get $x))) - (func (export "f64.reinterpret_i64") (param $x i64) (result f64) (f64.reinterpret_i64 (local.get $x))) - (func (export "i32.reinterpret_f32") (param $x f32) (result i32) (i32.reinterpret_f32 (local.get $x))) - (func (export "i64.reinterpret_f64") (param $x f64) (result i64) (i64.reinterpret_f64 (local.get $x))) -) - -(assert_return (invoke "i64.extend_i32_s" (i32.const 0)) (i64.const 0)) -(assert_return (invoke "i64.extend_i32_s" (i32.const 10000)) (i64.const 10000)) -(assert_return (invoke "i64.extend_i32_s" (i32.const -10000)) (i64.const -10000)) -(assert_return (invoke "i64.extend_i32_s" (i32.const -1)) (i64.const -1)) -(assert_return (invoke "i64.extend_i32_s" (i32.const 0x7fffffff)) (i64.const 0x000000007fffffff)) -(assert_return (invoke "i64.extend_i32_s" (i32.const 0x80000000)) (i64.const 0xffffffff80000000)) - -(assert_return (invoke "i64.extend_i32_u" (i32.const 0)) (i64.const 0)) -(assert_return (invoke "i64.extend_i32_u" (i32.const 10000)) (i64.const 10000)) -(assert_return (invoke "i64.extend_i32_u" (i32.const -10000)) (i64.const 0x00000000ffffd8f0)) -(assert_return (invoke "i64.extend_i32_u" (i32.const -1)) (i64.const 0xffffffff)) -(assert_return (invoke "i64.extend_i32_u" (i32.const 0x7fffffff)) (i64.const 0x000000007fffffff)) -(assert_return (invoke "i64.extend_i32_u" (i32.const 0x80000000)) (i64.const 0x0000000080000000)) - -(assert_return (invoke "i32.wrap_i64" (i64.const -1)) (i32.const -1)) -(assert_return (invoke "i32.wrap_i64" (i64.const -100000)) (i32.const -100000)) -(assert_return (invoke "i32.wrap_i64" (i64.const 0x80000000)) (i32.const 0x80000000)) -(assert_return (invoke "i32.wrap_i64" (i64.const 0xffffffff7fffffff)) (i32.const 0x7fffffff)) -(assert_return (invoke "i32.wrap_i64" (i64.const 0xffffffff00000000)) (i32.const 0x00000000)) -(assert_return (invoke "i32.wrap_i64" (i64.const 0xfffffffeffffffff)) (i32.const 0xffffffff)) -(assert_return (invoke "i32.wrap_i64" (i64.const 0xffffffff00000001)) (i32.const 0x00000001)) -(assert_return (invoke "i32.wrap_i64" (i64.const 0)) (i32.const 0)) -(assert_return (invoke "i32.wrap_i64" (i64.const 1311768467463790320)) (i32.const 0x9abcdef0)) -(assert_return (invoke "i32.wrap_i64" (i64.const 0x00000000ffffffff)) (i32.const 0xffffffff)) -(assert_return (invoke "i32.wrap_i64" (i64.const 0x0000000100000000)) (i32.const 0x00000000)) -(assert_return (invoke "i32.wrap_i64" (i64.const 0x0000000100000001)) (i32.const 0x00000001)) - -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const 0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const -0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const 0x1p-149)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const -0x1p-149)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const 1.0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const 0x1.19999ap+0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const 1.5)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const -1.0)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const -0x1.19999ap+0)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const -1.5)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const -1.9)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const -2.0)) (i32.const -2)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const 2147483520.0)) (i32.const 2147483520)) -;; (assert_return (invoke "i32.trunc_f32_s" (f32.const -2147483648.0)) (i32.const -2147483648)) -;; (assert_trap (invoke "i32.trunc_f32_s" (f32.const 2147483648.0)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f32_s" (f32.const -2147483904.0)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f32_s" (f32.const inf)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f32_s" (f32.const -inf)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f32_s" (f32.const nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f32_s" (f32.const nan:0x200000)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f32_s" (f32.const -nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f32_s" (f32.const -nan:0x200000)) "invalid conversion to integer") - -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const 0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const -0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const 0x1p-149)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const -0x1p-149)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const 1.0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const 0x1.19999ap+0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const 1.5)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const 1.9)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const 2.0)) (i32.const 2)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const 2147483648)) (i32.const -2147483648)) ;; 0x1.00000p+31 -> 8000 0000 -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const 4294967040.0)) (i32.const -256)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const -0x1.ccccccp-1)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f32_u" (f32.const -0x1.fffffep-1)) (i32.const 0)) -;; (assert_trap (invoke "i32.trunc_f32_u" (f32.const 4294967296.0)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f32_u" (f32.const -1.0)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f32_u" (f32.const inf)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f32_u" (f32.const -inf)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f32_u" (f32.const nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f32_u" (f32.const nan:0x200000)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f32_u" (f32.const -nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f32_u" (f32.const -nan:0x200000)) "invalid conversion to integer") - -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const 0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const -0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const 1.0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const 0x1.199999999999ap+0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const 1.5)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const -1.0)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const -0x1.199999999999ap+0)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const -1.5)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const -1.9)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const -2.0)) (i32.const -2)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const 2147483647.0)) (i32.const 2147483647)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const -2147483648.0)) (i32.const -2147483648)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const -2147483648.9)) (i32.const -2147483648)) -;; (assert_return (invoke "i32.trunc_f64_s" (f64.const 2147483647.9)) (i32.const 2147483647)) -;; (assert_trap (invoke "i32.trunc_f64_s" (f64.const 2147483648.0)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_s" (f64.const -2147483649.0)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_s" (f64.const inf)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_s" (f64.const -inf)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_s" (f64.const nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f64_s" (f64.const nan:0x4000000000000)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f64_s" (f64.const -nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f64_s" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") - -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const -0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 1.0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 0x1.199999999999ap+0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 1.5)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 1.9)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 2.0)) (i32.const 2)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 2147483648)) (i32.const -2147483648)) ;; 0x1.00000p+31 -> 8000 0000 -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 4294967295.0)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const -0x1.ccccccccccccdp-1)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const -0x1.fffffffffffffp-1)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 1e8)) (i32.const 100000000)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const -0.9)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_f64_u" (f64.const 4294967295.9)) (i32.const 4294967295)) -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const 4294967296.0)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const -1.0)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const 1e16)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const 1e30)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const 9223372036854775808)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const inf)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const -inf)) "integer overflow") -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const nan:0x4000000000000)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const -nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i32.trunc_f64_u" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") - -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const 0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const -0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const 0x1p-149)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const -0x1p-149)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const 1.0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const 0x1.19999ap+0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const 1.5)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const -1.0)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const -0x1.19999ap+0)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const -1.5)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const -1.9)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const -2.0)) (i64.const -2)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const 4294967296)) (i64.const 4294967296)) ;; 0x1.00000p+32 -> 1 0000 0000 -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const -4294967296)) (i64.const -4294967296)) ;; -0x1.00000p+32 -> ffff ffff 0000 0000 -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const 9223371487098961920.0)) (i64.const 9223371487098961920)) -;; (assert_return (invoke "i64.trunc_f32_s" (f32.const -9223372036854775808.0)) (i64.const -9223372036854775808)) -;; (assert_trap (invoke "i64.trunc_f32_s" (f32.const 9223372036854775808.0)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f32_s" (f32.const -9223373136366403584.0)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f32_s" (f32.const inf)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f32_s" (f32.const -inf)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f32_s" (f32.const nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f32_s" (f32.const nan:0x200000)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f32_s" (f32.const -nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f32_s" (f32.const -nan:0x200000)) "invalid conversion to integer") - -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const 0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const -0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const 0x1p-149)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const -0x1p-149)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const 1.0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const 0x1.19999ap+0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const 1.5)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const 4294967296)) (i64.const 4294967296)) -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const 18446742974197923840.0)) (i64.const -1099511627776)) -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const -0x1.ccccccp-1)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f32_u" (f32.const -0x1.fffffep-1)) (i64.const 0)) -;; (assert_trap (invoke "i64.trunc_f32_u" (f32.const 18446744073709551616.0)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f32_u" (f32.const -1.0)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f32_u" (f32.const inf)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f32_u" (f32.const -inf)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f32_u" (f32.const nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f32_u" (f32.const nan:0x200000)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f32_u" (f32.const -nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f32_u" (f32.const -nan:0x200000)) "invalid conversion to integer") - -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const 0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const -0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const 0x0.0000000000001p-1022)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const -0x0.0000000000001p-1022)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const 1.0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const 0x1.199999999999ap+0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const 1.5)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const -1.0)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const -0x1.199999999999ap+0)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const -1.5)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const -1.9)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const -2.0)) (i64.const -2)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const 4294967296)) (i64.const 4294967296)) ;; 0x1.00000p+32 -> 1 0000 0000 -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const -4294967296)) (i64.const -4294967296)) ;; -0x1.00000p+32 -> ffff ffff 0000 0000 -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const 9223372036854774784.0)) (i64.const 9223372036854774784)) -;; (assert_return (invoke "i64.trunc_f64_s" (f64.const -9223372036854775808.0)) (i64.const -9223372036854775808)) -;; (assert_trap (invoke "i64.trunc_f64_s" (f64.const 9223372036854775808.0)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f64_s" (f64.const -9223372036854777856.0)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f64_s" (f64.const inf)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f64_s" (f64.const -inf)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f64_s" (f64.const nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f64_s" (f64.const nan:0x4000000000000)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f64_s" (f64.const -nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f64_s" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") - -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const -0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 0x0.0000000000001p-1022)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const -0x0.0000000000001p-1022)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 1.0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 0x1.199999999999ap+0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 1.5)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 4294967295)) (i64.const 0xffffffff)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 4294967296)) (i64.const 0x100000000)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 18446744073709549568.0)) (i64.const -2048)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const -0x1.ccccccccccccdp-1)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const -0x1.fffffffffffffp-1)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 1e8)) (i64.const 100000000)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 1e16)) (i64.const 10000000000000000)) -;; (assert_return (invoke "i64.trunc_f64_u" (f64.const 9223372036854775808)) (i64.const -9223372036854775808)) -;; (assert_trap (invoke "i64.trunc_f64_u" (f64.const 18446744073709551616.0)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f64_u" (f64.const -1.0)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f64_u" (f64.const inf)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f64_u" (f64.const -inf)) "integer overflow") -;; (assert_trap (invoke "i64.trunc_f64_u" (f64.const nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f64_u" (f64.const nan:0x4000000000000)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f64_u" (f64.const -nan)) "invalid conversion to integer") -;; (assert_trap (invoke "i64.trunc_f64_u" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") - -;; (assert_return (invoke "f32.convert_i32_s" (i32.const 1)) (f32.const 1.0)) -;; (assert_return (invoke "f32.convert_i32_s" (i32.const -1)) (f32.const -1.0)) -;; (assert_return (invoke "f32.convert_i32_s" (i32.const 0)) (f32.const 0.0)) -;; (assert_return (invoke "f32.convert_i32_s" (i32.const 2147483647)) (f32.const 2147483648)) -;; (assert_return (invoke "f32.convert_i32_s" (i32.const -2147483648)) (f32.const -2147483648)) -;; (assert_return (invoke "f32.convert_i32_s" (i32.const 1234567890)) (f32.const 0x1.26580cp+30)) - -;; ;; Saturating conversions: test all the same values as the non-saturating conversions. - -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const 0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const 0x1p-149)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -0x1p-149)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const 1.0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const 0x1.19999ap+0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const 1.5)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -1.0)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -0x1.19999ap+0)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -1.5)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -1.9)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -2.0)) (i32.const -2)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const 2147483520.0)) (i32.const 2147483520)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -2147483648.0)) (i32.const -2147483648)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const 2147483648.0)) (i32.const 0x7fffffff)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -2147483904.0)) (i32.const 0x80000000)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const inf)) (i32.const 0x7fffffff)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -inf)) (i32.const 0x80000000)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const nan)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const nan:0x200000)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -nan)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_s" (f32.const -nan:0x200000)) (i32.const 0)) - -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const 0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const -0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const 0x1p-149)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const -0x1p-149)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const 1.0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const 0x1.19999ap+0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const 1.5)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const 1.9)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const 2.0)) (i32.const 2)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const 2147483648)) (i32.const -2147483648)) ;; 0x1.00000p+31 -> 8000 0000 -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const 4294967040.0)) (i32.const -256)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const -0x1.ccccccp-1)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const -0x1.fffffep-1)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const 4294967296.0)) (i32.const 0xffffffff)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const -1.0)) (i32.const 0x00000000)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const inf)) (i32.const 0xffffffff)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const -inf)) (i32.const 0x00000000)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const nan)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const nan:0x200000)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const -nan)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f32_u" (f32.const -nan:0x200000)) (i32.const 0)) - -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const 0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const 1.0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const 0x1.199999999999ap+0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const 1.5)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -1.0)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -0x1.199999999999ap+0)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -1.5)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -1.9)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -2.0)) (i32.const -2)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const 2147483647.0)) (i32.const 2147483647)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -2147483648.0)) (i32.const -2147483648)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const 2147483648.0)) (i32.const 0x7fffffff)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -2147483649.0)) (i32.const 0x80000000)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const inf)) (i32.const 0x7fffffff)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -inf)) (i32.const 0x80000000)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const nan)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const nan:0x4000000000000)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -nan)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_s" (f64.const -nan:0x4000000000000)) (i32.const 0)) - -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const -0.0)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 1.0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 0x1.199999999999ap+0)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 1.5)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 1.9)) (i32.const 1)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 2.0)) (i32.const 2)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 2147483648)) (i32.const -2147483648)) ;; 0x1.00000p+31 -> 8000 0000 -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 4294967295.0)) (i32.const -1)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const -0x1.ccccccccccccdp-1)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const -0x1.fffffffffffffp-1)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 1e8)) (i32.const 100000000)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 4294967296.0)) (i32.const 0xffffffff)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const -1.0)) (i32.const 0x00000000)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 1e16)) (i32.const 0xffffffff)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 1e30)) (i32.const 0xffffffff)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const 9223372036854775808)) (i32.const 0xffffffff)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const inf)) (i32.const 0xffffffff)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const -inf)) (i32.const 0x00000000)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const nan)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const nan:0x4000000000000)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const -nan)) (i32.const 0)) -;; (assert_return (invoke "i32.trunc_sat_f64_u" (f64.const -nan:0x4000000000000)) (i32.const 0)) - -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const 0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const 0x1p-149)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -0x1p-149)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const 1.0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const 0x1.19999ap+0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const 1.5)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -1.0)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -0x1.19999ap+0)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -1.5)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -1.9)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -2.0)) (i64.const -2)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const 4294967296)) (i64.const 4294967296)) ;; 0x1.00000p+32 -> 1 0000 0000 -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -4294967296)) (i64.const -4294967296)) ;; -0x1.00000p+32 -> ffff ffff 0000 0000 -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const 9223371487098961920.0)) (i64.const 9223371487098961920)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -9223372036854775808.0)) (i64.const -9223372036854775808)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const 9223372036854775808.0)) (i64.const 0x7fffffffffffffff)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -9223373136366403584.0)) (i64.const 0x8000000000000000)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const inf)) (i64.const 0x7fffffffffffffff)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -inf)) (i64.const 0x8000000000000000)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const nan)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const nan:0x200000)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -nan)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_s" (f32.const -nan:0x200000)) (i64.const 0)) - -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const 0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const -0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const 0x1p-149)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const -0x1p-149)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const 1.0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const 0x1.19999ap+0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const 1.5)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const 4294967296)) (i64.const 4294967296)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const 18446742974197923840.0)) (i64.const -1099511627776)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const -0x1.ccccccp-1)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const -0x1.fffffep-1)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const 18446744073709551616.0)) (i64.const 0xffffffffffffffff)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const -1.0)) (i64.const 0x0000000000000000)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const inf)) (i64.const 0xffffffffffffffff)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const -inf)) (i64.const 0x0000000000000000)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const nan)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const nan:0x200000)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const -nan)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f32_u" (f32.const -nan:0x200000)) (i64.const 0)) - -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const 0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const 0x0.0000000000001p-1022)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -0x0.0000000000001p-1022)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const 1.0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const 0x1.199999999999ap+0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const 1.5)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -1.0)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -0x1.199999999999ap+0)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -1.5)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -1.9)) (i64.const -1)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -2.0)) (i64.const -2)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const 4294967296)) (i64.const 4294967296)) ;; 0x1.00000p+32 -> 1 0000 0000 -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -4294967296)) (i64.const -4294967296)) ;; -0x1.00000p+32 -> ffff ffff 0000 0000 -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const 9223372036854774784.0)) (i64.const 9223372036854774784)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -9223372036854775808.0)) (i64.const -9223372036854775808)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const 9223372036854775808.0)) (i64.const 0x7fffffffffffffff)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -9223372036854777856.0)) (i64.const 0x8000000000000000)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const inf)) (i64.const 0x7fffffffffffffff)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -inf)) (i64.const 0x8000000000000000)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const nan)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const nan:0x4000000000000)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -nan)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_s" (f64.const -nan:0x4000000000000)) (i64.const 0)) - -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const -0.0)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 0x0.0000000000001p-1022)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const -0x0.0000000000001p-1022)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 1.0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 0x1.199999999999ap+0)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 1.5)) (i64.const 1)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 4294967295)) (i64.const 0xffffffff)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 4294967296)) (i64.const 0x100000000)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 18446744073709549568.0)) (i64.const -2048)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const -0x1.ccccccccccccdp-1)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const -0x1.fffffffffffffp-1)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 1e8)) (i64.const 100000000)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 1e16)) (i64.const 10000000000000000)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 9223372036854775808)) (i64.const -9223372036854775808)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const 18446744073709551616.0)) (i64.const 0xffffffffffffffff)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const -1.0)) (i64.const 0x0000000000000000)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const inf)) (i64.const 0xffffffffffffffff)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const -inf)) (i64.const 0x0000000000000000)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const nan)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const nan:0x4000000000000)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const -nan)) (i64.const 0)) -;; (assert_return (invoke "i64.trunc_sat_f64_u" (f64.const -nan:0x4000000000000)) (i64.const 0)) - -;; ;; Test rounding directions. -(assert_return (invoke "f32.convert_i32_s" (i32.const 16777217)) (f32.const 16777216.0)) -(assert_return (invoke "f32.convert_i32_s" (i32.const -16777217)) (f32.const -16777216.0)) -(assert_return (invoke "f32.convert_i32_s" (i32.const 16777219)) (f32.const 16777220.0)) -(assert_return (invoke "f32.convert_i32_s" (i32.const -16777219)) (f32.const -16777220.0)) - -(assert_return (invoke "f32.convert_i64_s" (i64.const 1)) (f32.const 1.0)) -(assert_return (invoke "f32.convert_i64_s" (i64.const -1)) (f32.const -1.0)) -(assert_return (invoke "f32.convert_i64_s" (i64.const 0)) (f32.const 0.0)) -(assert_return (invoke "f32.convert_i64_s" (i64.const 9223372036854775807)) (f32.const 9223372036854775807)) -(assert_return (invoke "f32.convert_i64_s" (i64.const -9223372036854775808)) (f32.const -9223372036854775808)) -(assert_return (invoke "f32.convert_i64_s" (i64.const 314159265358979)) (f32.const 0x1.1db9e8p+48)) ;; PI -;; ;; Test rounding directions. -(assert_return (invoke "f32.convert_i64_s" (i64.const 16777217)) (f32.const 16777216.0)) -(assert_return (invoke "f32.convert_i64_s" (i64.const -16777217)) (f32.const -16777216.0)) -(assert_return (invoke "f32.convert_i64_s" (i64.const 16777219)) (f32.const 16777220.0)) -(assert_return (invoke "f32.convert_i64_s" (i64.const -16777219)) (f32.const -16777220.0)) - -(assert_return (invoke "f32.convert_i64_s" (i64.const 0x7fffff4000000001)) (f32.const 0x1.fffffep+62)) -(assert_return (invoke "f32.convert_i64_s" (i64.const 0x8000004000000001)) (f32.const -0x1.fffffep+62)) -(assert_return (invoke "f32.convert_i64_s" (i64.const 0x0020000020000001)) (f32.const 0x1.000002p+53)) -(assert_return (invoke "f32.convert_i64_s" (i64.const 0xffdfffffdfffffff)) (f32.const -0x1.000002p+53)) - -(assert_return (invoke "f64.convert_i32_s" (i32.const 1)) (f64.const 1.0)) -(assert_return (invoke "f64.convert_i32_s" (i32.const -1)) (f64.const -1.0)) -(assert_return (invoke "f64.convert_i32_s" (i32.const 0)) (f64.const 0.0)) -(assert_return (invoke "f64.convert_i32_s" (i32.const 2147483647)) (f64.const 2147483647)) -(assert_return (invoke "f64.convert_i32_s" (i32.const -2147483648)) (f64.const -2147483648)) -(assert_return (invoke "f64.convert_i32_s" (i32.const 987654321)) (f64.const 987654321)) - -(assert_return (invoke "f64.convert_i64_s" (i64.const 1)) (f64.const 1.0)) -(assert_return (invoke "f64.convert_i64_s" (i64.const -1)) (f64.const -1.0)) -(assert_return (invoke "f64.convert_i64_s" (i64.const 0)) (f64.const 0.0)) -(assert_return (invoke "f64.convert_i64_s" (i64.const 9223372036854775807)) (f64.const 9223372036854775807)) -(assert_return (invoke "f64.convert_i64_s" (i64.const -9223372036854775808)) (f64.const -9223372036854775808)) -(assert_return (invoke "f64.convert_i64_s" (i64.const 4669201609102990)) (f64.const 4669201609102990)) ;; Feigenbaum -;; Test rounding directions. -(assert_return (invoke "f64.convert_i64_s" (i64.const 9007199254740993)) (f64.const 9007199254740992)) -(assert_return (invoke "f64.convert_i64_s" (i64.const -9007199254740993)) (f64.const -9007199254740992)) -(assert_return (invoke "f64.convert_i64_s" (i64.const 9007199254740995)) (f64.const 9007199254740996)) -(assert_return (invoke "f64.convert_i64_s" (i64.const -9007199254740995)) (f64.const -9007199254740996)) - -(assert_return (invoke "f32.convert_i32_u" (i32.const 1)) (f32.const 1.0)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 0)) (f32.const 0.0)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 2147483647)) (f32.const 2147483648)) -(assert_return (invoke "f32.convert_i32_u" (i32.const -2147483648)) (f32.const 2147483648)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 0x12345678)) (f32.const 0x1.234568p+28)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 0xffffffff)) (f32.const 4294967296.0)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 0x80000080)) (f32.const 0x1.000000p+31)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 0x80000081)) (f32.const 0x1.000002p+31)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 0x80000082)) (f32.const 0x1.000002p+31)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 0xfffffe80)) (f32.const 0x1.fffffcp+31)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 0xfffffe81)) (f32.const 0x1.fffffep+31)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 0xfffffe82)) (f32.const 0x1.fffffep+31)) -;; Test rounding directions. -(assert_return (invoke "f32.convert_i32_u" (i32.const 16777217)) (f32.const 16777216.0)) -(assert_return (invoke "f32.convert_i32_u" (i32.const 16777219)) (f32.const 16777220.0)) - -(assert_return (invoke "f32.convert_i64_u" (i64.const 1)) (f32.const 1.0)) -(assert_return (invoke "f32.convert_i64_u" (i64.const 0)) (f32.const 0.0)) -(assert_return (invoke "f32.convert_i64_u" (i64.const 9223372036854775807)) (f32.const 9223372036854775807)) -(assert_return (invoke "f32.convert_i64_u" (i64.const -9223372036854775808)) (f32.const 9223372036854775808)) -(assert_return (invoke "f32.convert_i64_u" (i64.const 0xffffffffffffffff)) (f32.const 18446744073709551616.0)) -;; Test rounding directions. -(assert_return (invoke "f32.convert_i64_u" (i64.const 16777217)) (f32.const 16777216.0)) -(assert_return (invoke "f32.convert_i64_u" (i64.const 16777219)) (f32.const 16777220.0)) - -(assert_return (invoke "f32.convert_i64_u" (i64.const 0x0020000020000001)) (f32.const 0x1.000002p+53)) -(assert_return (invoke "f32.convert_i64_u" (i64.const 0x7fffffbfffffffff)) (f32.const 0x1.fffffep+62)) -(assert_return (invoke "f32.convert_i64_u" (i64.const 0x8000008000000001)) (f32.const 0x1.000002p+63)) -(assert_return (invoke "f32.convert_i64_u" (i64.const 0xfffffe8000000001)) (f32.const 0x1.fffffep+63)) - -(assert_return (invoke "f64.convert_i32_u" (i32.const 1)) (f64.const 1.0)) -(assert_return (invoke "f64.convert_i32_u" (i32.const 0)) (f64.const 0.0)) -(assert_return (invoke "f64.convert_i32_u" (i32.const 2147483647)) (f64.const 2147483647)) -(assert_return (invoke "f64.convert_i32_u" (i32.const -2147483648)) (f64.const 2147483648)) -(assert_return (invoke "f64.convert_i32_u" (i32.const 0xffffffff)) (f64.const 4294967295.0)) - -(assert_return (invoke "f64.convert_i64_u" (i64.const 1)) (f64.const 1.0)) -(assert_return (invoke "f64.convert_i64_u" (i64.const 0)) (f64.const 0.0)) -(assert_return (invoke "f64.convert_i64_u" (i64.const 9223372036854775807)) (f64.const 9223372036854775807)) -(assert_return (invoke "f64.convert_i64_u" (i64.const -9223372036854775808)) (f64.const 9223372036854775808)) -(assert_return (invoke "f64.convert_i64_u" (i64.const 0xffffffffffffffff)) (f64.const 18446744073709551616.0)) -(assert_return (invoke "f64.convert_i64_u" (i64.const 0x8000000000000400)) (f64.const 0x1.0000000000000p+63)) -(assert_return (invoke "f64.convert_i64_u" (i64.const 0x8000000000000401)) (f64.const 0x1.0000000000001p+63)) -(assert_return (invoke "f64.convert_i64_u" (i64.const 0x8000000000000402)) (f64.const 0x1.0000000000001p+63)) -(assert_return (invoke "f64.convert_i64_u" (i64.const 0xfffffffffffff400)) (f64.const 0x1.ffffffffffffep+63)) -(assert_return (invoke "f64.convert_i64_u" (i64.const 0xfffffffffffff401)) (f64.const 0x1.fffffffffffffp+63)) -(assert_return (invoke "f64.convert_i64_u" (i64.const 0xfffffffffffff402)) (f64.const 0x1.fffffffffffffp+63)) -;; ;; Test rounding directions. -(assert_return (invoke "f64.convert_i64_u" (i64.const 9007199254740993)) (f64.const 9007199254740992)) -(assert_return (invoke "f64.convert_i64_u" (i64.const 9007199254740995)) (f64.const 9007199254740996)) - -;; (assert_return (invoke "f64.promote_f32" (f32.const 0.0)) (f64.const 0.0)) -;; (assert_return (invoke "f64.promote_f32" (f32.const -0.0)) (f64.const -0.0)) -;; (assert_return (invoke "f64.promote_f32" (f32.const 0x1p-149)) (f64.const 0x1p-149)) -;; (assert_return (invoke "f64.promote_f32" (f32.const -0x1p-149)) (f64.const -0x1p-149)) -;; (assert_return (invoke "f64.promote_f32" (f32.const 1.0)) (f64.const 1.0)) -;; (assert_return (invoke "f64.promote_f32" (f32.const -1.0)) (f64.const -1.0)) -;; (assert_return (invoke "f64.promote_f32" (f32.const -0x1.fffffep+127)) (f64.const -0x1.fffffep+127)) -;; (assert_return (invoke "f64.promote_f32" (f32.const 0x1.fffffep+127)) (f64.const 0x1.fffffep+127)) -;; ;; Generated randomly by picking a random int and reinterpret it to float. -;; (assert_return (invoke "f64.promote_f32" (f32.const 0x1p-119)) (f64.const 0x1p-119)) -;; ;; Generated randomly by picking a random float. -;; (assert_return (invoke "f64.promote_f32" (f32.const 0x1.8f867ep+125)) (f64.const 6.6382536710104395e+37)) -;; (assert_return (invoke "f64.promote_f32" (f32.const inf)) (f64.const inf)) -;; (assert_return (invoke "f64.promote_f32" (f32.const -inf)) (f64.const -inf)) -;; (assert_return (invoke "f64.promote_f32" (f32.const nan)) (f64.const nan:canonical)) -;; (assert_return (invoke "f64.promote_f32" (f32.const nan:0x200000)) (f64.const nan:arithmetic)) -;; (assert_return (invoke "f64.promote_f32" (f32.const -nan)) (f64.const nan:canonical)) -;; (assert_return (invoke "f64.promote_f32" (f32.const -nan:0x200000)) (f64.const nan:arithmetic)) - -;; (assert_return (invoke "f32.demote_f64" (f64.const 0.0)) (f32.const 0.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0.0)) (f32.const -0.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x0.0000000000001p-1022)) (f32.const 0.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x0.0000000000001p-1022)) (f32.const -0.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 1.0)) (f32.const 1.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -1.0)) (f32.const -1.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffe0000000p-127)) (f32.const 0x1p-126)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffe0000000p-127)) (f32.const -0x1p-126)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffdfffffffp-127)) (f32.const 0x1.fffffcp-127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffdfffffffp-127)) (f32.const -0x1.fffffcp-127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1p-149)) (f32.const 0x1p-149)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1p-149)) (f32.const -0x1p-149)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffd0000000p+127)) (f32.const 0x1.fffffcp+127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffd0000000p+127)) (f32.const -0x1.fffffcp+127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffd0000001p+127)) (f32.const 0x1.fffffep+127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffd0000001p+127)) (f32.const -0x1.fffffep+127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffefffffffp+127)) (f32.const 0x1.fffffep+127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffefffffffp+127)) (f32.const -0x1.fffffep+127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.ffffffp+127)) (f32.const inf)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.ffffffp+127)) (f32.const -inf)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1p-119)) (f32.const 0x1p-119)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.8f867ep+125)) (f32.const 0x1.8f867ep+125)) -;; (assert_return (invoke "f32.demote_f64" (f64.const inf)) (f32.const inf)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -inf)) (f32.const -inf)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000000000001p+0)) (f32.const 1.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffffffffffp-1)) (f32.const 1.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000010000000p+0)) (f32.const 0x1.000000p+0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000010000001p+0)) (f32.const 0x1.000002p+0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.000002fffffffp+0)) (f32.const 0x1.000002p+0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000030000000p+0)) (f32.const 0x1.000004p+0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000050000000p+0)) (f32.const 0x1.000004p+0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000010000000p+24)) (f32.const 0x1.0p+24)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000010000001p+24)) (f32.const 0x1.000002p+24)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.000002fffffffp+24)) (f32.const 0x1.000002p+24)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000030000000p+24)) (f32.const 0x1.000004p+24)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.4eae4f7024c7p+108)) (f32.const 0x1.4eae5p+108)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.a12e71e358685p-113)) (f32.const 0x1.a12e72p-113)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.cb98354d521ffp-127)) (f32.const 0x1.cb9834p-127)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.6972b30cfb562p+1)) (f32.const -0x1.6972b4p+1)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.bedbe4819d4c4p+112)) (f32.const -0x1.bedbe4p+112)) -;; (assert_return (invoke "f32.demote_f64" (f64.const nan)) (f32.const nan:canonical)) -;; (assert_return (invoke "f32.demote_f64" (f64.const nan:0x4000000000000)) (f32.const nan:arithmetic)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -nan)) (f32.const nan:canonical)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -nan:0x4000000000000)) (f32.const nan:arithmetic)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1p-1022)) (f32.const 0.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1p-1022)) (f32.const -0.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0p-150)) (f32.const 0.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.0p-150)) (f32.const -0.0)) -;; (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000000000001p-150)) (f32.const 0x1p-149)) -;; (assert_return (invoke "f32.demote_f64" (f64.const -0x1.0000000000001p-150)) (f32.const -0x1p-149)) - -(assert_return (invoke "f32.reinterpret_i32" (i32.const 0)) (f32.const 0.0)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 0x80000000)) (f32.const -0.0)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 1)) (f32.const 0x1p-149)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const -1)) (f32.const -nan:0x7fffff)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 123456789)) (f32.const 0x1.b79a2ap-113)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const -2147483647)) (f32.const -0x1p-149)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 0x7f800000)) (f32.const inf)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 0xff800000)) (f32.const -inf)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 0x7fc00000)) (f32.const nan)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 0xffc00000)) (f32.const -nan)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 0x7fa00000)) (f32.const nan:0x200000)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 0xffa00000)) (f32.const -nan:0x200000)) - -(assert_return (invoke "f64.reinterpret_i64" (i64.const 0)) (f64.const 0.0)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 1)) (f64.const 0x0.0000000000001p-1022)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const -1)) (f64.const -nan:0xfffffffffffff)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 0x8000000000000000)) (f64.const -0.0)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 1234567890)) (f64.const 0x0.00000499602d2p-1022)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const -9223372036854775807)) (f64.const -0x0.0000000000001p-1022)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 0x7ff0000000000000)) (f64.const inf)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 0xfff0000000000000)) (f64.const -inf)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 0x7ff8000000000000)) (f64.const nan)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 0xfff8000000000000)) (f64.const -nan)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 0x7ff4000000000000)) (f64.const nan:0x4000000000000)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 0xfff4000000000000)) (f64.const -nan:0x4000000000000)) - -(assert_return (invoke "i32.reinterpret_f32" (f32.const 0.0)) (i32.const 0)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const -0.0)) (i32.const 0x80000000)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const 0x1p-149)) (i32.const 1)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const -nan:0x7fffff)) (i32.const -1)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const -0x1p-149)) (i32.const 0x80000001)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const 1.0)) (i32.const 1065353216)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const 3.1415926)) (i32.const 1078530010)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const 0x1.fffffep+127)) (i32.const 2139095039)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const -0x1.fffffep+127)) (i32.const -8388609)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const inf)) (i32.const 0x7f800000)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const -inf)) (i32.const 0xff800000)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const nan)) (i32.const 0x7fc00000)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const -nan)) (i32.const 0xffc00000)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const nan:0x200000)) (i32.const 0x7fa00000)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const -nan:0x200000)) (i32.const 0xffa00000)) - -(assert_return (invoke "i64.reinterpret_f64" (f64.const 0.0)) (i64.const 0)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const -0.0)) (i64.const 0x8000000000000000)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const 0x0.0000000000001p-1022)) (i64.const 1)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const -nan:0xfffffffffffff)) (i64.const -1)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const -0x0.0000000000001p-1022)) (i64.const 0x8000000000000001)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const 1.0)) (i64.const 4607182418800017408)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const 3.14159265358979)) (i64.const 4614256656552045841)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const 0x1.fffffffffffffp+1023)) (i64.const 9218868437227405311)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const -0x1.fffffffffffffp+1023)) (i64.const -4503599627370497)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const inf)) (i64.const 0x7ff0000000000000)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const -inf)) (i64.const 0xfff0000000000000)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const nan)) (i64.const 0x7ff8000000000000)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const -nan)) (i64.const 0xfff8000000000000)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const nan:0x4000000000000)) (i64.const 0x7ff4000000000000)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const -nan:0x4000000000000)) (i64.const 0xfff4000000000000)) - -;; ;; Type check - -(assert_invalid (module (func (result i32) (i32.wrap_i64 (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (result i32) (i32.trunc_f32_s (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result i32) (i32.trunc_f32_u (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result i32) (i32.trunc_f64_s (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result i32) (i32.trunc_f64_u (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result i32) (i32.reinterpret_f32 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result i64) (i64.extend_i32_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (result i64) (i64.extend_i32_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (result i64) (i64.trunc_f32_s (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result i64) (i64.trunc_f32_u (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result i64) (i64.trunc_f64_s (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result i64) (i64.trunc_f64_u (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result i64) (i64.reinterpret_f64 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result f32) (f32.convert_i32_s (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result f32) (f32.convert_i32_u (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result f32) (f32.convert_i64_s (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result f32) (f32.convert_i64_u (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result f32) (f32.demote_f64 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result f32) (f32.reinterpret_i32 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result f64) (f64.convert_i32_s (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result f64) (f64.convert_i32_u (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (result f64) (f64.convert_i64_s (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result f64) (f64.convert_i64_u (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result f64) (f64.promote_f32 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (result f64) (f64.reinterpret_i64 (i32.const 0)))) "type mismatch") diff --git a/examples/wast/select.wast b/examples/wast/select.wast deleted file mode 100644 index 8148102..0000000 --- a/examples/wast/select.wast +++ /dev/null @@ -1,531 +0,0 @@ -(module - ;; Auxiliary - (func $dummy) - (table $tab funcref (elem $dummy)) - (memory 1) - - (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-i32-t") (param i32 i32 i32) (result i32) - (select (result i32) (local.get 0) (local.get 1) (local.get 2)) - ) - (func (export "select-i64-t") (param i64 i64 i32) (result i64) - (select (result i64) (local.get 0) (local.get 1) (local.get 2)) - ) - (func (export "select-f32-t") (param f32 f32 i32) (result f32) - (select (result f32) (local.get 0) (local.get 1) (local.get 2)) - ) - (func (export "select-f64-t") (param f64 f64 i32) (result f64) - (select (result f64) (local.get 0) (local.get 1) (local.get 2)) - ) - (func (export "select-funcref") (param funcref funcref i32) (result funcref) - (select (result funcref) (local.get 0) (local.get 1) (local.get 2)) - ) - (func (export "select-externref") (param externref externref i32) (result externref) - (select (result externref) (local.get 0) (local.get 1) (local.get 2)) - ) - - ;; As the argument of control constructs and instructions - - (func (export "as-select-first") (param i32) (result i32) - (select (select (i32.const 0) (i32.const 1) (local.get 0)) (i32.const 2) (i32.const 3)) - ) - (func (export "as-select-mid") (param i32) (result i32) - (select (i32.const 2) (select (i32.const 0) (i32.const 1) (local.get 0)) (i32.const 3)) - ) - (func (export "as-select-last") (param i32) (result i32) - (select (i32.const 2) (i32.const 3) (select (i32.const 0) (i32.const 1) (local.get 0))) - ) - - (func (export "as-loop-first") (param i32) (result i32) - (loop (result i32) (select (i32.const 2) (i32.const 3) (local.get 0)) (call $dummy) (call $dummy)) - ) - (func (export "as-loop-mid") (param i32) (result i32) - (loop (result i32) (call $dummy) (select (i32.const 2) (i32.const 3) (local.get 0)) (call $dummy)) - ) - (func (export "as-loop-last") (param i32) (result i32) - (loop (result i32) (call $dummy) (call $dummy) (select (i32.const 2) (i32.const 3) (local.get 0))) - ) - - (func (export "as-if-condition") (param i32) - (select (i32.const 2) (i32.const 3) (local.get 0)) (if (then (call $dummy))) - ) - (func (export "as-if-then") (param i32) (result i32) - (if (result i32) (i32.const 1) (then (select (i32.const 2) (i32.const 3) (local.get 0))) (else (i32.const 4))) - ) - (func (export "as-if-else") (param i32) (result i32) - (if (result i32) (i32.const 0) (then (i32.const 2)) (else (select (i32.const 2) (i32.const 3) (local.get 0)))) - ) - - (func (export "as-br_if-first") (param i32) (result i32) - (block (result i32) (br_if 0 (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 4))) - ) - (func (export "as-br_if-last") (param i32) (result i32) - (block (result i32) (br_if 0 (i32.const 2) (select (i32.const 2) (i32.const 3) (local.get 0)))) - ) - - (func (export "as-br_table-first") (param i32) (result i32) - (block (result i32) (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 2) (br_table 0 0)) - ) - (func (export "as-br_table-last") (param i32) (result i32) - (block (result i32) (i32.const 2) (select (i32.const 2) (i32.const 3) (local.get 0)) (br_table 0 0)) - ) - - (func $func (param i32 i32) (result i32) (local.get 0)) - (type $check (func (param i32 i32) (result i32))) - (table $t funcref (elem $func)) - (func (export "as-call_indirect-first") (param i32) (result i32) - (block (result i32) - (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 $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 $t (type $check) - (i32.const 1) (i32.const 4) (select (i32.const 2) (i32.const 3) (local.get 0)) - ) - ) - ) - - (func (export "as-store-first") (param i32) - (select (i32.const 0) (i32.const 4) (local.get 0)) (i32.const 1) (i32.store) - ) - (func (export "as-store-last") (param i32) - (i32.const 8) (select (i32.const 1) (i32.const 2) (local.get 0)) (i32.store) - ) - - (func (export "as-memory.grow-value") (param i32) (result i32) - (memory.grow (select (i32.const 1) (i32.const 2) (local.get 0))) - ) - - (func $f (param i32) (result i32) (local.get 0)) - - (func (export "as-call-value") (param i32) (result i32) - (call $f (select (i32.const 1) (i32.const 2) (local.get 0))) - ) - (func (export "as-return-value") (param i32) (result i32) - (select (i32.const 1) (i32.const 2) (local.get 0)) (return) - ) - (func (export "as-drop-operand") (param i32) - (drop (select (i32.const 1) (i32.const 2) (local.get 0))) - ) - (func (export "as-br-value") (param i32) (result i32) - (block (result i32) (br 0 (select (i32.const 1) (i32.const 2) (local.get 0)))) - ) - (func (export "as-local.set-value") (param i32) (result i32) - (local i32) (local.set 0 (select (i32.const 1) (i32.const 2) (local.get 0))) (local.get 0) - ) - (func (export "as-local.tee-value") (param i32) (result i32) - (local.tee 0 (select (i32.const 1) (i32.const 2) (local.get 0))) - ) - (global $a (mut i32) (i32.const 10)) - (func (export "as-global.set-value") (param i32) (result i32) - (global.set $a (select (i32.const 1) (i32.const 2) (local.get 0))) - (global.get $a) - ) - (func (export "as-load-operand") (param i32) (result i32) - (i32.load (select (i32.const 0) (i32.const 4) (local.get 0))) - ) - - (func (export "as-unary-operand") (param i32) (result i32) - (i32.eqz (select (i32.const 0) (i32.const 1) (local.get 0))) - ) - (func (export "as-binary-operand") (param i32) (result i32) - (i32.mul - (select (i32.const 1) (i32.const 2) (local.get 0)) - (select (i32.const 1) (i32.const 2) (local.get 0)) - ) - ) - (func (export "as-test-operand") (param i32) (result i32) - (block (result i32) - (i32.eqz (select (i32.const 0) (i32.const 1) (local.get 0))) - ) - ) - - (func (export "as-compare-left") (param i32) (result i32) - (block (result i32) - (i32.le_s (select (i32.const 1) (i32.const 2) (local.get 0)) (i32.const 1)) - ) - ) - (func (export "as-compare-right") (param i32) (result i32) - (block (result i32) - (i32.ne (i32.const 1) (select (i32.const 0) (i32.const 1) (local.get 0))) - ) - ) - - (func (export "as-convert-operand") (param i32) (result i32) - (block (result i32) - (i32.wrap_i64 (select (i64.const 1) (i64.const 0) (local.get 0))) - ) - ) -) - -(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_return (invoke "select-i32-t" (i32.const 1) (i32.const 2) (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const 1)) (i64.const 2)) -;; (assert_return (invoke "select-f32-t" (f32.const 1) (f32.const 2) (i32.const 1)) (f32.const 1)) -;; (assert_return (invoke "select-f64-t" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1)) -;; (assert_return (invoke "select-funcref" (ref.null func) (ref.null func) (i32.const 1)) (ref.null func)) -;; (assert_return (invoke "select-externref" (ref.extern 1) (ref.extern 2) (i32.const 1)) (ref.extern 1)) - -;; (assert_return (invoke "select-i32-t" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "select-i32-t" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1)) -;; (assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2)) -;; (assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2)) -;; (assert_return (invoke "select-externref" (ref.extern 1) (ref.extern 2) (i32.const 0)) (ref.extern 2)) -;; (assert_return (invoke "select-externref" (ref.extern 2) (ref.extern 1) (i32.const 0)) (ref.extern 1)) - -;; (assert_return (invoke "select-f32-t" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan)) -;; (assert_return (invoke "select-f32-t" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304)) -;; (assert_return (invoke "select-f32-t" (f32.const nan) (f32.const 1) (i32.const 0)) (f32.const 1)) -;; (assert_return (invoke "select-f32-t" (f32.const nan:0x20304) (f32.const 1) (i32.const 0)) (f32.const 1)) -;; (assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan) (i32.const 1)) (f32.const 2)) -;; (assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan:0x20304) (i32.const 1)) (f32.const 2)) -;; (assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan) (i32.const 0)) (f32.const nan)) -;; (assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan:0x20304) (i32.const 0)) (f32.const nan:0x20304)) - -;; (assert_return (invoke "select-f64-t" (f64.const nan) (f64.const 1) (i32.const 1)) (f64.const nan)) -;; (assert_return (invoke "select-f64-t" (f64.const nan:0x20304) (f64.const 1) (i32.const 1)) (f64.const nan:0x20304)) -;; (assert_return (invoke "select-f64-t" (f64.const nan) (f64.const 1) (i32.const 0)) (f64.const 1)) -;; (assert_return (invoke "select-f64-t" (f64.const nan:0x20304) (f64.const 1) (i32.const 0)) (f64.const 1)) -;; (assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan) (i32.const 1)) (f64.const 2)) -;; (assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan:0x20304) (i32.const 1)) (f64.const 2)) -;; (assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan) (i32.const 0)) (f64.const nan)) -;; (assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan:0x20304) (i32.const 0)) (f64.const nan:0x20304)) - -;; (assert_return (invoke "as-select-first" (i32.const 0)) (i32.const 1)) -;; (assert_return (invoke "as-select-first" (i32.const 1)) (i32.const 0)) -;; (assert_return (invoke "as-select-mid" (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "as-select-mid" (i32.const 1)) (i32.const 2)) -;; (assert_return (invoke "as-select-last" (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "as-select-last" (i32.const 1)) (i32.const 3)) - -;; (assert_return (invoke "as-loop-first" (i32.const 0)) (i32.const 3)) -;; (assert_return (invoke "as-loop-first" (i32.const 1)) (i32.const 2)) -;; (assert_return (invoke "as-loop-mid" (i32.const 0)) (i32.const 3)) -;; (assert_return (invoke "as-loop-mid" (i32.const 1)) (i32.const 2)) -;; (assert_return (invoke "as-loop-last" (i32.const 0)) (i32.const 3)) -;; (assert_return (invoke "as-loop-last" (i32.const 1)) (i32.const 2)) - -;; (assert_return (invoke "as-if-condition" (i32.const 0))) -;; (assert_return (invoke "as-if-condition" (i32.const 1))) -;; (assert_return (invoke "as-if-then" (i32.const 0)) (i32.const 3)) -;; (assert_return (invoke "as-if-then" (i32.const 1)) (i32.const 2)) -;; (assert_return (invoke "as-if-else" (i32.const 0)) (i32.const 3)) -;; (assert_return (invoke "as-if-else" (i32.const 1)) (i32.const 2)) - -;; (assert_return (invoke "as-br_if-first" (i32.const 0)) (i32.const 3)) -;; (assert_return (invoke "as-br_if-first" (i32.const 1)) (i32.const 2)) -;; (assert_return (invoke "as-br_if-last" (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "as-br_if-last" (i32.const 1)) (i32.const 2)) - -;; (assert_return (invoke "as-br_table-first" (i32.const 0)) (i32.const 3)) -;; (assert_return (invoke "as-br_table-first" (i32.const 1)) (i32.const 2)) -;; (assert_return (invoke "as-br_table-last" (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "as-br_table-last" (i32.const 1)) (i32.const 2)) - -;; (assert_return (invoke "as-call_indirect-first" (i32.const 0)) (i32.const 3)) -;; (assert_return (invoke "as-call_indirect-first" (i32.const 1)) (i32.const 2)) -;; (assert_return (invoke "as-call_indirect-mid" (i32.const 0)) (i32.const 1)) -;; (assert_return (invoke "as-call_indirect-mid" (i32.const 1)) (i32.const 1)) -;; (assert_trap (invoke "as-call_indirect-last" (i32.const 0)) "undefined element") -;; (assert_trap (invoke "as-call_indirect-last" (i32.const 1)) "undefined element") - -;; (assert_return (invoke "as-store-first" (i32.const 0))) -;; (assert_return (invoke "as-store-first" (i32.const 1))) -;; (assert_return (invoke "as-store-last" (i32.const 0))) -;; (assert_return (invoke "as-store-last" (i32.const 1))) - -;; (assert_return (invoke "as-memory.grow-value" (i32.const 0)) (i32.const 1)) -;; (assert_return (invoke "as-memory.grow-value" (i32.const 1)) (i32.const 3)) - -;; (assert_return (invoke "as-call-value" (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "as-call-value" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-return-value" (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "as-return-value" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-drop-operand" (i32.const 0))) -;; (assert_return (invoke "as-drop-operand" (i32.const 1))) -;; (assert_return (invoke "as-br-value" (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "as-br-value" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-local.set-value" (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "as-local.set-value" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-local.tee-value" (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "as-local.tee-value" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-global.set-value" (i32.const 0)) (i32.const 2)) -;; (assert_return (invoke "as-global.set-value" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-load-operand" (i32.const 0)) (i32.const 1)) -;; (assert_return (invoke "as-load-operand" (i32.const 1)) (i32.const 1)) - -;; (assert_return (invoke "as-unary-operand" (i32.const 0)) (i32.const 0)) -;; (assert_return (invoke "as-unary-operand" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-binary-operand" (i32.const 0)) (i32.const 4)) -;; (assert_return (invoke "as-binary-operand" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-test-operand" (i32.const 0)) (i32.const 0)) -;; (assert_return (invoke "as-test-operand" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-compare-left" (i32.const 0)) (i32.const 0)) -;; (assert_return (invoke "as-compare-left" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-compare-right" (i32.const 0)) (i32.const 0)) -;; (assert_return (invoke "as-compare-right" (i32.const 1)) (i32.const 1)) -;; (assert_return (invoke "as-convert-operand" (i32.const 0)) (i32.const 0)) -;; (assert_return (invoke "as-convert-operand" (i32.const 1)) (i32.const 1)) - -;; (assert_invalid -;; (module (func $arity-0-implicit (select (nop) (nop) (i32.const 1)))) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module (func $arity-0 (select (result) (nop) (nop) (i32.const 1)))) -;; "invalid result arity" -;; ) -;; (assert_invalid -;; (module (func $arity-2 (result i32 i32) -;; (select (result i32 i32) -;; (i32.const 0) (i32.const 0) -;; (i32.const 0) (i32.const 0) -;; (i32.const 1) -;; ) -;; )) -;; "invalid result arity" -;; ) - - -;; (assert_invalid -;; (module (func $type-externref-implicit (param $r externref) -;; (drop (select (local.get $r) (local.get $r) (i32.const 1))) -;; )) -;; "type mismatch" -;; ) - -;; (assert_invalid -;; (module (func $type-num-vs-num -;; (drop (select (i32.const 1) (i64.const 1) (i32.const 1))) -;; )) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module (func $type-num-vs-num -;; (drop (select (i32.const 1) (f32.const 1.0) (i32.const 1))) -;; )) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module (func $type-num-vs-num -;; (drop (select (i32.const 1) (f64.const 1.0) (i32.const 1))) -;; )) -;; "type mismatch" -;; ) - -;; (assert_invalid -;; (module (func $type-num-vs-num (select (i32.const 1) (i64.const 1) (i32.const 1)) (drop))) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module (func $type-num-vs-num (select (i32.const 1) (f32.const 1.0) (i32.const 1)) (drop))) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module (func $type-num-vs-num (select (i32.const 1) (i64.const 1) (i32.const 1)) (drop))) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module (func $type-num-vs-num (select (i32.const 1) (f32.const 1.0) (i32.const 1)) (drop))) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module (func $type-num-vs-num (select (i32.const 1) (f64.const 1.0) (i32.const 1)) (drop))) -;; "type mismatch" -;; ) - - -;; (assert_invalid -;; (module -;; (func $type-1st-operand-empty -;; (select) (drop) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-2nd-operand-empty -;; (i32.const 0) (select) (drop) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-3rd-operand-empty -;; (i32.const 0) (i32.const 0) (select) (drop) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-1st-operand-empty-in-block -;; (i32.const 0) (i32.const 0) (i32.const 0) -;; (block (select) (drop)) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-2nd-operand-empty-in-block -;; (i32.const 0) (i32.const 0) -;; (block (i32.const 0) (select) (drop)) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-3rd-operand-empty-in-block -;; (i32.const 0) -;; (block (i32.const 0) (i32.const 0) (select) (drop)) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-1st-operand-empty-in-loop -;; (i32.const 0) (i32.const 0) (i32.const 0) -;; (loop (select) (drop)) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-2nd-operand-empty-in-loop -;; (i32.const 0) (i32.const 0) -;; (loop (i32.const 0) (select) (drop)) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-3rd-operand-empty-in-loop -;; (i32.const 0) -;; (loop (i32.const 0) (i32.const 0) (select) (drop)) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-1st-operand-empty-in-then -;; (i32.const 0) (i32.const 0) (i32.const 0) -;; (if (then (select) (drop))) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-2nd-operand-empty-in-then -;; (i32.const 0) (i32.const 0) -;; (if (then (i32.const 0) (select) (drop))) -;; ) -;; ) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module -;; (func $type-3rd-operand-empty-in-then -;; (i32.const 0) -;; (if (then (i32.const 0) (i32.const 0) (select) (drop))) -;; ) -;; ) -;; "type mismatch" -;; ) - -;; ;; Third operand must be i32 - -;; (assert_invalid -;; (module (func (select (i32.const 1) (i32.const 1) (i64.const 1)) (drop))) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module (func (select (i32.const 1) (i32.const 1) (f32.const 1)) (drop))) -;; "type mismatch" -;; ) -;; (assert_invalid -;; (module (func (select (i32.const 1) (i32.const 1) (f64.const 1)) (drop))) -;; "type mismatch" -;; ) - -;; ;; Result of select has type of first two operands - -;; (assert_invalid -;; (module (func (result i32) (select (i64.const 1) (i64.const 1) (i32.const 1)))) -;; "type mismatch" -;; ) - - -;; ;; Flat syntax - -;; (module -;; (table 1 funcref) -;; (func (result i32) unreachable select) -;; (func (result i32) unreachable select nop) -;; (func (result i32) unreachable select (select)) -;; (func (result i32) unreachable select select) -;; (func (result i32) unreachable select select select) -;; (func (result i32) unreachable select (result i32)) -;; (func (result i32) unreachable select (result i32) (result)) -;; (func (result i32) unreachable select (result i32) (result) select) -;; (func (result i32) unreachable select (result) (result i32) select (result i32)) -;; (func (result i32) unreachable select call_indirect) -;; (func (result i32) unreachable select call_indirect select) -;; )