[clang] [llvm] [RISCV][P-ext] Support Packed Narrowing Zip (PR #210040)

Craig Topper via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 16 22:06:11 PDT 2026


================
@@ -2838,6 +2852,17 @@ let append Predicates = [IsRV64] in {
             (ZIP8P GPR:$rs1, GPR:$rs2)>;
   def : Pat<(v4i16 (riscv_pzip (v4i16 GPR:$rs1), (v4i16 GPR:$rs2))),
             (ZIP16P GPR:$rs1, GPR:$rs2)>;
+
+  // Packed narrowing zip: pair the low (even) / high (odd) byte/halfword of
+  // each widened element of rs1 and rs2.
+  def : Pat<(v8i8 (riscv_ppaire (v8i8 GPR:$rs1), (v8i8 GPR:$rs2))),
+            (PPAIRE_B GPR:$rs1, GPR:$rs2)>;
+  def : Pat<(v8i8 (riscv_ppairo (v8i8 GPR:$rs1), (v8i8 GPR:$rs2))),
+            (PPAIRO_B GPR:$rs1, GPR:$rs2)>;
+  def : Pat<(v4i16 (riscv_ppaire (v4i16 GPR:$rs1), (v4i16 GPR:$rs2))),
+            (PPAIRE_H GPR:$rs1, GPR:$rs2)>;
+  def : Pat<(v4i16 (riscv_ppairo (v4i16 GPR:$rs1), (v4i16 GPR:$rs2))),
+            (PPAIRO_H GPR:$rs1, GPR:$rs2)>;
----------------
topperc wrote:

```suggestion
            (PPAIRO_H GPR:$rs1, GPR:$rs2)>;

```

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


More information about the cfe-commits mailing list