diff --git a/llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp b/llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp --- a/llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp +++ b/llvm/lib/Target/RISCV/MCA/RISCVCustomBehaviour.cpp @@ -32,6 +32,7 @@ uint16_t Pseudo; uint16_t BaseInstr; uint8_t VLMul; + uint8_t SEW; }; #define GET_RISCVVInversePseudosTable_IMPL @@ -144,7 +145,7 @@ if (I->getDesc() == RISCVLMULInstrument::DESC_NAME) { uint8_t LMUL = static_cast(I)->getLMUL(); const RISCVVInversePseudosTable::PseudoInfo *RVV = - RISCVVInversePseudosTable::getBaseInfo(Opcode, LMUL); + RISCVVInversePseudosTable::getBaseInfo(Opcode, LMUL, 0); // Not a RVV instr if (!RVV) { LLVM_DEBUG( 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 @@ -498,6 +498,8 @@ class RISCVVPseudo { Pseudo Pseudo = !cast(NAME); // Used as a key. Instruction BaseInstr = !cast(PseudoToVInst.VInst); + // SEW = 0 is used to denote that the Pseudo is not SEW specific (or unknown). + bits<8> SEW = 0; } // The actual table. @@ -513,8 +515,8 @@ def RISCVVInversePseudosTable : GenericTable { let FilterClass = "RISCVVPseudo"; let CppTypeName = "PseudoInfo"; - let Fields = [ "Pseudo", "BaseInstr", "VLMul" ]; - let PrimaryKey = [ "BaseInstr", "VLMul" ]; + let Fields = [ "Pseudo", "BaseInstr", "VLMul", "SEW"]; + let PrimaryKey = [ "BaseInstr", "VLMul", "SEW"]; let PrimaryKeyName = "getBaseInfo"; let PrimaryKeyEarlyOut = true; } @@ -712,10 +714,11 @@ true : VRegClass); } -class VPseudo : +class VPseudo : Pseudo, RISCVVPseudo { let BaseInstr = instr; let VLMul = m.value; + let SEW = sew; } class GetVTypePredicates { @@ -1705,7 +1708,7 @@ foreach lmul = MxSet.m in { defvar LInfo = lmul.MX; defvar vreg = lmul.vrclass; - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=eew in { def "E" # eew # "_V_" # LInfo : VPseudoUSLoadNoMask, VLESched; @@ -1723,7 +1726,7 @@ foreach lmul = MxSet.m in { defvar LInfo = lmul.MX; defvar vreg = lmul.vrclass; - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=eew in { def "E" # eew # "FF_V_" # LInfo: VPseudoUSLoadFFNoMask, VLFSched; @@ -1752,7 +1755,7 @@ foreach lmul = MxSet.m in { defvar LInfo = lmul.MX; defvar vreg = lmul.vrclass; - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=eew in { def "E" # eew # "_V_" # LInfo : VPseudoSLoadNoMask, VLSSched; def "E" # eew # "_V_" # LInfo # "_MASK" : @@ -1800,7 +1803,7 @@ foreach lmul = MxSet.m in { defvar LInfo = lmul.MX; defvar vreg = lmul.vrclass; - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=eew in { def "E" # eew # "_V_" # LInfo : VPseudoUSStoreNoMask, VSESched; def "E" # eew # "_V_" # LInfo # "_MASK" : VPseudoUSStoreMask, @@ -1826,7 +1829,7 @@ foreach lmul = MxSet.m in { defvar LInfo = lmul.MX; defvar vreg = lmul.vrclass; - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=eew in { def "E" # eew # "_V_" # LInfo : VPseudoSStoreNoMask, VSSSched; def "E" # eew # "_V_" # LInfo # "_MASK" : VPseudoSStoreMask, @@ -1963,6 +1966,7 @@ defvar WriteVCompressV_MX_E = !cast("WriteVCompressV" # suffix); defvar ReadVCompressV_MX_E = !cast("ReadVCompressV" # suffix); + let SEW = e in def _VM # suffix : VPseudoUnaryAnyMask, Sched<[WriteVCompressV_MX_E, ReadVCompressV_MX_E, ReadVCompressV_MX_E]>; } @@ -1975,7 +1979,7 @@ LMULInfo MInfo, string Constraint = "", int sew = 0> { - let VLMul = MInfo.value in { + let VLMul = MInfo.value, SEW=sew in { defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); def suffix : VPseudoBinaryNoMaskTU; @@ -1992,7 +1996,7 @@ string Constraint = "", int sew = 0, int UsesVXRM = 1> { - let VLMul = MInfo.value in { + let VLMul = MInfo.value, SEW=sew in { defvar suffix = !if(sew, "_" # MInfo.MX # "_E" # sew, "_" # MInfo.MX); def suffix : VPseudoBinaryNoMaskRoundingMode; @@ -2028,7 +2032,7 @@ LMULInfo emul, string Constraint = "", int sew = 0> { - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=sew in { defvar suffix = !if(sew, "_" # lmul.MX # "_E" # sew, "_" # lmul.MX); def suffix # "_" # emul.MX : VPseudoBinaryNoMaskTU; @@ -2408,13 +2412,15 @@ defvar WriteVFSqrtV_MX_E = !cast("WriteVFSqrtV" # suffix); defvar ReadVFSqrtV_MX_E = !cast("ReadVFSqrtV" # suffix); - def "_V" # suffix : VPseudoUnaryNoMaskRoundingMode, - Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E, - ReadVMask]>; - def "_V" # suffix # "_MASK" : VPseudoUnaryMaskRoundingMode, - RISCVMaskedPseudo, - Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E, - ReadVMask]>; + let SEW = e in { + def "_V" # suffix : VPseudoUnaryNoMaskRoundingMode, + Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E, + ReadVMask]>; + def "_V" # suffix # "_MASK" : VPseudoUnaryMaskRoundingMode, + RISCVMaskedPseudo, + Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E, + ReadVMask]>; + } } } } @@ -3956,7 +3962,7 @@ foreach eew = EEWList in { foreach lmul = MxSet.m in { defvar LInfo = lmul.MX; - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=eew in { foreach nf = NFSet.L in { defvar vreg = SegRegClass.RC; def nf # "E" # eew # "_V_" # LInfo : @@ -3973,7 +3979,7 @@ foreach eew = EEWList in { foreach lmul = MxSet.m in { defvar LInfo = lmul.MX; - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=eew in { foreach nf = NFSet.L in { defvar vreg = SegRegClass.RC; def nf # "E" # eew # "FF_V_" # LInfo : @@ -3990,7 +3996,7 @@ foreach eew = EEWList in { foreach lmul = MxSet.m in { defvar LInfo = lmul.MX; - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=eew in { foreach nf = NFSet.L in { defvar vreg = SegRegClass.RC; def nf # "E" # eew # "_V_" # LInfo : VPseudoSSegLoadNoMask, @@ -4040,7 +4046,7 @@ foreach eew = EEWList in { foreach lmul = MxSet.m in { defvar LInfo = lmul.MX; - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=eew in { foreach nf = NFSet.L in { defvar vreg = SegRegClass.RC; def nf # "E" # eew # "_V_" # LInfo : VPseudoUSSegStoreNoMask, @@ -4057,7 +4063,7 @@ foreach eew = EEWList in { foreach lmul = MxSet.m in { defvar LInfo = lmul.MX; - let VLMul = lmul.value in { + let VLMul = lmul.value, SEW=eew in { foreach nf = NFSet.L in { defvar vreg = SegRegClass.RC; def nf # "E" # eew # "_V_" # LInfo : VPseudoSSegStoreNoMask,