mirror of
https://github.com/fluencelabs/wasmer
synced 2025-05-28 17:41:20 +00:00
Fix assert_return_canonical_nan and assert_return_arithmetic__nan for tests
This commit is contained in:
parent
1f8a9d931c
commit
0bde1c2d00
1
spectests/inline_module.wast
Normal file
1
spectests/inline_module.wast
Normal file
@ -0,0 +1 @@
|
||||
(func) (memory 0) (func (export "f"))
|
@ -163,8 +163,10 @@ impl WastTestGenerator {
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{{instantiate, compile, ImportObject, ResultObject, VmCtx, Export}};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{{f32, f64}};
|
||||
use super::_common::{{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
}};
|
||||
use wabt::wat2wasm;\n\n",
|
||||
self.filename
|
||||
));
|
||||
@ -179,6 +181,7 @@ use wabt::wat2wasm;\n\n",
|
||||
self.flush_module_calls(n);
|
||||
}
|
||||
}
|
||||
|
||||
fn command_name(&self) -> String {
|
||||
format!("c{}_l{}", self.command_no, self.last_line)
|
||||
}
|
||||
@ -271,6 +274,107 @@ fn {}_assert_invalid() {{
|
||||
.as_str(),
|
||||
);
|
||||
}
|
||||
|
||||
fn visit_assert_return_arithmetic_nan(&mut self, action: &Action) {
|
||||
match action {
|
||||
Action::Invoke { module, field, args, } => {
|
||||
let mut return_type = wabt2rust_type(&args[0]);
|
||||
let mut func_return = format!(" -> {}", return_type);
|
||||
let assertion = String::from("assert!(result.is_quiet_nan())");
|
||||
|
||||
// We map the arguments provided into the raw Arguments provided
|
||||
// to libffi
|
||||
let mut args_types: Vec<String> = args.iter().map(wabt2rust_type).collect();
|
||||
args_types.push("&VmCtx".to_string());
|
||||
let mut args_values: Vec<String> = args.iter().map(wabt2rust_value).collect();
|
||||
args_values.push("&vm_context".to_string());
|
||||
let func_name = format!("{}_assert_return_arithmetic_nan", self.command_name());
|
||||
self.buffer.push_str(
|
||||
format!(
|
||||
"fn {}(result_object: &ResultObject, vm_context: &VmCtx) {{
|
||||
println!(\"Executing function {{}}\", \"{}\");
|
||||
let func_index = match result_object.module.info.exports.get({:?}) {{
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!(\"Function not found\"),
|
||||
}};
|
||||
let invoke_fn: fn({}){} = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn({});
|
||||
{}
|
||||
}}\n",
|
||||
func_name,
|
||||
func_name,
|
||||
field,
|
||||
args_types.join(", "),
|
||||
func_return,
|
||||
args_values.join(", "),
|
||||
assertion,
|
||||
)
|
||||
.as_str(),
|
||||
);
|
||||
self.module_calls
|
||||
.entry(self.last_module)
|
||||
.or_insert(Vec::new())
|
||||
.push(func_name);
|
||||
// let mut module_calls = self.module_calls.get(&self.last_module).unwrap();
|
||||
// module_calls.push(func_name);
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
}
|
||||
|
||||
// PROBLEM: Im assuming the return type from the first argument type
|
||||
// and wabt does gives us the `expected` result
|
||||
fn visit_assert_return_canonical_nan(&mut self, action: &Action) {
|
||||
match action {
|
||||
Action::Invoke { module, field, args, } => {
|
||||
let mut return_type = match &field.as_str() {
|
||||
&"f64.promote_f32" => String::from("f64"),
|
||||
&"f32.promote_f64" => String::from("f32"),
|
||||
_ => wabt2rust_type(&args[0]),
|
||||
};
|
||||
let mut func_return = format!(" -> {}", return_type);
|
||||
let assertion = String::from("assert!(result.is_quiet_nan())");
|
||||
|
||||
// We map the arguments provided into the raw Arguments provided
|
||||
// to libffi
|
||||
let mut args_types: Vec<String> = args.iter().map(wabt2rust_type).collect();
|
||||
args_types.push("&VmCtx".to_string());
|
||||
let mut args_values: Vec<String> = args.iter().map(wabt2rust_value).collect();
|
||||
args_values.push("&vm_context".to_string());
|
||||
let func_name = format!("{}_assert_return_canonical_nan", self.command_name());
|
||||
self.buffer.push_str(
|
||||
format!(
|
||||
"fn {}(result_object: &ResultObject, vm_context: &VmCtx) {{
|
||||
println!(\"Executing function {{}}\", \"{}\");
|
||||
let func_index = match result_object.module.info.exports.get({:?}) {{
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!(\"Function not found\"),
|
||||
}};
|
||||
let invoke_fn: fn({}){} = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn({});
|
||||
{}
|
||||
}}\n",
|
||||
func_name,
|
||||
func_name,
|
||||
field,
|
||||
args_types.join(", "),
|
||||
func_return,
|
||||
args_values.join(", "),
|
||||
assertion,
|
||||
)
|
||||
.as_str(),
|
||||
);
|
||||
self.module_calls
|
||||
.entry(self.last_module)
|
||||
.or_insert(Vec::new())
|
||||
.push(func_name);
|
||||
// let mut module_calls = self.module_calls.get(&self.last_module).unwrap();
|
||||
// module_calls.push(func_name);
|
||||
}
|
||||
_ => {}
|
||||
};
|
||||
}
|
||||
|
||||
fn visit_assert_malformed(&mut self, module: &ModuleBinary) {
|
||||
let wasm_binary: Vec<u8> = module.clone().into_vec();
|
||||
// let wast_string = wasm2wat(wasm_binary).expect("Can't convert back to wasm");
|
||||
@ -393,10 +497,10 @@ fn {}_assert_malformed() {{
|
||||
self.visit_assert_return(action, expected)
|
||||
}
|
||||
CommandKind::AssertReturnCanonicalNan { action } => {
|
||||
// Do nothing for now
|
||||
self.visit_assert_return_canonical_nan(action);
|
||||
}
|
||||
CommandKind::AssertReturnArithmeticNan { action } => {
|
||||
// Do nothing for now
|
||||
self.visit_assert_return_arithmetic_nan(action);
|
||||
}
|
||||
CommandKind::AssertTrap { action, message: _ } => {
|
||||
// Do nothing for now
|
||||
|
@ -15,3 +15,54 @@ pub fn spectest_importobject<'a, 'b>() -> ImportObject<&'a str, &'b str> {
|
||||
import_object.set("spectest", "global_i32", GLOBAL_I32 as *const u8);
|
||||
return import_object;
|
||||
}
|
||||
|
||||
/// Bit pattern of an f32 value:
|
||||
/// 1-bit sign + 8-bit mantissa + 23-bit exponent = 32 bits
|
||||
///
|
||||
/// Bit pattern of an f64 value:
|
||||
/// 1-bit sign + 11-bit mantissa + 52-bit exponent = 64 bits
|
||||
///
|
||||
/// NOTE: On some old platforms (PA-RISC, some MIPS) quiet NaNs (qNaN) have
|
||||
/// their mantissa MSB unset and set for signaling NaNs (sNaN).
|
||||
///
|
||||
/// Links:
|
||||
/// * https://en.wikipedia.org/wiki/Floating-point_arithmetic
|
||||
/// * https://github.com/WebAssembly/spec/issues/286
|
||||
/// * https://en.wikipedia.org/wiki/NaN
|
||||
///
|
||||
pub trait NaNCheck {
|
||||
fn is_quiet_nan(&self) -> bool;
|
||||
fn is_canonical_nan(&self) -> bool;
|
||||
}
|
||||
|
||||
impl NaNCheck for f32 {
|
||||
/// The MSB of the mantissa must be set for a NaN to be a quiet NaN.
|
||||
fn is_quiet_nan(&self) -> bool {
|
||||
let bit_mask = (0b1 << 22); // Used to check if 23rd bit is set, which is MSB of the mantissa
|
||||
self.is_nan() && (self.to_bits() & bit_mask) == bit_mask
|
||||
}
|
||||
|
||||
/// For a NaN to be canonical, its mantissa bits must all be set,
|
||||
/// only the MSB is disregarded. (i.e we don't care if the MSB of the mantissa is set or not)
|
||||
fn is_canonical_nan(&self) -> bool {
|
||||
let bit_mask = 0b0____1111_1111____011_1111_1111_1111_1111_1111;
|
||||
(self.to_bits() & bit_mask) == bit_mask
|
||||
}
|
||||
}
|
||||
|
||||
impl NaNCheck for f64 {
|
||||
/// The MSB of the mantissa must be set for a NaN to be a quiet NaN.
|
||||
fn is_quiet_nan(&self) -> bool {
|
||||
let bit_mask = (0b1 << 51); // Used to check if 51st bit is set, which is MSB of the mantissa
|
||||
self.is_nan() && (self.to_bits() & bit_mask) == bit_mask
|
||||
}
|
||||
|
||||
/// For a NaN to be canonical, its mantissa bits must all be set,
|
||||
/// only the MSB is disregarded. (i.e we don't care if the MSB of the mantissa is set or not)
|
||||
fn is_canonical_nan(&self) -> bool {
|
||||
// 0b0____111_1111_1111____0111_1111_1111_1111 ... 1111
|
||||
let bit_mask = 0x7FF7FFFFFFFFFFFF;
|
||||
(self.to_bits() & bit_mask) == bit_mask
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
@ -2957,12 +2959,52 @@ fn c291_l346_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
}
|
||||
|
||||
// Line 347
|
||||
fn c292_l347_assert_return_canonical_nan(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
println!("Executing function {}", "c292_l347_assert_return_canonical_nan");
|
||||
let func_index = match result_object.module.info.exports.get("f64.promote_f32") {
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!("Function not found"),
|
||||
};
|
||||
let invoke_fn: fn(f32, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn(f32::from_bits(2143289344), &vm_context);
|
||||
assert!(result.is_quiet_nan())
|
||||
}
|
||||
|
||||
// Line 348
|
||||
fn c293_l348_assert_return_arithmetic_nan(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
println!("Executing function {}", "c293_l348_assert_return_arithmetic_nan");
|
||||
let func_index = match result_object.module.info.exports.get("f64.promote_f32") {
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!("Function not found"),
|
||||
};
|
||||
let invoke_fn: fn(f32, &VmCtx) -> f32 = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn(f32::from_bits(2141192192), &vm_context);
|
||||
assert!(result.is_quiet_nan())
|
||||
}
|
||||
|
||||
// Line 349
|
||||
fn c294_l349_assert_return_canonical_nan(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
println!("Executing function {}", "c294_l349_assert_return_canonical_nan");
|
||||
let func_index = match result_object.module.info.exports.get("f64.promote_f32") {
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!("Function not found"),
|
||||
};
|
||||
let invoke_fn: fn(f32, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn(f32::from_bits(4290772992), &vm_context);
|
||||
assert!(result.is_quiet_nan())
|
||||
}
|
||||
|
||||
// Line 350
|
||||
fn c295_l350_assert_return_arithmetic_nan(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
println!("Executing function {}", "c295_l350_assert_return_arithmetic_nan");
|
||||
let func_index = match result_object.module.info.exports.get("f64.promote_f32") {
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!("Function not found"),
|
||||
};
|
||||
let invoke_fn: fn(f32, &VmCtx) -> f32 = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn(f32::from_bits(4288675840), &vm_context);
|
||||
assert!(result.is_quiet_nan())
|
||||
}
|
||||
|
||||
// Line 352
|
||||
fn c296_l352_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
@ -3469,12 +3511,52 @@ fn c337_l393_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
}
|
||||
|
||||
// Line 394
|
||||
fn c338_l394_assert_return_canonical_nan(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
println!("Executing function {}", "c338_l394_assert_return_canonical_nan");
|
||||
let func_index = match result_object.module.info.exports.get("f32.demote_f64") {
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!("Function not found"),
|
||||
};
|
||||
let invoke_fn: fn(f64, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn(f64::from_bits(9221120237041090560), &vm_context);
|
||||
assert!(result.is_quiet_nan())
|
||||
}
|
||||
|
||||
// Line 395
|
||||
fn c339_l395_assert_return_arithmetic_nan(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
println!("Executing function {}", "c339_l395_assert_return_arithmetic_nan");
|
||||
let func_index = match result_object.module.info.exports.get("f32.demote_f64") {
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!("Function not found"),
|
||||
};
|
||||
let invoke_fn: fn(f64, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn(f64::from_bits(9219994337134247936), &vm_context);
|
||||
assert!(result.is_quiet_nan())
|
||||
}
|
||||
|
||||
// Line 396
|
||||
fn c340_l396_assert_return_canonical_nan(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
println!("Executing function {}", "c340_l396_assert_return_canonical_nan");
|
||||
let func_index = match result_object.module.info.exports.get("f32.demote_f64") {
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!("Function not found"),
|
||||
};
|
||||
let invoke_fn: fn(f64, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn(f64::from_bits(18444492273895866368), &vm_context);
|
||||
assert!(result.is_quiet_nan())
|
||||
}
|
||||
|
||||
// Line 397
|
||||
fn c341_l397_assert_return_arithmetic_nan(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
println!("Executing function {}", "c341_l397_assert_return_arithmetic_nan");
|
||||
let func_index = match result_object.module.info.exports.get("f32.demote_f64") {
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!("Function not found"),
|
||||
};
|
||||
let invoke_fn: fn(f64, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn(f64::from_bits(18443366373989023744), &vm_context);
|
||||
assert!(result.is_quiet_nan())
|
||||
}
|
||||
|
||||
// Line 398
|
||||
fn c342_l398_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
@ -4436,6 +4518,10 @@ fn test_module_1() {
|
||||
c289_l344_action_invoke(&result_object, &vm_context);
|
||||
c290_l345_action_invoke(&result_object, &vm_context);
|
||||
c291_l346_action_invoke(&result_object, &vm_context);
|
||||
c292_l347_assert_return_canonical_nan(&result_object, &vm_context);
|
||||
c293_l348_assert_return_arithmetic_nan(&result_object, &vm_context);
|
||||
c294_l349_assert_return_canonical_nan(&result_object, &vm_context);
|
||||
c295_l350_assert_return_arithmetic_nan(&result_object, &vm_context);
|
||||
c296_l352_action_invoke(&result_object, &vm_context);
|
||||
c297_l353_action_invoke(&result_object, &vm_context);
|
||||
c298_l354_action_invoke(&result_object, &vm_context);
|
||||
@ -4478,6 +4564,10 @@ fn test_module_1() {
|
||||
c335_l391_action_invoke(&result_object, &vm_context);
|
||||
c336_l392_action_invoke(&result_object, &vm_context);
|
||||
c337_l393_action_invoke(&result_object, &vm_context);
|
||||
c338_l394_assert_return_canonical_nan(&result_object, &vm_context);
|
||||
c339_l395_assert_return_arithmetic_nan(&result_object, &vm_context);
|
||||
c340_l396_assert_return_canonical_nan(&result_object, &vm_context);
|
||||
c341_l397_assert_return_arithmetic_nan(&result_object, &vm_context);
|
||||
c342_l398_action_invoke(&result_object, &vm_context);
|
||||
c343_l399_action_invoke(&result_object, &vm_context);
|
||||
c344_l400_action_invoke(&result_object, &vm_context);
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
10027
src/spectests/f32_.rs
10027
src/spectests/f32_.rs
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
10027
src/spectests/f64_.rs
10027
src/spectests/f64_.rs
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
@ -4557,6 +4559,16 @@ fn c367_l569_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
}
|
||||
|
||||
// Line 572
|
||||
fn c368_l572_assert_return_canonical_nan(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
println!("Executing function {}", "c368_l572_assert_return_canonical_nan");
|
||||
let func_index = match result_object.module.info.exports.get("f64.sqrt") {
|
||||
Some(&Export::Function(index)) => index,
|
||||
_ => panic!("Function not found"),
|
||||
};
|
||||
let invoke_fn: fn(f64, &VmCtx) -> f64 = get_instance_function!(result_object.instance, func_index);
|
||||
let result = invoke_fn(-0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000015535152663257847 as f64, &vm_context);
|
||||
assert!(result.is_quiet_nan())
|
||||
}
|
||||
|
||||
// Line 573
|
||||
fn c369_l573_action_invoke(result_object: &ResultObject, vm_context: &VmCtx) {
|
||||
@ -5811,6 +5823,7 @@ fn test_module_1() {
|
||||
c365_l567_action_invoke(&result_object, &vm_context);
|
||||
c366_l568_action_invoke(&result_object, &vm_context);
|
||||
c367_l569_action_invoke(&result_object, &vm_context);
|
||||
c368_l572_assert_return_canonical_nan(&result_object, &vm_context);
|
||||
c369_l573_action_invoke(&result_object, &vm_context);
|
||||
c370_l574_action_invoke(&result_object, &vm_context);
|
||||
c371_l575_action_invoke(&result_object, &vm_context);
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
@ -6,8 +6,10 @@
|
||||
dead_code
|
||||
)]
|
||||
use crate::webassembly::{instantiate, compile, ImportObject, ResultObject, VmCtx, Export};
|
||||
use super::_common::spectest_importobject;
|
||||
use std::{f32, f64};
|
||||
use super::_common::{
|
||||
spectest_importobject,
|
||||
NaNCheck,
|
||||
};
|
||||
use wabt::wat2wasm;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user