Use andn for band_not when bmi1 is present (#5701)
We can use the andn instruction for the lowering of band_not on x64 when bmi1 is available.
This commit is contained in:
@@ -745,7 +745,7 @@ impl PrettyPrint for RegMem {
|
||||
}
|
||||
}
|
||||
|
||||
/// Some basic ALU operations. TODO: maybe add Adc, Sbb.
|
||||
/// Some basic ALU operations.
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub enum AluRmiROpcode {
|
||||
/// Add operation.
|
||||
@@ -788,6 +788,36 @@ impl fmt::Display for AluRmiROpcode {
|
||||
}
|
||||
}
|
||||
|
||||
/// ALU operations that don't accept intermediates.
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub enum AluRmROpcode {
|
||||
/// And with negated second operand.
|
||||
Andn,
|
||||
}
|
||||
|
||||
impl AluRmROpcode {
|
||||
pub(crate) fn available_from(&self) -> SmallVec<[InstructionSet; 2]> {
|
||||
match self {
|
||||
AluRmROpcode::Andn => smallvec![InstructionSet::BMI1],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for AluRmROpcode {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
let name = match self {
|
||||
AluRmROpcode::Andn => "andn",
|
||||
};
|
||||
write!(fmt, "{}", name)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for AluRmROpcode {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fmt::Debug::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq)]
|
||||
/// Unary operations requiring register or memory and register operands.
|
||||
pub enum UnaryRmROpcode {
|
||||
|
||||
Reference in New Issue
Block a user