x64: Add support for phadd{w,d} instructions (#5896)

This commit adds support for the bare lowering of the `iadd_pairwise`
instruction with `i16x8` and `i32x4` types on the x64 backend. These
lowerings are achieved with the `phaddw` and `phaddd` instructions,
respectively. Additionally AVX encodings of these instructions are added
too.

The motivation for these new lowerings comes from the relaxed-simd
proposal which will use them in the deterministic lowering of some
instructions on the x64 backend.
This commit is contained in:
Alex Crichton
2023-02-28 17:35:53 -06:00
committed by GitHub
parent 32cfd60877
commit e0ef0b7c72
6 changed files with 155 additions and 8 deletions

View File

@@ -1954,6 +1954,8 @@ pub(crate) fn emit(
SseOpcode::Unpcklps => (LegacyPrefixes::None, 0x0F14, 2),
SseOpcode::Xorps => (LegacyPrefixes::None, 0x0F57, 2),
SseOpcode::Xorpd => (LegacyPrefixes::_66, 0x0F57, 2),
SseOpcode::Phaddw => (LegacyPrefixes::_66, 0x0F3801, 3),
SseOpcode::Phaddd => (LegacyPrefixes::_66, 0x0F3802, 3),
_ => unimplemented!("Opcode {:?} not implemented", op),
};
@@ -2167,6 +2169,8 @@ pub(crate) fn emit(
AvxOpcode::Vminsd => (LP::_F2, OM::_0F, 0x5D),
AvxOpcode::Vmaxss => (LP::_F3, OM::_0F, 0x5F),
AvxOpcode::Vmaxsd => (LP::_F2, OM::_0F, 0x5F),
AvxOpcode::Vphaddw => (LP::_66, OM::_0F38, 0x01),
AvxOpcode::Vphaddd => (LP::_66, OM::_0F38, 0x02),
_ => panic!("unexpected rmir vex opcode {op:?}"),
};
VexInstruction::new()