mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-29 16:41:33 +00:00
Added f64 spectest
This commit is contained in:
2518
spectests/f64_.wast
Normal file
2518
spectests/f64_.wast
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,7 +15,7 @@ static ENV_VAR: &str = "WASM_GENERATE_SPECTESTS";
|
||||
static BANNER: &str = "// Rust test file autogenerated with cargo build (src/build_spectests.rs).
|
||||
// Please do NOT modify it by hand, as it will be reseted on next build.\n";
|
||||
|
||||
const TESTS: [&str; 18] = [
|
||||
const TESTS: [&str; 19] = [
|
||||
"spectests/block.wast",
|
||||
"spectests/br.wast",
|
||||
"spectests/br_if.wast",
|
||||
@ -27,6 +27,7 @@ const TESTS: [&str; 18] = [
|
||||
"spectests/data.wast",
|
||||
"spectests/exports.wast",
|
||||
"spectests/f32_.wast",
|
||||
"spectests/f64_.wast",
|
||||
"spectests/func_ptrs.wast",
|
||||
"spectests/i32_.wast",
|
||||
"spectests/i64_.wast",
|
||||
@ -57,7 +58,14 @@ fn wabt2rust_value(v: &Value) -> String {
|
||||
_ => format!("{:?} as f32", v),
|
||||
}
|
||||
},
|
||||
Value::F64(v) => format!("{:?} as f64", v),
|
||||
Value::F64(v) => {
|
||||
match *v {
|
||||
std::f64::INFINITY => "std::f64::INFINITY".to_string(),
|
||||
std::f64::NEG_INFINITY => "std::f64::NEG_INFINITY".to_string(),
|
||||
std::f64::NAN => "std::f64::NAN".to_string(),
|
||||
_ => format!("{:?} as f64", v),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
22556
src/spectests/f64_.rs
Normal file
22556
src/spectests/f64_.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@ mod const_;
|
||||
mod data;
|
||||
mod exports;
|
||||
mod f32_;
|
||||
mod f64_;
|
||||
mod func_ptrs;
|
||||
mod i32_;
|
||||
mod i64_;
|
||||
|
@ -242,6 +242,18 @@ impl Instance {
|
||||
RelocationType::LibCall(LibCall::NearestF32) => {
|
||||
_nearbyintf32 as isize
|
||||
},
|
||||
RelocationType::LibCall(LibCall::CeilF64) => {
|
||||
_ceilf64 as isize
|
||||
},
|
||||
RelocationType::LibCall(LibCall::FloorF64) => {
|
||||
_floorf64 as isize
|
||||
},
|
||||
RelocationType::LibCall(LibCall::TruncF64) => {
|
||||
_truncf64 as isize
|
||||
},
|
||||
RelocationType::LibCall(LibCall::NearestF64) => {
|
||||
_nearbyintf64 as isize
|
||||
},
|
||||
_ => unimplemented!()
|
||||
// RelocationType::Intrinsic(name) => {
|
||||
// get_abi_intrinsic(name)?
|
||||
@ -649,8 +661,9 @@ extern "C" fn current_memory(memory_index: u32, vmctx: &VmCtx) -> u32 {
|
||||
// Because of this bug https://github.com/rust-lang/rust/issues/34123
|
||||
// We create internal functions for it
|
||||
|
||||
use std::intrinsics::{ceilf32, floorf32, truncf32, nearbyintf32};
|
||||
use std::intrinsics::{ceilf32, floorf32, truncf32, nearbyintf32, ceilf64, floorf64, truncf64, nearbyintf64};
|
||||
|
||||
// F32
|
||||
unsafe extern fn _ceilf32(x: f32) -> f32 {
|
||||
ceilf32(x)
|
||||
}
|
||||
@ -666,3 +679,20 @@ unsafe extern fn _truncf32(x: f32) -> f32 {
|
||||
unsafe extern fn _nearbyintf32(x: f32) -> f32 {
|
||||
nearbyintf32(x)
|
||||
}
|
||||
|
||||
// F64
|
||||
unsafe extern fn _ceilf64(x: f64) -> f64 {
|
||||
ceilf64(x)
|
||||
}
|
||||
|
||||
unsafe extern fn _floorf64(x: f64) -> f64 {
|
||||
floorf64(x)
|
||||
}
|
||||
|
||||
unsafe extern fn _truncf64(x: f64) -> f64 {
|
||||
truncf64(x)
|
||||
}
|
||||
|
||||
unsafe extern fn _nearbyintf64(x: f64) -> f64 {
|
||||
nearbyintf64(x)
|
||||
}
|
||||
|
Reference in New Issue
Block a user