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; } @@ -727,10 +729,11 @@ true : VRegClass); } -class VPseudo : +class VPseudo : Pseudo, RISCVVPseudo { let BaseInstr = instr; let VLMul = m.value; + let SEW = sew; } class GetVTypePredicates { @@ -1593,7 +1596,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; @@ -1612,7 +1615,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; @@ -1642,7 +1645,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" : @@ -1692,7 +1695,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, @@ -1718,7 +1721,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, @@ -1859,6 +1862,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]>; } @@ -1871,7 +1875,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 : VPseudoBinaryNoMask; @@ -1889,7 +1893,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 : VPseudoBinaryNoMaskRoundingMode; @@ -1926,7 +1930,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 : VPseudoBinaryNoMask; @@ -2260,15 +2264,17 @@ defvar WriteVFSqrtV_MX_E = !cast("WriteVFSqrtV" # suffix); defvar ReadVFSqrtV_MX_E = !cast("ReadVFSqrtV" # suffix); - def "_V" # suffix : VPseudoUnaryNoMask, - Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E, - ReadVMask]>; - def "_V" # suffix # "_MASK" : VPseudoUnaryMask, - RISCVMaskedPseudo, - Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E, - ReadVMask]>; + let SEW = e in { + def "_V" # suffix : VPseudoUnaryNoMask, + Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E, + ReadVMask]>; + def "_V" # suffix # "_MASK" : VPseudoUnaryMask, + RISCVMaskedPseudo, + Sched<[WriteVFSqrtV_MX_E, ReadVFSqrtV_MX_E, + ReadVMask]>; + } } } } @@ -3634,7 +3640,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 : @@ -3651,7 +3657,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 : @@ -3668,7 +3674,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, @@ -3718,7 +3724,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, @@ -3735,7 +3741,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,