From 8f60eee9144cd4178938d231ecccb65c43f78cde Mon Sep 17 00:00:00 2001 From: David Sherwood Date: Mon, 7 Nov 2022 17:22:54 +0000 Subject: [AArch64][SVE2] Add the SVE2.1 dupq and extq instructions This patch adds the assembly/disassembly for the following instructions: dupq : Broadcast indexed element within each quadword vector segment (unpredicated) extq : Extract vector segment from each pair of quadword vector segments The reference can be found here: https://developer.arm.com/documentation/ddi0602/2022-09 Differential Revision: https://reviews.llvm.org/D137568 --- llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td | 5 ++- llvm/lib/Target/AArch64/SVEInstrFormats.td | 54 ++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td index c8d131a..32f1f7d 100644 --- a/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td +++ b/llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td @@ -3759,4 +3759,7 @@ defm FMAXNMQV : sve2p1_fp_reduction_q<0b100, "fmaxnmqv">; defm FMINNMQV : sve2p1_fp_reduction_q<0b101, "fminnmqv">; defm FMAXQV : sve2p1_fp_reduction_q<0b110, "fmaxqv">; defm FMINQV : sve2p1_fp_reduction_q<0b111, "fminqv">; -} + +defm DUPQ_ZZI : sve2p1_dupq<"dupq">; +def EXTQ_ZZI : sve2p1_extq<"extq">; +} // End HasSVE2p1_or_HasSME2p1 diff --git a/llvm/lib/Target/AArch64/SVEInstrFormats.td b/llvm/lib/Target/AArch64/SVEInstrFormats.td index c036db4..494eb04 100644 --- a/llvm/lib/Target/AArch64/SVEInstrFormats.td +++ b/llvm/lib/Target/AArch64/SVEInstrFormats.td @@ -9309,3 +9309,57 @@ multiclass sve2p1_fp_reduction_q opc, string mnemonic> { def _S : sve2p1_fp_reduction_q<0b10, opc, mnemonic, ZPR32, "4s">; def _D : sve2p1_fp_reduction_q<0b11, opc, mnemonic, ZPR64, "2d">; } + + +// SVE Permute Vector - Quadwords (DUPQ) +class sve2p1_dupq ind_tsz, string mnemonic, ZPRRegOp zprty, Operand itype> + : I<(outs zprty:$Zd), (ins zprty:$Zn, itype:$index), + mnemonic, "\t$Zd, $Zn$index", + "", []>, Sched<[]> { + bits<5> Zd; + bits<5> Zn; + let Inst{31-21} = 0b00000101001; + let Inst{20-16} = ind_tsz; + let Inst{15-10} = 0b001001; + let Inst{9-5} = Zn; + let Inst{4-0} = Zd; +} + +multiclass sve2p1_dupq { + def _B : sve2p1_dupq<{?, ?, ?, ?, 1}, mnemonic, ZPR8, VectorIndexB32b> { + bits<4> index; + let Inst{20-17} = index; + } + def _H : sve2p1_dupq<{?, ?, ?, 1, 0}, mnemonic, ZPR16, VectorIndexH32b> { + bits<3> index; + let Inst{20-18} = index; + } + def _S : sve2p1_dupq<{?, ?, 1, 0, 0}, mnemonic, ZPR32, VectorIndexS32b> { + bits<2> index; + let Inst{20-19} = index; + } + def _D : sve2p1_dupq<{?, 1, 0, 0, 0}, mnemonic, ZPR64, VectorIndexD32b> { + bits<1> index; + let Inst{20} = index; + } +} + + +// SVE Permute Vector - Quadwords (EXTQ) +class sve2p1_extq + : I<(outs ZPR8:$Zdn), (ins ZPR8:$_Zdn, ZPR8:$Zm, imm0_15:$imm4), + mnemonic, "\t$Zdn, $_Zdn, $Zm, $imm4", + "", []>, Sched<[]> { + bits<5> Zdn; + bits<5> Zm; + bits<4> imm4; + let Inst{31-20} = 0b000001010110; + let Inst{19-16} = imm4; + let Inst{15-10} = 0b001001; + let Inst{9-5} = Zm; + let Inst{4-0} = Zdn; + + let Constraints = "$Zdn = $_Zdn"; + let DestructiveInstType = DestructiveOther; + let ElementSize = ZPR8.ElementSize; +} -- cgit v1.1