diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td index 9447b841bcfb1..1bfcbe042051d 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td @@ -115,61 +115,68 @@ class VLFSched : Sched <[!cast("WriteVLDFF" # n), //===----------------------------------------------------------------------===// let hasSideEffects = 0, mayLoad = 1, mayStore = 0 in { -// load vd, (rs1) +// unit-stride load vd, (rs1), vm +class VUnitStrideLoad + : RVInstVLU<0b000, width.Value{3}, LUMOPUnitStride, width.Value{2-0}, + (outs VR:$vd), + (ins GPR:$rs1, VMaskOp:$vm), opcodestr, "$vd, (${rs1})$vm">; + +let vm = 1, RVVConstraint = NoConstraint in { +// unit-stride whole register load vlr.v vd, (rs1) +class VWholeLoad nf, RISCVWidth width, string opcodestr, RegisterClass VRC> + : RVInstVLU { + let Uses = []; +} + +// unit-stride mask load vd, (rs1) class VUnitStrideLoadMask : RVInstVLU<0b000, LSWidth8.Value{3}, LUMOPUnitStrideMask, LSWidth8.Value{2-0}, (outs VR:$vd), - (ins GPR:$rs1), opcodestr, "$vd, (${rs1})"> { - let vm = 1; - let RVVConstraint = NoConstraint; -} + (ins GPR:$rs1), opcodestr, "$vd, (${rs1})">; +} // vm = 1, RVVConstraint = NoConstraint -// load vd, (rs1), vm -class VUnitStrideLoad - : RVInstVLU<0b000, width.Value{3}, lumop, width.Value{2-0}, +// unit-stride fault-only-first load vd, (rs1), vm +class VUnitStrideLoadFF + : RVInstVLU<0b000, width.Value{3}, LUMOPUnitStrideFF, width.Value{2-0}, (outs VR:$vd), (ins GPR:$rs1, VMaskOp:$vm), opcodestr, "$vd, (${rs1})$vm">; -// load vd, (rs1), rs2, vm +// strided load vd, (rs1), rs2, vm class VStridedLoad : RVInstVLS<0b000, width.Value{3}, width.Value{2-0}, (outs VR:$vd), (ins GPR:$rs1, GPR:$rs2, VMaskOp:$vm), opcodestr, "$vd, (${rs1}), $rs2$vm">; -// load vd, (rs1), vs2, vm +// indexed load vd, (rs1), vs2, vm class VIndexedLoad : RVInstVLX<0b000, width.Value{3}, mop, width.Value{2-0}, (outs VR:$vd), (ins GPR:$rs1, VR:$vs2, VMaskOp:$vm), opcodestr, "$vd, (${rs1}), $vs2$vm">; -// vlr.v vd, (rs1) -class VWholeLoad nf, RISCVWidth width, string opcodestr, RegisterClass VRC> - : RVInstVLU { - let vm = 1; - let Uses = []; - let RVVConstraint = NoConstraint; -} +// unit-stride segment load vd, (rs1), vm +class VUnitStrideSegmentLoad nf, RISCVWidth width, string opcodestr> + : RVInstVLU; -// segment load vd, (rs1), vm -class VUnitStrideSegmentLoad nf, RISCVLSUMOP lumop, - RISCVWidth width, string opcodestr> - : RVInstVLU nf, RISCVWidth width, string opcodestr> + : RVInstVLU; -// segment load vd, (rs1), rs2, vm +// strided segment load vd, (rs1), rs2, vm class VStridedSegmentLoad nf, RISCVWidth width, string opcodestr> : RVInstVLS; -// segment load vd, (rs1), vs2, vm +// indexed segment load vd, (rs1), vs2, vm class VIndexedSegmentLoad nf, RISCVMOP mop, RISCVWidth width, string opcodestr> : RVInstVLX nf, RISCVMOP mop, RISCVWidth width, } // hasSideEffects = 0, mayLoad = 1, mayStore = 0 let hasSideEffects = 0, mayLoad = 0, mayStore = 1 in { -// store vd, vs3, (rs1) +// unit-stride store vd, vs3, (rs1), vm +class VUnitStrideStore + : RVInstVSU<0b000, width.Value{3}, SUMOPUnitStride, width.Value{2-0}, + (outs), (ins VR:$vs3, GPR:$rs1, VMaskOp:$vm), opcodestr, + "$vs3, (${rs1})$vm">; + +let vm = 1 in { +// vsr.v vd, (rs1) +class VWholeStore nf, string opcodestr, RegisterClass VRC> + : RVInstVSU { + let Uses = []; +} + +// unit-stride mask store vd, vs3, (rs1) class VUnitStrideStoreMask : RVInstVSU<0b000, LSWidth8.Value{3}, SUMOPUnitStrideMask, LSWidth8.Value{2-0}, (outs), (ins VR:$vs3, GPR:$rs1), opcodestr, - "$vs3, (${rs1})"> { - let vm = 1; -} + "$vs3, (${rs1})">; +} // vm = 1 -// store vd, vs3, (rs1), vm -class VUnitStrideStore - : RVInstVSU<0b000, width.Value{3}, sumop, width.Value{2-0}, - (outs), (ins VR:$vs3, GPR:$rs1, VMaskOp:$vm), opcodestr, - "$vs3, (${rs1})$vm">; - -// store vd, vs3, (rs1), rs2, vm +// strided store vd, vs3, (rs1), rs2, vm class VStridedStore : RVInstVSS<0b000, width.Value{3}, width.Value{2-0}, (outs), (ins VR:$vs3, GPR:$rs1, GPR:$rs2, VMaskOp:$vm), opcodestr, "$vs3, (${rs1}), $rs2$vm">; -// store vd, vs3, (rs1), vs2, vm +// indexed store vd, vs3, (rs1), vs2, vm class VIndexedStore : RVInstVSX<0b000, width.Value{3}, mop, width.Value{2-0}, (outs), (ins VR:$vs3, GPR:$rs1, VR:$vs2, VMaskOp:$vm), opcodestr, "$vs3, (${rs1}), $vs2$vm">; -// vsr.v vd, (rs1) -class VWholeStore nf, string opcodestr, RegisterClass VRC> - : RVInstVSU { - let vm = 1; - let Uses = []; -} - // segment store vd, vs3, (rs1), vm class VUnitStrideSegmentStore nf, RISCVWidth width, string opcodestr> : RVInstVSU, +def VLE8_V : VUnitStrideLoad, VLESched<8>; -def VLE16_V : VUnitStrideLoad, +def VLE16_V : VUnitStrideLoad, VLESched<16>; -def VLE32_V : VUnitStrideLoad, +def VLE32_V : VUnitStrideLoad, VLESched<32>; -def VLE64_V : VUnitStrideLoad, +def VLE64_V : VUnitStrideLoad, VLESched<64>; -def VLE8FF_V : VUnitStrideLoad, +// Vector Unit-Stride Fault-only-First Loads +def VLE8FF_V : VUnitStrideLoadFF, VLFSched<8>; -def VLE16FF_V : VUnitStrideLoad, +def VLE16FF_V : VUnitStrideLoadFF, VLFSched<16>; -def VLE32FF_V : VUnitStrideLoad, +def VLE32FF_V : VUnitStrideLoadFF, VLFSched<32>; -def VLE64FF_V : VUnitStrideLoad, +def VLE64FF_V : VUnitStrideLoadFF, VLFSched<64>; def VLM_V : VUnitStrideLoadMask<"vlm.v">, @@ -867,13 +873,13 @@ def : InstAlias<"vle1.v $vd, (${rs1})", def : InstAlias<"vse1.v $vs3, (${rs1})", (VSM_V VR:$vs3, GPR:$rs1), 0>; -def VSE8_V : VUnitStrideStore, +def VSE8_V : VUnitStrideStore, VSESched<8>; -def VSE16_V : VUnitStrideStore, +def VSE16_V : VUnitStrideStore, VSESched<16>; -def VSE32_V : VUnitStrideStore, +def VSE32_V : VUnitStrideStore, VSESched<32>; -def VSE64_V : VUnitStrideStore, +def VSE64_V : VUnitStrideStore, VSESched<64>; // Vector Strided Instructions @@ -1501,15 +1507,15 @@ foreach n = [1, 2, 4, 8] in { let Predicates = [HasStdExtZvlsseg] in { foreach nf=2-8 in { - def VLSEG#nf#E8_V : VUnitStrideSegmentLoad; - def VLSEG#nf#E16_V : VUnitStrideSegmentLoad; - def VLSEG#nf#E32_V : VUnitStrideSegmentLoad; - def VLSEG#nf#E64_V : VUnitStrideSegmentLoad; - - def VLSEG#nf#E8FF_V : VUnitStrideSegmentLoad; - def VLSEG#nf#E16FF_V : VUnitStrideSegmentLoad; - def VLSEG#nf#E32FF_V : VUnitStrideSegmentLoad; - def VLSEG#nf#E64FF_V : VUnitStrideSegmentLoad; + def VLSEG#nf#E8_V : VUnitStrideSegmentLoad; + def VLSEG#nf#E16_V : VUnitStrideSegmentLoad; + def VLSEG#nf#E32_V : VUnitStrideSegmentLoad; + def VLSEG#nf#E64_V : VUnitStrideSegmentLoad; + + def VLSEG#nf#E8FF_V : VUnitStrideSegmentLoadFF; + def VLSEG#nf#E16FF_V : VUnitStrideSegmentLoadFF; + def VLSEG#nf#E32FF_V : VUnitStrideSegmentLoadFF; + def VLSEG#nf#E64FF_V : VUnitStrideSegmentLoadFF; def VSSEG#nf#E8_V : VUnitStrideSegmentStore; def VSSEG#nf#E16_V : VUnitStrideSegmentStore;