[clang] [llvm] [RISCV][P-ext] Support Packed Multiply High Parts (PR #225015)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 00:53:36 PDT 2026


================
@@ -12372,6 +12369,84 @@ static unsigned getRVPMulHighAccumulateOpcode(unsigned IntNo) {
   }
 }
 
+/// Return the multiply-high-parts node for a multiply-high-parts intrinsic.
+/// The scalar spelling maps to the same node; its product is the first
+/// element.
+static unsigned getRVPMulHighPartsOpcode(unsigned IntNo) {
+  switch (IntNo) {
+  default:
+    llvm_unreachable("Unexpected RISC-V multiply-high-parts intrinsic");
+  case Intrinsic::riscv_pmulh_b0:
+    return RISCVISD::PMULH_H_B0;
+  case Intrinsic::riscv_pmulh_b1:
+    return RISCVISD::PMULH_H_B1;
+  case Intrinsic::riscv_pmulhsu_b0:
+    return RISCVISD::PMULHSU_H_B0;
+  case Intrinsic::riscv_pmulhsu_b1:
+    return RISCVISD::PMULHSU_H_B1;
+  }
+}
+
+/// Return the word multiply-high-parts node for a word multiply-high-parts
+/// intrinsic. The scalar spelling maps to the same node; its product is the
+/// first element.
+static unsigned getRVPMulHighPartsWOpcode(unsigned IntNo) {
+  switch (IntNo) {
+  default:
+    llvm_unreachable("Unexpected RISC-V word multiply-high-parts intrinsic");
+  case Intrinsic::riscv_pmulh_h0:
+  case Intrinsic::riscv_mulh_h0:
+    return RISCVISD::PMULH_W_H0;
+  case Intrinsic::riscv_pmulh_h1:
+  case Intrinsic::riscv_mulh_h1:
+    return RISCVISD::PMULH_W_H1;
+  case Intrinsic::riscv_pmulhsu_h0:
+  case Intrinsic::riscv_mulhsu_h0:
+    return RISCVISD::PMULHSU_W_H0;
+  case Intrinsic::riscv_pmulhsu_h1:
+  case Intrinsic::riscv_mulhsu_h1:
+    return RISCVISD::PMULHSU_W_H1;
+  }
+}
+
+/// Return the scalar multiply-high-parts intrinsic computing the first
+/// product of packed intrinsic \p IntNo.
+static Intrinsic::ID getRVPScalarMulHighPartsIntrinsic(unsigned IntNo) {
+  switch (IntNo) {
+  default:
+    llvm_unreachable("Unexpected RISC-V packed multiply-high-parts intrinsic");
+  case Intrinsic::riscv_pmulh_b0:
----------------
TelGome wrote:

Done, the helper is gone entirely now.

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


More information about the llvm-commits mailing list