diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoV.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoV.td @@ -839,13 +839,15 @@ let Predicates = [HasVInstructions] in { let hasSideEffects = 1, mayLoad = 0, mayStore = 0 in { def VSETVLI : RVInstSetVLi<(outs GPR:$rd), (ins GPR:$rs1, VTypeIOp11:$vtypei), - "vsetvli", "$rd, $rs1, $vtypei">; - + "vsetvli", "$rd, $rs1, $vtypei">, + Sched<[WriteVSETVLI, ReadVSETVLI]>; def VSETIVLI : RVInstSetiVLi<(outs GPR:$rd), (ins uimm5:$uimm, VTypeIOp10:$vtypei), - "vsetivli", "$rd, $uimm, $vtypei">; + "vsetivli", "$rd, $uimm, $vtypei">, + Sched<[WriteVSETIVLI]>; def VSETVL : RVInstSetVL<(outs GPR:$rd), (ins GPR:$rs1, GPR:$rs2), - "vsetvl", "$rd, $rs1, $rs2">; + "vsetvl", "$rd, $rs1, $rs2">, + Sched<[WriteVSETVL, ReadVSETVL, ReadVSETVL]>; } // hasSideEffects = 1, mayLoad = 0, mayStore = 0 foreach eew = [8, 16, 32] in { defvar w = !cast("LSWidth" # eew); 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 @@ -4445,9 +4445,12 @@ // the when we aren't using one of the special X0 encodings. Otherwise it could // be accidentally be made X0 by MachineIR optimizations. To satisfy the // verifier, we also need a GPRX0 instruction for the special encodings. -def PseudoVSETVLI : Pseudo<(outs GPR:$rd), (ins GPRNoX0:$rs1, VTypeIOp11:$vtypei), []>; -def PseudoVSETVLIX0 : Pseudo<(outs GPR:$rd), (ins GPRX0:$rs1, VTypeIOp11:$vtypei), []>; -def PseudoVSETIVLI : Pseudo<(outs GPR:$rd), (ins uimm5:$rs1, VTypeIOp10:$vtypei), []>; +def PseudoVSETVLI : Pseudo<(outs GPR:$rd), (ins GPRNoX0:$rs1, VTypeIOp11:$vtypei), []>, + Sched<[WriteVSETVLI, ReadVSETVLI]>; +def PseudoVSETVLIX0 : Pseudo<(outs GPR:$rd), (ins GPRX0:$rs1, VTypeIOp11:$vtypei), []>, + Sched<[WriteVSETVLI, ReadVSETVLI]>; +def PseudoVSETIVLI : Pseudo<(outs GPR:$rd), (ins uimm5:$rs1, VTypeIOp10:$vtypei), []>, + Sched<[WriteVSETIVLI]>; } //===----------------------------------------------------------------------===// diff --git a/llvm/lib/Target/RISCV/RISCVScheduleV.td b/llvm/lib/Target/RISCV/RISCVScheduleV.td --- a/llvm/lib/Target/RISCV/RISCVScheduleV.td +++ b/llvm/lib/Target/RISCV/RISCVScheduleV.td @@ -12,6 +12,11 @@ // 3.6 Vector Byte Length vlenb def WriteRdVLENB : SchedWrite; +// 6. Configuration-Setting Instructions +def WriteVSETVLI : SchedWrite; +def WriteVSETIVLI : SchedWrite; +def WriteVSETVL : SchedWrite; + // 7. Vector Loads and Stores // 7.4. Vector Unit-Stride Instructions def WriteVLDE8 : SchedWrite; @@ -272,6 +277,10 @@ //===----------------------------------------------------------------------===// /// Define scheduler resources associated with use operands. +// 6. Configuration-Setting Instructions +def ReadVSETVLI : SchedRead; +def ReadVSETVL : SchedRead; + // 7. Vector Loads and Stores def ReadVLDX : SchedRead; def ReadVSTX : SchedRead; @@ -499,6 +508,11 @@ // 3.6 Vector Byte Length vlenb def : WriteRes; +// 6. Configuration-Setting Instructions +def : WriteRes; +def : WriteRes; +def : WriteRes; + // 7. Vector Loads and Stores def : WriteRes; def : WriteRes; @@ -693,6 +707,10 @@ def : WriteRes; def : WriteRes; +// 6. Configuration-Setting Instructions +def : ReadAdvance; +def : ReadAdvance; + // 7. Vector Loads and Stores def : ReadAdvance; def : ReadAdvance;