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

@@ -1115,6 +1115,8 @@ pub enum SseOpcode {
Unpcklps,
Xorps,
Xorpd,
Phaddw,
Phaddd,
}
impl SseOpcode {
@@ -1261,7 +1263,9 @@ impl SseOpcode {
| SseOpcode::Pabsd
| SseOpcode::Palignr
| SseOpcode::Pmulhrsw
| SseOpcode::Pshufb => SSSE3,
| SseOpcode::Pshufb
| SseOpcode::Phaddw
| SseOpcode::Phaddd => SSSE3,
SseOpcode::Blendvpd
| SseOpcode::Blendvps
@@ -1495,6 +1499,8 @@ impl fmt::Debug for SseOpcode {
SseOpcode::Unpcklps => "unpcklps",
SseOpcode::Xorps => "xorps",
SseOpcode::Xorpd => "xorpd",
SseOpcode::Phaddw => "phaddw",
SseOpcode::Phaddd => "phaddd",
};
write!(fmt, "{}", name)
}
@@ -1661,7 +1667,9 @@ impl AvxOpcode {
| AvxOpcode::Vcvtpd2ps
| AvxOpcode::Vcvtps2pd
| AvxOpcode::Vcvttpd2dq
| AvxOpcode::Vcvttps2dq => {
| AvxOpcode::Vcvttps2dq
| AvxOpcode::Vphaddw
| AvxOpcode::Vphaddd => {
smallvec![InstructionSet::AVX]
}
}