[llvm] [RISCV] Minor improvements to RISCVInstrInfoXSf.td. NFC (PR #76424)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 26 21:35:28 PST 2023


https://github.com/topperc created https://github.com/llvm/llvm-project/pull/76424

Use an explicit list of LMULInfos instead of indexing part of other lists. Use wvrclass field to double LMUL instead of using two lists.

Use range instead of list in another spot. I wish I could use a list of LMULInfo here but there's no way to quadruple an LMUL yet.

>From 6981eaa7f1cf223c8232083a7b6f174840cc7764 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Tue, 26 Dec 2023 21:30:40 -0800
Subject: [PATCH] [RISCV] Minor improvements to RISCVInstrInfoXSf.td. NFC

Use an explicit list of LMULInfos instead of indexing part of
other lists. Use wvrclass field to double LMUL instead of using
two lists.

Use range instead of list in another spot where I couldn't simplify
to use a list since there isn't a way to quadruple LMUL currently.
---
 llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td b/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td
index 38d05877bb45c1..561ab8d7403d67 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoXSf.td
@@ -356,10 +356,9 @@ multiclass VPseudoSiFiveVQMACCDOD<string Constraint = ""> {
 }
 
 multiclass VPseudoSiFiveVQMACCQOQ<string Constraint = ""> {
-  foreach i = 0-3 in
-    let VLMul = MxListVF4[i].value in
-    defm NAME : VPseudoSiFiveVMACC<MxListVF4[i].MX, MxListVF8[i].vrclass,
-                                   MxListVF4[i].vrclass, Constraint>;
+  foreach m = [V_MF2, V_M1, V_M2, V_M4] in
+    let VLMul = m.value in
+    defm NAME : VPseudoSiFiveVMACC<m.MX, m.wvrclass, m.vrclass, Constraint>;
 }
 
 multiclass VPseudoSiFiveVFWMACC<string Constraint = ""> {
@@ -369,7 +368,7 @@ multiclass VPseudoSiFiveVFWMACC<string Constraint = ""> {
 }
 
 multiclass VPseudoSiFiveVFNRCLIP<string Constraint = "@earlyclobber $rd"> {
-  foreach i = [0, 1, 2, 3, 4] in
+  foreach i = 0-4 in
     let hasSideEffects = 0 in
       defm "Pseudo" # NAME : VPseudoBinaryRoundingMode<MxListW[i].vrclass,
                                                        MxListVF4[i].vrclass,



More information about the llvm-commits mailing list