x64: Migrate {s,u}{div,rem} to ISLE (#6008)
* x64: Add precise-output tests for div traps
This adds a suite of `*.clif` files which are intended to test the
`avoid_div_traps=true` compilation of the `{s,u}{div,rem}` instructions.
* x64: Remove conditional regalloc in `Div` instruction
Move the 8-bit `Div` logic into a dedicated `Div8` instruction to avoid
having conditionally-used registers with respect to regalloc.
* x64: Migrate non-trapping, `udiv`/`urem` to ISLE
* x64: Port checked `udiv` to ISLE
* x64: Migrate urem entirely to ISLE
* x64: Use `test` instead of `cmp` to compare-to-zero
* x64: Port `sdiv` lowering to ISLE
* x64: Port `srem` lowering to ISLE
* Tidy up regalloc behavior and fix tests
* Update docs and winch
* Review comments
* Reword again
* More refactoring test fixes
* More test fixes
This commit is contained in:
@@ -12,6 +12,8 @@ use smallvec::{smallvec, SmallVec};
|
||||
use std::fmt;
|
||||
use std::string::String;
|
||||
|
||||
pub use crate::isa::x64::lower::isle::generated_code::DivSignedness;
|
||||
|
||||
/// An extenstion trait for converting `Writable{Xmm,Gpr}` to `Writable<Reg>`.
|
||||
pub trait ToWritableReg {
|
||||
/// Convert `Writable{Xmm,Gpr}` to `Writable<Reg>`.
|
||||
@@ -1878,35 +1880,6 @@ impl fmt::Display for ShiftKind {
|
||||
}
|
||||
}
|
||||
|
||||
/// What kind of division or remainder instruction this is?
|
||||
#[derive(Clone, Eq, PartialEq)]
|
||||
pub enum DivOrRemKind {
|
||||
/// Signed division.
|
||||
SignedDiv,
|
||||
/// Unsigned division.
|
||||
UnsignedDiv,
|
||||
/// Signed remainder.
|
||||
SignedRem,
|
||||
/// Unsigned remainder.
|
||||
UnsignedRem,
|
||||
}
|
||||
|
||||
impl DivOrRemKind {
|
||||
pub(crate) fn is_signed(&self) -> bool {
|
||||
match self {
|
||||
DivOrRemKind::SignedDiv | DivOrRemKind::SignedRem => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn is_div(&self) -> bool {
|
||||
match self {
|
||||
DivOrRemKind::SignedDiv | DivOrRemKind::UnsignedDiv => true,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// These indicate condition code tests. Not all are represented since not all are useful in
|
||||
/// compiler-generated code.
|
||||
#[derive(Copy, Clone)]
|
||||
|
||||
Reference in New Issue
Block a user