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 ReadFMA16Addend : SchedRead; // 16-bit floating point fused multiply-add (addend) 154def ReadFMA32 : SchedRead; // 32-bit floating point fused multiply-add 155def ReadFMA32Addend : SchedRead; // 32-bit floating point fused multiply-add (addend) 156def ReadFMA64 : SchedRead; // 64-bit floating point fused multiply-add 157def ReadFMA64Addend : SchedRead; // 64-bit floating point fused multiply-add (addend) 158def ReadFDiv16 : SchedRead; // 16-bit floating point divide 159def ReadFDiv32 : SchedRead; // 32-bit floating point divide 160def ReadFDiv64 : SchedRead; // 64-bit floating point divide 161def ReadFSqrt16 : SchedRead; // 16-bit floating point sqrt 162def ReadFSqrt32 : SchedRead; // 32-bit floating point sqrt 163def ReadFSqrt64 : SchedRead; // 64-bit floating point sqrt 164def ReadFCmp16 : SchedRead; 165def ReadFCmp32 : SchedRead; 166def ReadFCmp64 : SchedRead; 167def ReadFSGNJ16 : SchedRead; 168def ReadFSGNJ32 : SchedRead; 169def ReadFSGNJ64 : SchedRead; 170def ReadFMinMax16 : SchedRead; 171def ReadFMinMax32 : SchedRead; 172def ReadFMinMax64 : SchedRead; 173def ReadFCvtF16ToI32 : SchedRead; 174def ReadFCvtF16ToI64 : SchedRead; 175def ReadFCvtF32ToI32 : SchedRead; 176def ReadFCvtF32ToI64 : SchedRead; 177def ReadFCvtF64ToI32 : SchedRead; 178def ReadFCvtF64ToI64 : SchedRead; 179def ReadFCvtI32ToF16 : SchedRead; 180def ReadFCvtI32ToF32 : SchedRead; 181def ReadFCvtI32ToF64 : SchedRead; 182def ReadFCvtI64ToF16 : SchedRead; 183def ReadFCvtI64ToF32 : SchedRead; 184def ReadFCvtI64ToF64 : SchedRead; 185def ReadFMovF16ToI16 : SchedRead; 186def ReadFMovI16ToF16 : SchedRead; 187def ReadFMovF32ToI32 : SchedRead; 188def ReadFMovI32ToF32 : SchedRead; 189def ReadFMovF64ToI64 : SchedRead; 190def ReadFMovI64ToF64 : SchedRead; 191def ReadFCvtF32ToF64 : SchedRead; 192def ReadFCvtF64ToF32 : SchedRead; 193def ReadFCvtF16ToF32 : SchedRead; 194def ReadFCvtF32ToF16 : SchedRead; 195def ReadFCvtF16ToF64 : SchedRead; 196def ReadFCvtF64ToF16 : SchedRead; 197def ReadFRoundF16 : SchedRead; 198def ReadFRoundF32 : SchedRead; 199def ReadFRoundF64 : SchedRead; 200def ReadFClass16 : SchedRead; 201def ReadFClass32 : SchedRead; 202def ReadFClass64 : SchedRead; 203 204multiclass UnsupportedSchedZfh { 205let Unsupported = true in { 206def : WriteRes<WriteFAdd16, []>; 207def : WriteRes<WriteFClass16, []>; 208def : WriteRes<WriteFCvtF16ToF64, []>; 209def : WriteRes<WriteFCvtF64ToF16, []>; 210def : WriteRes<WriteFCvtI64ToF16, []>; 211def : WriteRes<WriteFCvtF32ToF16, []>; 212def : WriteRes<WriteFCvtI32ToF16, []>; 213def : WriteRes<WriteFCvtF16ToI64, []>; 214def : WriteRes<WriteFCvtF16ToF32, []>; 215def : WriteRes<WriteFCvtF16ToI32, []>; 216def : WriteRes<WriteFDiv16, []>; 217def : WriteRes<WriteFCmp16, []>; 218def : WriteRes<WriteFLD16, []>; 219def : WriteRes<WriteFMA16, []>; 220def : WriteRes<WriteFMinMax16, []>; 221def : WriteRes<WriteFMul16, []>; 222def : WriteRes<WriteFMovI16ToF16, []>; 223def : WriteRes<WriteFMovF16ToI16, []>; 224def : WriteRes<WriteFSGNJ16, []>; 225def : WriteRes<WriteFST16, []>; 226def : WriteRes<WriteFSqrt16, []>; 227 228def : ReadAdvance<ReadFAdd16, 0>; 229def : ReadAdvance<ReadFClass16, 0>; 230def : ReadAdvance<ReadFCvtF16ToF64, 0>; 231def : ReadAdvance<ReadFCvtF64ToF16, 0>; 232def : ReadAdvance<ReadFCvtI64ToF16, 0>; 233def : ReadAdvance<ReadFCvtF32ToF16, 0>; 234def : ReadAdvance<ReadFCvtI32ToF16, 0>; 235def : ReadAdvance<ReadFCvtF16ToI64, 0>; 236def : ReadAdvance<ReadFCvtF16ToF32, 0>; 237def : ReadAdvance<ReadFCvtF16ToI32, 0>; 238def : ReadAdvance<ReadFDiv16, 0>; 239def : ReadAdvance<ReadFCmp16, 0>; 240def : ReadAdvance<ReadFMA16, 0>; 241def : ReadAdvance<ReadFMinMax16, 0>; 242def : ReadAdvance<ReadFMul16, 0>; 243def : ReadAdvance<ReadFMovI16ToF16, 0>; 244def : ReadAdvance<ReadFMovF16ToI16, 0>; 245def : ReadAdvance<ReadFSGNJ16, 0>; 246def : ReadAdvance<ReadFSqrt16, 0>; 247} // Unsupported = true 248} 249 250multiclass UnsupportedSchedSFB { 251let Unsupported = true in { 252def : WriteRes<WriteSFB, []>; 253 254def : ReadAdvance<ReadSFBJmp, 0>; 255def : ReadAdvance<ReadSFBALU, 0>; 256} // Unsupported = true 257} 258 259multiclass UnsupportedSchedZfa { 260let Unsupported = true in { 261def : WriteRes<WriteFRoundF16, []>; 262def : WriteRes<WriteFRoundF32, []>; 263def : WriteRes<WriteFRoundF64, []>; 264def : WriteRes<WriteFLI16, []>; 265def : WriteRes<WriteFLI32, []>; 266def : WriteRes<WriteFLI64, []>; 267 268def : ReadAdvance<ReadFRoundF32, 0>; 269def : ReadAdvance<ReadFRoundF64, 0>; 270def : ReadAdvance<ReadFRoundF16, 0>; 271} // Unsupported = true 272} 273 274// Include the scheduler resources for other instruction extensions. 275include "RISCVScheduleZb.td" 276include "RISCVScheduleV.td" 277