Move insertlane to ISLE (#3544)

This also fixes a bug where `movsd` was incorrectly used with a memory
operand for `insertlane`, causing it to actually zero the upper bits
instead of preserving them.

Note that the insertlane logic still exists in `lower.rs` because it's
used as a helper for a few other instruction lowerings which aren't
migrated to ISLE yet. This commit also adds a helper in ISLE itself for
those other lowerings to use when they get implemented.

Closes #3216
This commit is contained in:
Alex Crichton
2021-11-18 13:48:11 -06:00
committed by GitHub
parent 4c75616a7c
commit 352ee2b186
11 changed files with 322 additions and 20 deletions

View File

@@ -1115,3 +1115,33 @@
(let ((dst WritableReg (temp_writable_reg ty))
(_ Unit (emit (MInst.GprToXmm op src dst size))))
(writable_reg_to_reg dst)))
;; Helper for creating `pinsrb` instructions.
(decl pinsrb (Reg RegMem u8) Reg)
(rule (pinsrb src1 src2 lane)
(xmm_rm_r_imm (SseOpcode.Pinsrb) src1 src2 lane (OperandSize.Size32)))
;; Helper for creating `pinsrw` instructions.
(decl pinsrw (Reg RegMem u8) Reg)
(rule (pinsrw src1 src2 lane)
(xmm_rm_r_imm (SseOpcode.Pinsrw) src1 src2 lane (OperandSize.Size32)))
;; Helper for creating `pinsrd` instructions.
(decl pinsrd (Reg RegMem u8 OperandSize) Reg)
(rule (pinsrd src1 src2 lane size)
(xmm_rm_r_imm (SseOpcode.Pinsrd) src1 src2 lane size))
;; Helper for creating `insertps` instructions.
(decl insertps (Reg RegMem u8) Reg)
(rule (insertps src1 src2 lane)
(xmm_rm_r_imm (SseOpcode.Insertps) src1 src2 lane (OperandSize.Size32)))
;; Helper for creating `movsd` instructions.
(decl movsd (Reg RegMem) Reg)
(rule (movsd src1 src2)
(xmm_rm_r $I8X16 (SseOpcode.Movsd) src1 src2))
;; Helper for creating `movlhps` instructions.
(decl movlhps (Reg RegMem) Reg)
(rule (movlhps src1 src2)
(xmm_rm_r $I8X16 (SseOpcode.Movlhps) src1 src2))