[clang] [llvm] [Clang][LLVM][AArch64] Add intrinsic for MOVT SME2 instruction (PR #97602)

Momchil Velikov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 03:26:49 PDT 2024


================
@@ -3278,10 +3278,50 @@ class sme2_movt_zt_to_zt<string mnemonic, bits<7> opc>
   let Inst{4-0}   = Zt;
 }
 
-multiclass sme2_movt_zt_to_zt<string mnemonic, bits<7> opc> {
+multiclass sme2_movt_zt_to_zt<string mnemonic, bits<7> opc, SDPatternOperator intrinsic_lane, SDPatternOperator intrinsic> {
   def NAME : sme2_movt_zt_to_zt<mnemonic, opc>;
+  def NAME # _PSEUDO
+      : Pseudo<(outs), (ins ZTR:$ZT, sme_elm_idx0_3:$off2, ZPRAny:$Zt), []>, Sched<[]> {
+    let usesCustomInserter = 1;
+  }
   def : InstAlias<mnemonic # "\t$ZTt, $Zt",
                  (!cast<Instruction>(NAME) ZTR:$ZTt, 0, ZPRAny:$Zt), 1>;
+
+  def : Pat<(intrinsic_lane (imm_to_zt untyped:$zt), nxv16i8:$zn, sme_elm_idx0_3:$imm),
----------------
momchil-velikov wrote:

You could make this quite a bit easier to read and modify with a loop:
```
  foreach vt = [nxv16i8, nxv8i16, nxv4i32, nxv2i64, nxv8f16, nxv4f32, nxv2f64, nxv8bf16] in {
    def : Pat<(intrinsic_lane (imm_to_zt untyped:$zt), vt:$zn, sme_elm_idx0_3:$imm),
              (!cast<Instruction>(NAME # _PSEUDO) $zt, $imm, $zn)>;
    def : Pat<(intrinsic (imm_to_zt untyped:$zt), vt:$zn),
              (!cast<Instruction>(NAME # _PSEUDO) $zt, 0, $zn)>;
  }
```


https://github.com/llvm/llvm-project/pull/97602


More information about the llvm-commits mailing list