[llvm] d634ec8 - [RISCV] Refactor where in the multiclass hierarchy we add commutable VFMADD/VFMACC instructions. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 10:44:57 PDT 2021


Author: Craig Topper
Date: 2021-07-16T10:41:09-07:00
New Revision: d634ec8d298b1a274987ca039be03e6b4c6dad80

URL: https://github.com/llvm/llvm-project/commit/d634ec8d298b1a274987ca039be03e6b4c6dad80
DIFF: https://github.com/llvm/llvm-project/commit/d634ec8d298b1a274987ca039be03e6b4c6dad80.diff

LOG: [RISCV] Refactor where in the multiclass hierarchy we add commutable VFMADD/VFMACC instructions. NFC

I'm preparing to add tail agnostic versions of VWMACC and VFWMACC
so this will make them more consistent.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
index 1a109e01a4b5..6d21d7f55bc5 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -1887,8 +1887,16 @@ multiclass VPseudoTernary<VReg RetClass,
 }
 
 multiclass VPseudoTernaryV_VV<string Constraint = ""> {
-  foreach m = MxList.m in
+  foreach m = MxList.m in {
     defm _VV : VPseudoTernary<m.vrclass, m.vrclass, m.vrclass, m, Constraint>;
+
+    // Add a commutable version for use by IR mul+add.
+    let isCommutable = 1, ForceTailAgnostic = true, VLMul = m.value in
+    def "_VV_" # m.MX # "_COMMUTABLE" : VPseudoTernaryNoMask<m.vrclass,
+                                                             m.vrclass,
+                                                             m.vrclass,
+                                                             Constraint>;
+  }
 }
 
 multiclass VPseudoTernaryV_VX<string Constraint = ""> {
@@ -1897,15 +1905,28 @@ multiclass VPseudoTernaryV_VX<string Constraint = ""> {
 }
 
 multiclass VPseudoTernaryV_VX_AAXA<string Constraint = ""> {
-  foreach m = MxList.m in
+  foreach m = MxList.m in {
     defm "_VX" : VPseudoTernary<m.vrclass, GPR, m.vrclass, m, Constraint>;
+
+    // Add a commutable version for use by IR mul+add.
+    let isCommutable = 1, ForceTailAgnostic = true, VLMul = m.value in
+    def "_VX_" # m.MX # "_COMMUTABLE" :
+       VPseudoTernaryNoMask<m.vrclass, GPR, m.vrclass, Constraint>;
+  }
 }
 
 multiclass VPseudoTernaryV_VF_AAXA<string Constraint = ""> {
-  foreach m = MxList.m in
-    foreach f = FPList.fpinfo in
+  foreach m = MxList.m in {
+    foreach f = FPList.fpinfo in {
       defm "_V" # f.FX : VPseudoTernary<m.vrclass, f.fprclass, m.vrclass,
                                         m, Constraint>;
+
+      // Add a commutable version for use by IR mul+add.
+      let isCommutable = 1, ForceTailAgnostic = true, VLMul = m.value in
+      def "_V" # f.FX # "_" # m.MX # "_COMMUTABLE" :
+         VPseudoTernaryNoMask<m.vrclass, f.fprclass, m.vrclass, Constraint>;
+    }
+  }
 }
 
 multiclass VPseudoTernaryW_VV {
@@ -1936,44 +1957,11 @@ multiclass VPseudoTernaryV_VI<Operand ImmType = simm5, string Constraint = ""> {
 multiclass VPseudoTernaryV_VV_VX_AAXA<string Constraint = ""> {
   defm "" : VPseudoTernaryV_VV<Constraint>;
   defm "" : VPseudoTernaryV_VX_AAXA<Constraint>;
-
-  foreach m = MxList.m in {
-    // Add a commutable version for use by IR mul+add.
-    // NOTE: We need this because we use a tail undisturbed policy on the
-    // intrinsic version so we can't commute those instructions since it would
-    // change which input operand is tied to the destination. That would
-    // remove user control of the tail elements.
-    let isCommutable = 1, ForceTailAgnostic = true, VLMul = m.value in {
-      def "_VV_" # m.MX # "_COMMUTABLE" : VPseudoTernaryNoMask<m.vrclass,
-                                                               m.vrclass,
-                                                               m.vrclass,
-                                                               Constraint>;
-      def "_VX_" # m.MX # "_COMMUTABLE" :
-         VPseudoTernaryNoMask<m.vrclass, GPR, m.vrclass, Constraint>;
-    }
-  }
 }
 
 multiclass VPseudoTernaryV_VV_VF_AAXA<string Constraint = ""> {
   defm "" : VPseudoTernaryV_VV<Constraint>;
   defm "" : VPseudoTernaryV_VF_AAXA<Constraint>;
-
-  foreach m = MxList.m in {
-    // Add a commutable version for use by IR mul+add.
-    // NOTE: We need this because we use a tail undisturbed policy on the
-    // intrinsic version so we can't commute those instructions since it would
-    // change which input operand is tied to the destination. That would
-    // remove user control of the tail elements.
-    let isCommutable = 1, ForceTailAgnostic = true, VLMul = m.value in {
-      def "_VV_" # m.MX # "_COMMUTABLE" : VPseudoTernaryNoMask<m.vrclass,
-                                                               m.vrclass,
-                                                               m.vrclass,
-                                                               Constraint>;
-      foreach f = FPList.fpinfo in
-        def "_V" # f.FX # "_" # m.MX # "_COMMUTABLE" :
-           VPseudoTernaryNoMask<m.vrclass, f.fprclass, m.vrclass, Constraint>;
-    }
-  }
 }
 
 multiclass VPseudoTernaryV_VX_VI<Operand ImmType = simm5, string Constraint = ""> {


        


More information about the llvm-commits mailing list