diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoVPseudos.td @@ -46,6 +46,30 @@ // Utilities. //===----------------------------------------------------------------------===// +class PseudoToVInst { + string VInst = !subst("_M8", "", + !subst("_M4", "", + !subst("_M2", "", + !subst("_M1", "", + !subst("_MF2", "", + !subst("_MF4", "", + !subst("_MF8", "", + !subst("_B1", "", + !subst("_B2", "", + !subst("_B4", "", + !subst("_B8", "", + !subst("_B16", "", + !subst("_B32", "", + !subst("_B64", "", + !subst("_MASK", "", + !subst("_TIED", "", + !subst("_TU", "", + !subst("F16", "F", + !subst("F32", "F", + !subst("F64", "F", + !subst("Pseudo", "", PseudoInst))))))))))))))))))))); +} + // This class describes information associated to the LMUL. class LMULInfo { @@ -402,7 +426,7 @@ def InvalidIndex : CONST8b<0x80>; class RISCVVPseudo { Pseudo Pseudo = !cast(NAME); // Used as a key. - Instruction BaseInstr; + Instruction BaseInstr = !cast(PseudoToVInst.VInst); } // The actual table. @@ -580,30 +604,6 @@ // Helpers to define the different pseudo instructions. //===----------------------------------------------------------------------===// -class PseudoToVInst { - string VInst = !subst("_M8", "", - !subst("_M4", "", - !subst("_M2", "", - !subst("_M1", "", - !subst("_MF2", "", - !subst("_MF4", "", - !subst("_MF8", "", - !subst("_B1", "", - !subst("_B2", "", - !subst("_B4", "", - !subst("_B8", "", - !subst("_B16", "", - !subst("_B32", "", - !subst("_B64", "", - !subst("_MASK", "", - !subst("_TIED", "", - !subst("_TU", "", - !subst("F16", "F", - !subst("F32", "F", - !subst("F64", "F", - !subst("Pseudo", "", PseudoInst))))))))))))))))))))); -} - // The destination vector register group for a masked vector instruction cannot // overlap the source mask register (v0), unless the destination vector register // is being written with a mask value (e.g., comparisons) or the scalar result @@ -654,7 +654,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = DummyMask; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSLoadNoMaskTU : @@ -670,7 +669,6 @@ let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSLoadMask : @@ -689,7 +687,6 @@ let HasMergeOp = 1; let HasVecPolicyOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSLoadFFNoMask : @@ -703,7 +700,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = DummyMask; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSLoadFFNoMaskTU : @@ -719,7 +715,6 @@ let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSLoadFFMask : @@ -738,7 +733,6 @@ let HasMergeOp = 1; let HasVecPolicyOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoSLoadNoMask: @@ -752,7 +746,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoSLoadNoMaskTU: @@ -768,7 +761,6 @@ let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoSLoadMask: @@ -787,7 +779,6 @@ let HasMergeOp = 1; let HasVecPolicyOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoILoadNoMask LMUL, @@ -804,7 +795,6 @@ let HasSEWOp = 1; let HasDummyMask = 1; let Constraints = !if(!eq(EarlyClobber, 1), "@earlyclobber $rd", ""); - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoILoadNoMaskTU LMUL, @@ -822,7 +812,6 @@ let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = !if(!eq(EarlyClobber, 1), "@earlyclobber $rd, $rd = $dest", "$rd = $dest"); - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoILoadMask LMUL, @@ -842,7 +831,6 @@ let HasMergeOp = 1; let HasVecPolicyOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSStoreNoMask: @@ -856,7 +844,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = DummyMask; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSStoreMask: @@ -869,7 +856,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoSStoreNoMask: @@ -883,7 +869,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoSStoreMask: @@ -896,7 +881,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } // Unary instruction that is never masked so HasDummyMask=0. @@ -910,7 +894,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUnaryNoDummyMaskTU(PseudoToVInst.VInst); } class VPseudoNullaryNoMask: @@ -938,7 +920,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoNullaryNoMaskTU: @@ -953,7 +934,6 @@ let HasSEWOp = 1; let HasDummyMask = 1; let HasMergeOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoNullaryMask: @@ -969,7 +949,6 @@ let HasMergeOp = 1; let UsesMaskPolicy = 1; let HasVecPolicyOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } // Nullary for pseudo instructions. They are expanded in @@ -999,7 +978,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } // RetClass could be GPR or VReg. @@ -1015,7 +993,6 @@ let HasSEWOp = 1; let HasDummyMask = 1; let HasMergeOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUnaryMask : @@ -1031,7 +1008,6 @@ let HasSEWOp = 1; let HasMergeOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUnaryMaskTA : @@ -1048,7 +1024,6 @@ let HasMergeOp = 1; let HasVecPolicyOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } // mask unary operation without maskedoff @@ -1061,7 +1036,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } // Mask can be V0~V31 @@ -1080,7 +1054,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasMergeOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoBinaryNoMask(PseudoToVInst.VInst); } class VPseudoBinaryNoMaskTU(PseudoToVInst.VInst); } // Special version of VPseudoBinaryNoMask where we pretend the first source is @@ -1137,7 +1108,6 @@ let HasDummyMask = 1; let ForceTailAgnostic = 1; let isConvertibleToThreeAddress = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoTiedBinaryNoMaskTU(PseudoToVInst.VInst); } class VPseudoIStoreNoMask LMUL, @@ -1171,7 +1140,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoIStoreMask LMUL, @@ -1185,7 +1153,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoBinaryMask(PseudoToVInst.VInst); } class VPseudoBinaryMaskPolicy(PseudoToVInst.VInst); } // Like VPseudoBinaryMask, but output can be V0. @@ -1246,7 +1211,6 @@ let HasSEWOp = 1; let HasMergeOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } // Special version of VPseudoBinaryMask where we pretend the first source is @@ -1269,7 +1233,6 @@ let HasMergeOp = 0; // Merge is also rs2. let HasVecPolicyOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoBinaryCarryIn(PseudoToVInst.VInst); let VLMul = MInfo.value; } @@ -1315,7 +1277,6 @@ let HasSEWOp = 1; let HasMergeOp = 1; let HasVecPolicyOp = 0; - let BaseInstr = !cast(PseudoToVInst.VInst); let VLMul = MInfo.value; } @@ -1336,7 +1297,6 @@ let HasSEWOp = 1; let HasMergeOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoTernaryNoMaskWithPolicy(PseudoToVInst.VInst); } class VPseudoUSSegLoadNoMask NF>: @@ -1371,7 +1330,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSSegLoadNoMaskTU NF>: @@ -1387,7 +1345,6 @@ let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSSegLoadMask NF>: @@ -1405,7 +1362,6 @@ let HasMergeOp = 1; let HasVecPolicyOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSSegLoadFFNoMask NF>: @@ -1419,7 +1375,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSSegLoadFFNoMaskTU NF>: @@ -1435,7 +1390,6 @@ let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $dest"; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSSegLoadFFMask NF>: @@ -1453,7 +1407,6 @@ let HasMergeOp = 1; let HasVecPolicyOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoSSegLoadNoMask NF>: @@ -1468,7 +1421,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoSSegLoadNoMaskTU NF>: @@ -1485,7 +1437,6 @@ let HasDummyMask = 1; let HasMergeOp = 1; let Constraints = "$rd = $merge"; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoSSegLoadMask NF>: @@ -1504,7 +1455,6 @@ let HasMergeOp = 1; let HasVecPolicyOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoISegLoadNoMask LMUL, @@ -1522,7 +1472,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoISegLoadNoMaskTU LMUL, @@ -1541,7 +1490,6 @@ let HasSEWOp = 1; let HasDummyMask = 1; let HasMergeOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoISegLoadMask LMUL, @@ -1563,7 +1511,6 @@ let HasMergeOp = 1; let HasVecPolicyOp = 1; let UsesMaskPolicy = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSSegStoreNoMask NF>: @@ -1577,7 +1524,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoUSSegStoreMask NF>: @@ -1591,7 +1537,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoSSegStoreNoMask NF>: @@ -1605,7 +1550,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoSSegStoreMask NF>: @@ -1619,7 +1563,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoISegStoreNoMask LMUL, @@ -1635,7 +1578,6 @@ let HasVLOp = 1; let HasSEWOp = 1; let HasDummyMask = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } class VPseudoISegStoreMask LMUL, @@ -1650,7 +1592,6 @@ let hasSideEffects = 0; let HasVLOp = 1; let HasSEWOp = 1; - let BaseInstr = !cast(PseudoToVInst.VInst); } multiclass VPseudoUSLoad {