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 @@ -13,34 +13,63 @@ // Used for widening and narrowing instructions as it doesn't contain M8. defvar SchedMxListW = ["UpperBound", "MF8", "MF4", "MF2", "M1", "M2", "M4"]; -// Creates SchedWrite for each (name, LMUL) pair for LMUL in lmuls argument -multiclass LMULSchedWrites lmuls = SchedMxList> { - foreach mx = lmuls in { +// Creates SchedWrite for each (name, LMUL) pair for LMUL in SchedMxList +multiclass LMULSchedWrites { + foreach mx = SchedMxList in { def name # "_" # mx : SchedWrite; } } -// Creates SchedRead for each (name, LMUL) pair for LMUL in lmuls argument -multiclass LMULSchedReads lmuls = SchedMxList> { - foreach mx = lmuls in { +// Creates SchedWrite for each (name, LMUL) pair for LMUL in SchedMxListW +multiclass LMULSchedWritesW { + foreach mx = SchedMxListW in { + def name # "_" # mx : SchedWrite; + } +} + +// Creates SchedRead for each (name, LMUL) pair for LMUL in SchedMxList +multiclass LMULSchedReads { + foreach mx = SchedMxList in { + def name # "_" # mx : SchedRead; + } +} + +// Creates SchedRead for each (name, LMUL) pair for LMUL in SchedMxListW +multiclass LMULSchedReadsW { + foreach mx = SchedMxListW in { def name # "_" # mx : SchedRead; } } // Creates WriteRes for each (name, LMUL, resources) tuple for LMUL -// in lmuls argument -multiclass LMULWriteRes resources, - list lmuls = SchedMxList> { - foreach mx = lmuls in { +// in SchedMxList +multiclass LMULWriteRes resources> { + foreach mx = SchedMxList in { def : WriteRes(name # "_" # mx), resources>; } } +// Creates WriteRes for each (name, LMUL, resources) tuple for LMUL +// in SchedMxListW +multiclass LMULWriteResW resources> { + foreach mx = SchedMxListW in { + def : WriteRes(name # "_" # mx), resources>; + } +} + +// Creates ReadAdvance for each (name, LMUL, val) tuple for LMUL +// in SchedMxList +multiclass LMULReadAdvance writes = []> { + foreach mx = SchedMxList in { + def : ReadAdvance(name # "_" # mx), val, writes>; + } +} + // Creates ReadAdvance for each (name, LMUL, val) tuple for LMUL -// in lmuls argument -multiclass LMULReadAdvance lmuls = SchedMxList> { - foreach mx = lmuls in { - def : ReadAdvance(name # "_" # mx), val>; +// in SchedMxListW +multiclass LMULReadAdvanceW writes = []> { + foreach mx = SchedMxListW in { + def : ReadAdvance(name # "_" # mx), val, writes>; } } @@ -118,9 +147,9 @@ defm "" : LMULSchedWrites<"WriteVIALUX">; defm "" : LMULSchedWrites<"WriteVIALUI">; // 11.2. Vector Widening Integer Add/Subtract -defm "" : LMULSchedWrites<"WriteVIWALUV", SchedMxListW>; -defm "" : LMULSchedWrites<"WriteVIWALUX", SchedMxListW>; -defm "" : LMULSchedWrites<"WriteVIWALUI", SchedMxListW>; +defm "" : LMULSchedWritesW<"WriteVIWALUV">; +defm "" : LMULSchedWritesW<"WriteVIWALUX">; +defm "" : LMULSchedWritesW<"WriteVIWALUI">; // 11.3. Vector Integer Extension defm "" : LMULSchedWrites<"WriteVExtV">; // 11.4. Vector Integer Arithmetic with Carry or Borrow Instructions @@ -132,9 +161,9 @@ defm "" : LMULSchedWrites<"WriteVShiftX">; defm "" : LMULSchedWrites<"WriteVShiftI">; // 11.7. Vector Narrowing Integer Right Shift Instructions -defm "" : LMULSchedWrites<"WriteVNShiftV", SchedMxListW>; -defm "" : LMULSchedWrites<"WriteVNShiftX", SchedMxListW>; -defm "" : LMULSchedWrites<"WriteVNShiftI", SchedMxListW>; +defm "" : LMULSchedWritesW<"WriteVNShiftV">; +defm "" : LMULSchedWritesW<"WriteVNShiftX">; +defm "" : LMULSchedWritesW<"WriteVNShiftI">; // 11.8. Vector Integer Comparison Instructions // 11.9. Vector Integer Min/Max Instructions defm "" : LMULSchedWrites<"WriteVICmpV">; @@ -147,14 +176,14 @@ defm "" : LMULSchedWrites<"WriteVIDivV">; defm "" : LMULSchedWrites<"WriteVIDivX">; // 11.12. Vector Widening Integer Multiply Instructions -defm "" : LMULSchedWrites<"WriteVIWMulV", SchedMxListW>; -defm "" : LMULSchedWrites<"WriteVIWMulX", SchedMxListW>; +defm "" : LMULSchedWritesW<"WriteVIWMulV">; +defm "" : LMULSchedWritesW<"WriteVIWMulX">; // 11.13. Vector Single-Width Integer Multiply-Add Instructions defm "" : LMULSchedWrites<"WriteVIMulAddV">; defm "" : LMULSchedWrites<"WriteVIMulAddX">; // 11.14. Vector Widening Integer Multiply-Add Instructions -defm "" : LMULSchedWrites<"WriteVIWMulAddV", SchedMxListW>; -defm "" : LMULSchedWrites<"WriteVIWMulAddX", SchedMxListW>; +defm "" : LMULSchedWritesW<"WriteVIWMulAddV">; +defm "" : LMULSchedWritesW<"WriteVIWMulAddX">; // 11.15. Vector Integer Merge Instructions defm "" : LMULSchedWrites<"WriteVIMergeV">; defm "" : LMULSchedWrites<"WriteVIMergeX">; @@ -180,9 +209,9 @@ defm "" : LMULSchedWrites<"WriteVSShiftX">; defm "" : LMULSchedWrites<"WriteVSShiftI">; // 12.5. Vector Narrowing Fixed-Point Clip Instructions -defm "" : LMULSchedWrites<"WriteVNClipV", SchedMxListW>; -defm "" : LMULSchedWrites<"WriteVNClipX", SchedMxListW>; -defm "" : LMULSchedWrites<"WriteVNClipI", SchedMxListW>; +defm "" : LMULSchedWritesW<"WriteVNClipV">; +defm "" : LMULSchedWritesW<"WriteVNClipX">; +defm "" : LMULSchedWritesW<"WriteVNClipI">; // 13. Vector Floating-Point Instructions // 13.2. Vector Single-Width Floating-Point Add/Subtract Instructions @@ -341,8 +370,8 @@ defm "" : LMULSchedReads<"ReadVIALUV">; defm "" : LMULSchedReads<"ReadVIALUX">; // 11.2. Vector Widening Integer Add/Subtract -defm "" : LMULSchedReads<"ReadVIWALUV", SchedMxListW>; -defm "" : LMULSchedReads<"ReadVIWALUX", SchedMxListW>; +defm "" : LMULSchedReadsW<"ReadVIWALUV">; +defm "" : LMULSchedReadsW<"ReadVIWALUX">; // 11.3. Vector Integer Extension defm "" : LMULSchedReads<"ReadVExtV">; // 11.4. Vector Integer Arithmetic with Carry or Borrow Instructions @@ -352,8 +381,8 @@ defm "" : LMULSchedReads<"ReadVShiftV">; defm "" : LMULSchedReads<"ReadVShiftX">; // 11.7. Vector Narrowing Integer Right Shift Instructions -defm "" : LMULSchedReads<"ReadVNShiftV", SchedMxListW>; -defm "" : LMULSchedReads<"ReadVNShiftX", SchedMxListW>; +defm "" : LMULSchedReadsW<"ReadVNShiftV">; +defm "" : LMULSchedReadsW<"ReadVNShiftX">; // 11.8. Vector Integer Comparison Instructions // 11.9. Vector Integer Min/Max Instructions defm "" : LMULSchedReads<"ReadVICmpV">; @@ -365,14 +394,14 @@ defm "" : LMULSchedReads<"ReadVIDivV">; defm "" : LMULSchedReads<"ReadVIDivX">; // 11.12. Vector Widening Integer Multiply Instructions -defm "" : LMULSchedReads<"ReadVIWMulV", SchedMxListW>; -defm "" : LMULSchedReads<"ReadVIWMulX", SchedMxListW>; +defm "" : LMULSchedReadsW<"ReadVIWMulV">; +defm "" : LMULSchedReadsW<"ReadVIWMulX">; // 11.13. Vector Single-Width Integer Multiply-Add Instructions defm "" : LMULSchedReads<"ReadVIMulAddV">; defm "" : LMULSchedReads<"ReadVIMulAddX">; // 11.14. Vector Widening Integer Multiply-Add Instructions -defm "" : LMULSchedReads<"ReadVIWMulAddV", SchedMxListW>; -defm "" : LMULSchedReads<"ReadVIWMulAddX", SchedMxListW>; +defm "" : LMULSchedReadsW<"ReadVIWMulAddV">; +defm "" : LMULSchedReadsW<"ReadVIWMulAddX">; // 11.15. Vector Integer Merge Instructions defm "" : LMULSchedReads<"ReadVIMergeV">; defm "" : LMULSchedReads<"ReadVIMergeX">; @@ -394,8 +423,8 @@ defm "" : LMULSchedReads<"ReadVSShiftV">; defm "" : LMULSchedReads<"ReadVSShiftX">; // 12.5. Vector Narrowing Fixed-Point Clip Instructions -defm "" : LMULSchedReads<"ReadVNClipV", SchedMxListW>; -defm "" : LMULSchedReads<"ReadVNClipX", SchedMxListW>; +defm "" : LMULSchedReadsW<"ReadVNClipV">; +defm "" : LMULSchedReadsW<"ReadVNClipX">; // 13. Vector Floating-Point Instructions // 13.2. Vector Single-Width Floating-Point Add/Subtract Instructions @@ -580,9 +609,9 @@ defm "" : LMULWriteRes<"WriteVIALUV", []>; defm "" : LMULWriteRes<"WriteVIALUX", []>; defm "" : LMULWriteRes<"WriteVIALUI", []>; -defm "" : LMULWriteRes<"WriteVIWALUV", [], SchedMxListW>; -defm "" : LMULWriteRes<"WriteVIWALUX", [], SchedMxListW>; -defm "" : LMULWriteRes<"WriteVIWALUI", [], SchedMxListW>; +defm "" : LMULWriteResW<"WriteVIWALUV", []>; +defm "" : LMULWriteResW<"WriteVIWALUX", []>; +defm "" : LMULWriteResW<"WriteVIWALUI", []>; defm "" : LMULWriteRes<"WriteVExtV", []>; defm "" : LMULWriteRes<"WriteVICALUV", []>; defm "" : LMULWriteRes<"WriteVICALUX", []>; @@ -590,9 +619,9 @@ defm "" : LMULWriteRes<"WriteVShiftV", []>; defm "" : LMULWriteRes<"WriteVShiftX", []>; defm "" : LMULWriteRes<"WriteVShiftI", []>; -defm "" : LMULWriteRes<"WriteVNShiftV", [], SchedMxListW>; -defm "" : LMULWriteRes<"WriteVNShiftX", [], SchedMxListW>; -defm "" : LMULWriteRes<"WriteVNShiftI", [], SchedMxListW>; +defm "" : LMULWriteResW<"WriteVNShiftV", []>; +defm "" : LMULWriteResW<"WriteVNShiftX", []>; +defm "" : LMULWriteResW<"WriteVNShiftI", []>; defm "" : LMULWriteRes<"WriteVICmpV", []>; defm "" : LMULWriteRes<"WriteVICmpX", []>; defm "" : LMULWriteRes<"WriteVICmpI", []>; @@ -600,12 +629,12 @@ defm "" : LMULWriteRes<"WriteVIMulX", []>; defm "" : LMULWriteRes<"WriteVIDivV", []>; defm "" : LMULWriteRes<"WriteVIDivX", []>; -defm "" : LMULWriteRes<"WriteVIWMulV", [], SchedMxListW>; -defm "" : LMULWriteRes<"WriteVIWMulX", [], SchedMxListW>; +defm "" : LMULWriteResW<"WriteVIWMulV", []>; +defm "" : LMULWriteResW<"WriteVIWMulX", []>; defm "" : LMULWriteRes<"WriteVIMulAddV", []>; defm "" : LMULWriteRes<"WriteVIMulAddX", []>; -defm "" : LMULWriteRes<"WriteVIWMulAddV", [], SchedMxListW>; -defm "" : LMULWriteRes<"WriteVIWMulAddX", [], SchedMxListW>; +defm "" : LMULWriteResW<"WriteVIWMulAddV", []>; +defm "" : LMULWriteResW<"WriteVIWMulAddX", []>; defm "" : LMULWriteRes<"WriteVIMergeV", []>; defm "" : LMULWriteRes<"WriteVIMergeX", []>; defm "" : LMULWriteRes<"WriteVIMergeI", []>; @@ -624,9 +653,9 @@ defm "" : LMULWriteRes<"WriteVSShiftV", []>; defm "" : LMULWriteRes<"WriteVSShiftX", []>; defm "" : LMULWriteRes<"WriteVSShiftI", []>; -defm "" : LMULWriteRes<"WriteVNClipV", [], SchedMxListW>; -defm "" : LMULWriteRes<"WriteVNClipX", [], SchedMxListW>; -defm "" : LMULWriteRes<"WriteVNClipI", [], SchedMxListW>; +defm "" : LMULWriteResW<"WriteVNClipV", []>; +defm "" : LMULWriteResW<"WriteVNClipX", []>; +defm "" : LMULWriteResW<"WriteVNClipI", []>; // 13. Vector Floating-Point Instructions def : WriteRes; @@ -738,27 +767,27 @@ // 11. Vector Integer Arithmetic Instructions defm "" : LMULReadAdvance<"ReadVIALUV", 0>; defm "" : LMULReadAdvance<"ReadVIALUX", 0>; -defm "" : LMULReadAdvance<"ReadVIWALUV", 0, SchedMxListW>; -defm "" : LMULReadAdvance<"ReadVIWALUX", 0, SchedMxListW>; +defm "" : LMULReadAdvanceW<"ReadVIWALUV", 0>; +defm "" : LMULReadAdvanceW<"ReadVIWALUX", 0>; defm "" : LMULReadAdvance<"ReadVExtV", 0>; defm "" : LMULReadAdvance<"ReadVICALUV", 0>; defm "" : LMULReadAdvance<"ReadVICALUX", 0>; defm "" : LMULReadAdvance<"ReadVShiftV", 0>; defm "" : LMULReadAdvance<"ReadVShiftX", 0>; -defm "" : LMULReadAdvance<"ReadVNShiftV", 0, SchedMxListW>; -defm "" : LMULReadAdvance<"ReadVNShiftX", 0, SchedMxListW>; +defm "" : LMULReadAdvanceW<"ReadVNShiftV", 0>; +defm "" : LMULReadAdvanceW<"ReadVNShiftX", 0>; defm "" : LMULReadAdvance<"ReadVICmpV", 0>; defm "" : LMULReadAdvance<"ReadVICmpX", 0>; defm "" : LMULReadAdvance<"ReadVIMulV", 0>; defm "" : LMULReadAdvance<"ReadVIMulX", 0>; defm "" : LMULReadAdvance<"ReadVIDivV", 0>; defm "" : LMULReadAdvance<"ReadVIDivX", 0>; -defm "" : LMULReadAdvance<"ReadVIWMulV", 0, SchedMxListW>; -defm "" : LMULReadAdvance<"ReadVIWMulX", 0, SchedMxListW>; +defm "" : LMULReadAdvanceW<"ReadVIWMulV", 0>; +defm "" : LMULReadAdvanceW<"ReadVIWMulX", 0>; defm "" : LMULReadAdvance<"ReadVIMulAddV", 0>; defm "" : LMULReadAdvance<"ReadVIMulAddX", 0>; -defm "" : LMULReadAdvance<"ReadVIWMulAddV", 0, SchedMxListW>; -defm "" : LMULReadAdvance<"ReadVIWMulAddX", 0, SchedMxListW>; +defm "" : LMULReadAdvanceW<"ReadVIWMulAddV", 0>; +defm "" : LMULReadAdvanceW<"ReadVIWMulAddX", 0>; defm "" : LMULReadAdvance<"ReadVIMergeV", 0>; defm "" : LMULReadAdvance<"ReadVIMergeX", 0>; defm "" : LMULReadAdvance<"ReadVIMovV", 0>; @@ -773,8 +802,8 @@ defm "" : LMULReadAdvance<"ReadVSMulX", 0>; defm "" : LMULReadAdvance<"ReadVSShiftV", 0>; defm "" : LMULReadAdvance<"ReadVSShiftX", 0>; -defm "" : LMULReadAdvance<"ReadVNClipV", 0, SchedMxListW>; -defm "" : LMULReadAdvance<"ReadVNClipX", 0, SchedMxListW>; +defm "" : LMULReadAdvanceW<"ReadVNClipV", 0>; +defm "" : LMULReadAdvanceW<"ReadVNClipX", 0>; // 13. Vector Floating-Point Instructions def : ReadAdvance;