[llvm] 052ae28 - [RISCV] Use !cond instead of multiple !if in RISCVInstrInfoVPseudos.td. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 13:49:59 PST 2023


Author: Craig Topper
Date: 2023-02-15T13:49:26-08:00
New Revision: 052ae28ac77f51f885dceae093d855c79470acc4

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

LOG: [RISCV] Use !cond instead of multiple !if in RISCVInstrInfoVPseudos.td. NFC

Rely on !cond erroring for unmatched condition instead of using a
bogus string for the default.

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 04a6890ee852..0f2daccda73a 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td
@@ -149,14 +149,13 @@ class log2<int num> {
 }
 
 class octuple_to_str<int octuple> {
-  string ret = !if(!eq(octuple, 1), "MF8",
-                   !if(!eq(octuple, 2), "MF4",
-                   !if(!eq(octuple, 4), "MF2",
-                   !if(!eq(octuple, 8), "M1",
-                   !if(!eq(octuple, 16), "M2",
-                   !if(!eq(octuple, 32), "M4",
-                   !if(!eq(octuple, 64), "M8",
-                   "NoDef")))))));
+  string ret = !cond(!eq(octuple, 1): "MF8",
+                     !eq(octuple, 2): "MF4",
+                     !eq(octuple, 4): "MF2",
+                     !eq(octuple, 8): "M1",
+                     !eq(octuple, 16): "M2",
+                     !eq(octuple, 32): "M4",
+                     !eq(octuple, 64): "M8");
 }
 
 def VLOpFrag : PatFrag<(ops), (XLenVT (VLOp (XLenVT AVL:$vl)))>;


        


More information about the llvm-commits mailing list