aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Sherwood <david.sherwood@arm.com>2022-11-07 17:22:54 +0000
committerDavid Sherwood <david.sherwood@arm.com>2022-11-08 10:24:31 +0000
commit8f60eee9144cd4178938d231ecccb65c43f78cde (patch)
treebb3a6636d64ce0d1331a776d2f01aaa7fb2aa5a7 /llvm/lib
parenteee5c3859e78488246126a568a94f697c4f924ba (diff)
downloadllvm-8f60eee9144cd4178938d231ecccb65c43f78cde.zip
llvm-8f60eee9144cd4178938d231ecccb65c43f78cde.tar.gz
llvm-8f60eee9144cd4178938d231ecccb65c43f78cde.tar.bz2
[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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/AArch64/AArch64SVEInstrInfo.td5
-rw-r--r--llvm/lib/Target/AArch64/SVEInstrFormats.td54
2 files changed, 58 insertions, 1 deletions
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<bits<3> 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<bits<5> 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<string mnemonic> {
+ 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<string mnemonic>
+ : 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;
+}