[llvm] [AArch64][SVE] Detect MOV (imm, pred, zeroing/merging) (PR #116032)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 13 07:33:44 PST 2024


================
@@ -892,6 +892,26 @@ let Predicates = [HasSVEorSME] in {
   def : Pat<(nxv2i64 (splat_vector (i64 (SVECpyDupImm64Pat i32:$a, i32:$b)))),
             (DUP_ZI_D $a, $b)>;
 
+  // Duplicate Int immediate to active vector elements (zeroing).
+  def : Pat<(nxv16i8 (AArch64dup_mt PPR:$pg, (i32 (SVECpyDupImm8Pat i32:$a, i32:$b)), (SVEDup0Undef))),
+            (CPY_ZPzI_B $pg, $a, $b)>;
+  def : Pat<(nxv8i16 (AArch64dup_mt PPR:$pg, (i32 (SVECpyDupImm16Pat i32:$a, i32:$b)), (SVEDup0Undef))),
+            (CPY_ZPzI_H $pg, $a, $b)>;
+  def : Pat<(nxv4i32 (AArch64dup_mt PPR:$pg, (i32 (SVECpyDupImm32Pat i32:$a, i32:$b)), (SVEDup0Undef))),
+            (CPY_ZPzI_S $pg, $a, $b)>;
+  def : Pat<(nxv2i64 (AArch64dup_mt PPR:$pg, (i64 (SVECpyDupImm64Pat i32:$a, i32:$b)), (SVEDup0Undef))),
+            (CPY_ZPzI_D $pg, $a, $b)>;
----------------
paulwalker-arm wrote:

Can these be pushed into `sve_int_dup_imm_pred_merge` in the same way as we do for `sve_int_perm_cpy_r`?

I think you want `SVEDup0` rather than `SVEDup0Undef` because for the "inserting into undef" case we'd rather emit  `DUP` instructions to remove the need for the predicate register.


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


More information about the llvm-commits mailing list