[llvm] [RISCV] Split VFWREDUSUM and VFWREDOSUM pseudos (PR #65386)

Michael Maitland via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 10:05:42 PDT 2023


https://github.com/michaelmaitland created https://github.com/llvm/llvm-project/pull/65386:

WriteVFWRedOV_From and WriteVFWRedV_From SchedWrite classes exist already, but no pseudos were using the ordered SchedWrite. This change makes it so that the VFWREDOSUM pseudo used the ordered VFW SchedWrite.

>From 09e03f7bd38be90c9adc57408197405fcd97a330 Mon Sep 17 00:00:00 2001
From: Michael Maitland <michaeltmaitland at gmail.com>
Date: Tue, 5 Sep 2023 09:56:06 -0700
Subject: [PATCH] [RISCV] Split VFWREDUSUM and VFWREDOSUM pseudos

WriteVFWRedOV_From and WriteVFWRedV_From SchedWrite classes exist
already, but no pseudos were using the ordered SchedWrite. This change makes it
so that the VFWREDOSUM pseudo used the ordered VFW SchedWrite.
---
 llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index cc9948908537a23..c3f2f1035bb7471 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -3518,6 +3518,18 @@ multiclass VPseudoVFWRED_VS_RM {
   }
 }
 
+multiclass VPseudoVFWREDO_VS_RM {
+  foreach m = MxListFWRed in {
+    defvar mx = m.MX;
+    foreach e = SchedSEWSet<mx, isF=1, isWidening=1>.val in {
+      defm _VS
+          : VPseudoTernaryWithTailPolicyRoundingMode<V_M1.vrclass, m.vrclass,
+                                                     V_M1.vrclass, m, e>,
+            SchedReduction<"WriteVFWRedOV_From", "ReadVFWRedV", mx, e>;
+    }
+  }
+}
+
 multiclass VPseudoConversion<VReg RetClass,
                              VReg Op1Class,
                              LMULInfo MInfo,
@@ -6601,7 +6613,7 @@ let IsRVVWideningReduction = 1,
     hasSideEffects = 0,
     mayRaiseFPException = true in {
 defm PseudoVFWREDUSUM  : VPseudoVFWRED_VS_RM;
-defm PseudoVFWREDOSUM  : VPseudoVFWRED_VS_RM;
+defm PseudoVFWREDOSUM  : VPseudoVFWREDO_VS_RM;
 }
 
 } // Predicates = [HasVInstructionsAnyF]



More information about the llvm-commits mailing list