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:
Trevor Elliott
2023-02-03 16:23:18 -08:00
committed by GitHub
parent 0ba1448fa4
commit 6d8f2be9e1
7 changed files with 141 additions and 3 deletions

View File

@@ -283,6 +283,40 @@ pub(crate) fn emit(
);
}
Inst::AluRmRVex {
size,
op,
dst,
src1,
src2,
} => {
use AluRmROpcode::*;
let dst = allocs.next(dst.to_reg().to_reg());
let src1 = allocs.next(src1.to_reg());
let src2 = allocs.next(src2.to_reg());
let w = match size {
OperandSize::Size32 => false,
OperandSize::Size64 => true,
// the other cases would be rejected by isle constructors
_ => unreachable!(),
};
let opcode = match op {
Andn => 0xf2,
};
VexInstruction::new()
.map(OpcodeMap::_0F38)
.w(w)
.reg(dst.to_real_reg().unwrap().hw_enc())
.vvvv(src1.to_real_reg().unwrap().hw_enc())
.rm(src2.to_real_reg().unwrap().hw_enc())
.opcode(opcode)
.encode(sink);
}
Inst::UnaryRmR { size, op, src, dst } => {
let dst = allocs.next(dst.to_reg().to_reg());
let rex_flags = RexFlags::from(*size);