1//===-- RISCVSchedule.td - RISC-V Scheduling Definitions ---*- tablegen -*-===// 2// 3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4// See https://llvm.org/LICENSE.txt for license information. 5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6// 7//===----------------------------------------------------------------------===// 8 9/// Define scheduler resources associated with def operands. 10def WriteIALU : SchedWrite; // 32 or 64-bit integer ALU operations 11def WriteIALU32 : SchedWrite; // 32-bit integer ALU operations on RV64I 12def WriteShiftImm : SchedWrite; // 32 or 64-bit shift by immediate operations 13def WriteShiftImm32 : SchedWrite; // 32-bit shift by immediate operations on RV64Ix 14def WriteShiftReg : SchedWrite; // 32 or 64-bit shift by immediate operations 15def WriteShiftReg32 : SchedWrite; // 32-bit shift by immediate operations on RV64Ix 16def WriteIDiv : SchedWrite; // 32-bit or 64-bit divide and remainder 17def WriteIDiv32 : SchedWrite; // 32-bit divide and remainder on RV64I 18def WriteIMul : SchedWrite; // 32-bit or 64-bit multiply 19def WriteIMul32 : SchedWrite; // 32-bit multiply on RV64I 20def WriteJmp : SchedWrite; // Jump 21def WriteJal : SchedWrite; // Jump and link 22def WriteJalr : SchedWrite; // Jump and link register 23def WriteNop : SchedWrite; 24def WriteLDB : SchedWrite; // Load byte 25def WriteLDH : SchedWrite; // Load half-word 26def WriteLDW : SchedWrite; // Load word 27def WriteLDD : SchedWrite; // Load double-word 28def WriteCSR : SchedWrite; // CSR instructions 29def WriteSTB : SchedWrite; // Store byte 30def WriteSTH : SchedWrite; // Store half-word 31def WriteSTW : SchedWrite; // Store word 32def WriteSTD : SchedWrite; // Store double-word 33def WriteAtomicW : SchedWrite; //Atomic memory operation word size 34def WriteAtomicD : SchedWrite; //Atomic memory operation double word size 35def WriteAtomicLDW : SchedWrite; // Atomic load word 36def WriteAtomicLDD : SchedWrite; // Atomic load double word 37def WriteAtomicSTW : SchedWrite; // Atomic store word 38def WriteAtomicSTD : SchedWrite; // Atomic store double word 39def WriteFAdd16 : SchedWrite; // 16-bit floating point addition/subtraction 40def WriteFAdd32 : SchedWrite; // 32-bit floating point addition/subtraction 41def WriteFAdd64 : SchedWrite; // 64-bit floating point addition/subtraction 42def WriteFMul16 : SchedWrite; // 16-bit floating point multiply 43def WriteFMul32 : SchedWrite; // 32-bit floating point multiply 44def WriteFMul64 : SchedWrite; // 64-bit floating point multiply 45def WriteFMA16 : SchedWrite; // 16-bit floating point fused multiply-add 46def WriteFMA32 : SchedWrite; // 32-bit floating point fused multiply-add 47def WriteFMA64 : SchedWrite; // 64-bit floating point fused multiply-add 48def WriteFDiv16 : SchedWrite; // 16-bit floating point divide 49def WriteFDiv32 : SchedWrite; // 32-bit floating point divide 50def WriteFDiv64 : SchedWrite; // 64-bit floating point divide 51def WriteFSqrt16 : SchedWrite; // 16-bit floating point sqrt 52def WriteFSqrt32 : SchedWrite; // 32-bit floating point sqrt 53def WriteFSqrt64 : SchedWrite; // 64-bit floating point sqrt 54 55// Integer to float conversions 56def WriteFCvtI32ToF16 : SchedWrite; 57def WriteFCvtI32ToF32 : SchedWrite; 58def WriteFCvtI32ToF64 : SchedWrite; 59def WriteFCvtI64ToF16 : SchedWrite; // RV64I only 60def WriteFCvtI64ToF32 : SchedWrite; // RV64I only 61def WriteFCvtI64ToF64 : SchedWrite; // RV64I only 62 63//Float to integer conversions 64def WriteFCvtF16ToI32 : SchedWrite; 65def WriteFCvtF16ToI64 : SchedWrite; // RV64I only 66def WriteFCvtF32ToI32 : SchedWrite; 67def WriteFCvtF32ToI64 : SchedWrite; // RV64I only 68def WriteFCvtF64ToI32 : SchedWrite; 69def WriteFCvtF64ToI64 : SchedWrite; // RV64I only 70 71// Float to float conversions 72def WriteFCvtF32ToF64 : SchedWrite; 73def WriteFCvtF64ToF32 : SchedWrite; 74def WriteFCvtF16ToF32 : SchedWrite; 75def WriteFCvtF32ToF16 : SchedWrite; 76def WriteFCvtF16ToF64 : SchedWrite; 77def WriteFCvtF64ToF16 : SchedWrite; 78 79// Zfa found instructions. 80def WriteFRoundF32 : SchedWrite; 81def WriteFRoundF64 : SchedWrite; 82def WriteFRoundF16 : SchedWrite; 83 84def WriteFClass16 : SchedWrite; // 16-bit floating point classify 85def WriteFClass32 : SchedWrite; // 32-bit floating point classify 86def WriteFClass64 : SchedWrite; // 64-bit floating point classify 87def WriteFCmp16 : SchedWrite; // 16-bit floating point compare 88def WriteFCmp32 : SchedWrite; // 32-bit floating point compare 89def WriteFCmp64 : SchedWrite; // 64-bit floating point compare 90def WriteFSGNJ16 : SchedWrite; // 16-bit floating point sign-injection 91def WriteFSGNJ32 : SchedWrite; // 32-bit floating point sign-injection 92def WriteFSGNJ64 : SchedWrite; // 64-bit floating point sign-injection 93def WriteFMinMax16 : SchedWrite; // 16-bit floating point min or max 94def WriteFMinMax32 : SchedWrite; // 32-bit floating point min or max 95def WriteFMinMax64 : SchedWrite; // 64-bit floating point min or max 96 97def WriteFMovF16ToI16 : SchedWrite; 98def WriteFMovI16ToF16 : SchedWrite; 99def WriteFMovF32ToI32 : SchedWrite; 100def WriteFMovI32ToF32 : SchedWrite; 101def WriteFMovF64ToI64 : SchedWrite; // RV64I only 102def WriteFMovI64ToF64 : SchedWrite; // RV64I only 103 104def WriteFLI16 : SchedWrite; // Floating point constant load 105def WriteFLI32 : SchedWrite; // Floating point constant load 106def WriteFLI64 : SchedWrite; // Floating point constant load 107 108def WriteFLD16 : SchedWrite; // Floating point sp load 109def WriteFLD32 : SchedWrite; // Floating point sp load 110def WriteFLD64 : SchedWrite; // Floating point dp load 111def WriteFST16 : SchedWrite; // Floating point sp store 112def WriteFST32 : SchedWrite; // Floating point sp store 113def WriteFST64 : SchedWrite; // Floating point dp store 114 115// short forward branch for Bullet 116def WriteSFB : SchedWrite; 117def ReadSFBJmp : SchedRead; 118def ReadSFBALU : SchedRead; 119 120/// Define scheduler resources associated with use operands. 121def ReadJmp : SchedRead; 122def ReadJalr : SchedRead; 123def ReadCSR : SchedRead; 124def ReadMemBase : SchedRead; 125def ReadFMemBase : SchedRead; 126def ReadStoreData : SchedRead; 127def ReadFStoreData : SchedRead; 128def ReadIALU : SchedRead; 129def ReadIALU32 : SchedRead; // 32-bit integer ALU operations on RV64I 130def ReadShiftImm : SchedRead; 131def ReadShiftImm32 : SchedRead; // 32-bit shift by immediate operations on RV64Ix 132def ReadShiftReg : SchedRead; 133def ReadShiftReg32 : SchedRead; // 32-bit shift by register operations on RV64Ix 134def ReadIDiv : SchedRead; 135def ReadIDiv32 : SchedRead; 136def ReadIMul : SchedRead; 137def ReadIMul32 : SchedRead; 138def ReadAtomicWA : SchedRead; 139def ReadAtomicWD : SchedRead; 140def ReadAtomicDA : SchedRead; 141def ReadAtomicDD : SchedRead; 142def ReadAtomicLDW : SchedRead; // Atomic load word 143def ReadAtomicLDD : SchedRead; // Atomic load double word 144def ReadAtomicSTW : SchedRead; // Atomic store word 145def ReadAtomicSTD : SchedRead; // Atomic store double word 146def ReadFAdd16 : SchedRead; // 16-bit floating point addition/subtraction 147def ReadFAdd32 : SchedRead; // 32-bit floating point addition/subtraction 148def ReadFAdd64 : SchedRead; // 64-bit floating point addition/subtraction 149def ReadFMul16 : SchedRead; // 16-bit floating point multiply 150def ReadFMul32 : SchedRead; // 32-bit floating point multiply 151def ReadFMul64 : SchedRead; // 64-bit floating point multiply 152def ReadFMA16 : SchedRead; // 16-bit floating point fused multiply-add 153def ReadFMA32 : SchedRead; // 32-bit floating point fused multiply-add 154def ReadFMA64 : SchedRead; // 64-bit floating point fused multiply-add 155def ReadFDiv16 : SchedRead; // 16-bit floating point divide 156def ReadFDiv32 : SchedRead; // 32-bit floating point divide 157def ReadFDiv64 : SchedRead; // 64-bit floating point divide 158def ReadFSqrt16 : SchedRead; // 16-bit floating point sqrt 159def ReadFSqrt32 : SchedRead; // 32-bit floating point sqrt 160def ReadFSqrt64 : SchedRead; // 64-bit floating point sqrt 161def ReadFCmp16 : SchedRead; 162def ReadFCmp32 : SchedRead; 163def ReadFCmp64 : SchedRead; 164def ReadFSGNJ16 : SchedRead; 165def ReadFSGNJ32 : SchedRead; 166def ReadFSGNJ64 : SchedRead; 167def ReadFMinMax16 : SchedRead; 168def ReadFMinMax32 : SchedRead; 169def ReadFMinMax64 : SchedRead; 170def ReadFCvtF16ToI32 : SchedRead; 171def ReadFCvtF16ToI64 : SchedRead; 172def ReadFCvtF32ToI32 : SchedRead; 173def ReadFCvtF32ToI64 : SchedRead; 174def ReadFCvtF64ToI32 : SchedRead; 175def ReadFCvtF64ToI64 : SchedRead; 176def ReadFCvtI32ToF16 : SchedRead; 177def ReadFCvtI32ToF32 : SchedRead; 178def ReadFCvtI32ToF64 : SchedRead; 179def ReadFCvtI64ToF16 : SchedRead; 180def ReadFCvtI64ToF32 : SchedRead; 181def ReadFCvtI64ToF64 : SchedRead; 182def ReadFMovF16ToI16 : SchedRead; 183def ReadFMovI16ToF16 : SchedRead; 184def ReadFMovF32ToI32 : SchedRead; 185def ReadFMovI32ToF32 : SchedRead; 186def ReadFMovF64ToI64 : SchedRead; 187def ReadFMovI64ToF64 : SchedRead; 188def ReadFCvtF32ToF64 : SchedRead; 189def ReadFCvtF64ToF32 : SchedRead; 190def ReadFCvtF16ToF32 : SchedRead; 191def ReadFCvtF32ToF16 : SchedRead; 192def ReadFCvtF16ToF64 : SchedRead; 193def ReadFCvtF64ToF16 : SchedRead; 194def ReadFRoundF16 : SchedRead; 195def ReadFRoundF32 : SchedRead; 196def ReadFRoundF64 : SchedRead; 197def ReadFClass16 : SchedRead; 198def ReadFClass32 : SchedRead; 199def ReadFClass64 : SchedRead; 200 201multiclass UnsupportedSchedZfh { 202let Unsupported = true in { 203def : WriteRes<WriteFAdd16, []>; 204def : WriteRes<WriteFClass16, []>; 205def : WriteRes<WriteFCvtF16ToF64, []>; 206def : WriteRes<WriteFCvtF64ToF16, []>; 207def : WriteRes<WriteFCvtI64ToF16, []>; 208def : WriteRes<WriteFCvtF32ToF16, []>; 209def : WriteRes<WriteFCvtI32ToF16, []>; 210def : WriteRes<WriteFCvtF16ToI64, []>; 211def : WriteRes<WriteFCvtF16ToF32, []>; 212def : WriteRes<WriteFCvtF16ToI32, []>; 213def : WriteRes<WriteFDiv16, []>; 214def : WriteRes<WriteFCmp16, []>; 215def : WriteRes<WriteFLD16, []>; 216def : WriteRes<WriteFMA16, []>; 217def : WriteRes<WriteFMinMax16, []>; 218def : WriteRes<WriteFMul16, []>; 219def : WriteRes<WriteFMovI16ToF16, []>; 220def : WriteRes<WriteFMovF16ToI16, []>; 221def : WriteRes<WriteFSGNJ16, []>; 222def : WriteRes<WriteFST16, []>; 223def : WriteRes<WriteFSqrt16, []>; 224 225def : ReadAdvance<ReadFAdd16, 0>; 226def : ReadAdvance<ReadFClass16, 0>; 227def : ReadAdvance<ReadFCvtF16ToF64, 0>; 228def : ReadAdvance<ReadFCvtF64ToF16, 0>; 229def : ReadAdvance<ReadFCvtI64ToF16, 0>; 230def : ReadAdvance<ReadFCvtF32ToF16, 0>; 231def : ReadAdvance<ReadFCvtI32ToF16, 0>; 232def : ReadAdvance<ReadFCvtF16ToI64, 0>; 233def : ReadAdvance<ReadFCvtF16ToF32, 0>; 234def : ReadAdvance<ReadFCvtF16ToI32, 0>; 235def : ReadAdvance<ReadFDiv16, 0>; 236def : ReadAdvance<ReadFCmp16, 0>; 237def : ReadAdvance<ReadFMA16, 0>; 238def : ReadAdvance<ReadFMinMax16, 0>; 239def : ReadAdvance<ReadFMul16, 0>; 240def : ReadAdvance<ReadFMovI16ToF16, 0>; 241def : ReadAdvance<ReadFMovF16ToI16, 0>; 242def : ReadAdvance<ReadFSGNJ16, 0>; 243def : ReadAdvance<ReadFSqrt16, 0>; 244} // Unsupported = true 245} 246 247multiclass UnsupportedSchedSFB { 248let Unsupported = true in { 249def : WriteRes<WriteSFB, []>; 250 251def : ReadAdvance<ReadSFBJmp, 0>; 252def : ReadAdvance<ReadSFBALU, 0>; 253} // Unsupported = true 254} 255 256multiclass UnsupportedSchedZfa { 257let Unsupported = true in { 258def : WriteRes<WriteFRoundF16, []>; 259def : WriteRes<WriteFRoundF32, []>; 260def : WriteRes<WriteFRoundF64, []>; 261def : WriteRes<WriteFLI16, []>; 262def : WriteRes<WriteFLI32, []>; 263def : WriteRes<WriteFLI64, []>; 264 265def : ReadAdvance<ReadFRoundF32, 0>; 266def : ReadAdvance<ReadFRoundF64, 0>; 267def : ReadAdvance<ReadFRoundF16, 0>; 268} // Unsupported = true 269} 270 271// Include the scheduler resources for other instruction extensions. 272include "RISCVScheduleZb.td" 273include "RISCVScheduleV.td" 274