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

@@ -860,7 +860,10 @@
Ucomisd
Unpcklps
Xorps
Xorpd))
Xorpd
Phaddw
Phaddd
))
(type CmpOpcode extern
(enum Cmp
@@ -1356,6 +1359,8 @@
Vcvtps2pd
Vcvttpd2dq
Vcvttps2dq
Vphaddw
Vphaddd
))
(type Avx512Opcode extern
@@ -2482,6 +2487,22 @@
(if-let $true (has_avx))
(xmm_rmir_vex (AvxOpcode.Vpaddsw) src1 src2))
;; Helper for creating `phaddw` instructions.
(decl x64_phaddw (Xmm XmmMem) Xmm)
(rule 0 (x64_phaddw src1 src2)
(xmm_rm_r (SseOpcode.Phaddw) src1 src2))
(rule 1 (x64_phaddw src1 src2)
(if-let $true (has_avx))
(xmm_rmir_vex (AvxOpcode.Vphaddw) src1 src2))
;; Helper for creating `phaddd` instructions.
(decl x64_phaddd (Xmm XmmMem) Xmm)
(rule 0 (x64_phaddd src1 src2)
(xmm_rm_r (SseOpcode.Phaddd) src1 src2))
(rule 1 (x64_phaddd src1 src2)
(if-let $true (has_avx))
(xmm_rmir_vex (AvxOpcode.Vphaddd) src1 src2))
;; Helper for creating `paddusb` instructions.
(decl x64_paddusb (Xmm XmmMem) Xmm)
(rule 0 (x64_paddusb src1 src2)