cranelift: Implement float rounding operations (#4397)

Implements the following operations on the interpreter:
* `ceil`
* `floor`
* `nearest`
* `trunc`
This commit is contained in:
Afonso Bordado
2022-07-07 00:43:54 +01:00
committed by GitHub
parent 9575ed4eb7
commit f98076ae88
7 changed files with 540 additions and 4 deletions

View File

@@ -728,10 +728,10 @@ where
(a, b) if a.is_zero()? && b.is_zero()? => a,
(a, b) => a.max(b)?,
}),
Opcode::Ceil => unimplemented!("Ceil"),
Opcode::Floor => unimplemented!("Floor"),
Opcode::Trunc => unimplemented!("Trunc"),
Opcode::Nearest => unimplemented!("Nearest"),
Opcode::Ceil => assign(Value::ceil(arg(0)?)?),
Opcode::Floor => assign(Value::floor(arg(0)?)?),
Opcode::Trunc => assign(Value::trunc(arg(0)?)?),
Opcode::Nearest => assign(Value::nearest(arg(0)?)?),
Opcode::IsNull => unimplemented!("IsNull"),
Opcode::IsInvalid => unimplemented!("IsInvalid"),
Opcode::Trueif => choose(