cranelift: Implement sqrt in interpreter (#4362)

This ignores SIMD for now.
This commit is contained in:
Afonso Bordado
2022-07-01 17:39:11 +01:00
committed by GitHub
parent 38ecd3744f
commit f2e6ff5e70
4 changed files with 115 additions and 1 deletions

View File

@@ -763,6 +763,11 @@ impl Ieee32 {
pub fn is_nan(&self) -> bool {
f32::from_bits(self.0).is_nan()
}
/// Returns the square root of self.
pub fn sqrt(self) -> Self {
Self::with_float(f32::from_bits(self.0).sqrt())
}
}
impl PartialOrd for Ieee32 {
@@ -848,6 +853,11 @@ impl Ieee64 {
pub fn is_nan(&self) -> bool {
f64::from_bits(self.0).is_nan()
}
/// Returns the square root of self.
pub fn sqrt(self) -> Self {
Self::with_float(f64::from_bits(self.0).sqrt())
}
}
impl PartialOrd for Ieee64 {