winch: Add support for <i32|i64>.rem_* WebAssembly instructions (#5823)

This commit adds support for i32 and i64 remainder instructions for
x64.
This commit is contained in:
Saúl Cabrera
2023-02-20 12:52:06 -05:00
committed by GitHub
parent c26a65a854
commit 4d954f5c0e
25 changed files with 579 additions and 4 deletions

View File

@@ -13,6 +13,14 @@ pub(crate) enum DivKind {
Unsigned,
}
/// Remainder kind.
pub(crate) enum RemKind {
/// Signed remainder.
Signed,
/// Unsigned remainder.
Unsigned,
}
/// Operand size, in bits.
#[derive(Copy, Clone, Eq, PartialEq)]
pub(crate) enum OperandSize {
@@ -116,6 +124,9 @@ pub(crate) trait MacroAssembler {
/// functions.
fn div(&mut self, context: &mut CodeGenContext, kind: DivKind, size: OperandSize);
/// Calculate remainder.
fn rem(&mut self, context: &mut CodeGenContext, kind: RemKind, size: OperandSize);
/// Push the register to the stack, returning the offset.
fn push(&mut self, src: Reg) -> u32;