xref: /freebsd/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVSchedule.td (revision c7a063741720ef81d4caa4613242579d12f1d605)
1//===-- RISCVSchedule.td - RISCV 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 WriteJmpReg     : SchedWrite;    // Jump register
24def WriteNop        : SchedWrite;
25def WriteLDB        : SchedWrite;    // Load byte
26def WriteLDH        : SchedWrite;    // Load half-word
27def WriteLDW        : SchedWrite;    // Load word
28def WriteLDWU       : SchedWrite;    // Load word unsigned
29def WriteLDD        : SchedWrite;    // Load double-word
30def WriteCSR        : SchedWrite;    // CSR instructions
31def WriteSTB        : SchedWrite;    // Store byte
32def WriteSTH        : SchedWrite;    // Store half-word
33def WriteSTW        : SchedWrite;    // Store word
34def WriteSTD        : SchedWrite;    // Store double-word
35def WriteAtomicW    : SchedWrite;    //Atomic memory operation word size
36def WriteAtomicD    : SchedWrite;    //Atomic memory operation double word size
37def WriteAtomicLDW  : SchedWrite;    // Atomic load word
38def WriteAtomicLDD  : SchedWrite;    // Atomic load double word
39def WriteAtomicSTW  : SchedWrite;    // Atomic store word
40def WriteAtomicSTD  : SchedWrite;    // Atomic store double word
41def WriteFALU16     : SchedWrite;    // FP 16-bit computation
42def WriteFALU32     : SchedWrite;    // FP 32-bit computation
43def WriteFALU64     : SchedWrite;    // FP 64-bit computation
44def WriteFMul16     : SchedWrite;    // 16-bit floating point multiply
45def WriteFMA16      : SchedWrite;    // 16-bit floating point fused multiply-add
46def WriteFMul32     : SchedWrite;    // 32-bit floating point multiply
47def WriteFMA32      : SchedWrite;    // 32-bit floating point fused multiply-add
48def WriteFMul64     : SchedWrite;    // 64-bit floating point multiply
49def WriteFMA64      : SchedWrite;    // 64-bit floating point fused multiply-add
50def WriteFDiv16     : SchedWrite;    // 16-bit floating point divide
51def WriteFDiv32     : SchedWrite;    // 32-bit floating point divide
52def WriteFDiv64     : SchedWrite;    // 64-bit floating point divide
53def WriteFSqrt16    : SchedWrite;    // 16-bit floating point sqrt
54def WriteFSqrt32    : SchedWrite;    // 32-bit floating point sqrt
55def WriteFSqrt64    : SchedWrite;    // 64-bit floating point sqrt
56
57// Integer to float conversions
58def WriteFCvtI32ToF16  : SchedWrite;
59def WriteFCvtI32ToF32  : SchedWrite;
60def WriteFCvtI32ToF64  : SchedWrite;
61def WriteFCvtI64ToF16  : SchedWrite;    // RV64I only
62def WriteFCvtI64ToF32  : SchedWrite;    // RV64I only
63def WriteFCvtI64ToF64  : SchedWrite;    // RV64I only
64
65//Float to integer conversions
66def WriteFCvtF16ToI32  : SchedWrite;
67def WriteFCvtF16ToI64  : SchedWrite;    // RV64I only
68def WriteFCvtF32ToI32  : SchedWrite;
69def WriteFCvtF32ToI64  : SchedWrite;    // RV64I only
70def WriteFCvtF64ToI32  : SchedWrite;
71def WriteFCvtF64ToI64  : SchedWrite;    // RV64I only
72
73// Float to float conversions
74def WriteFCvtF32ToF64  : SchedWrite;
75def WriteFCvtF64ToF32  : SchedWrite;
76def WriteFCvtF16ToF32  : SchedWrite;
77def WriteFCvtF32ToF16  : SchedWrite;
78def WriteFCvtF16ToF64  : SchedWrite;
79def WriteFCvtF64ToF16  : SchedWrite;
80
81def WriteFClass16   : SchedWrite;    // 16-bit floating point classify
82def WriteFClass32   : SchedWrite;    // 32-bit floating point classify
83def WriteFClass64   : SchedWrite;    // 64-bit floating point classify
84def WriteFCmp16     : SchedWrite;    // 16-bit floating point compare
85def WriteFCmp32     : SchedWrite;    // 32-bit floating point compare
86def WriteFCmp64     : SchedWrite;    // 64-bit floating point compare
87def WriteFSGNJ16    : SchedWrite;    // 16-bit floating point sign-injection
88def WriteFSGNJ32    : SchedWrite;    // 32-bit floating point sign-injection
89def WriteFSGNJ64    : SchedWrite;    // 64-bit floating point sign-injection
90def WriteFMinMax16  : SchedWrite;    // 16-bit floating point min or max
91def WriteFMinMax32  : SchedWrite;    // 32-bit floating point min or max
92def WriteFMinMax64  : SchedWrite;    // 64-bit floating point min or max
93
94def WriteFMovF16ToI16     : SchedWrite;
95def WriteFMovI16ToF16     : SchedWrite;
96def WriteFMovF32ToI32     : SchedWrite;
97def WriteFMovI32ToF32     : SchedWrite;
98def WriteFMovF64ToI64     : SchedWrite;    // RV64I only
99def WriteFMovI64ToF64     : SchedWrite;    // RV64I only
100
101def WriteFLD16        : SchedWrite;    // Floating point sp load
102def WriteFLD32        : SchedWrite;    // Floating point sp load
103def WriteFLD64        : SchedWrite;    // Floating point dp load
104def WriteFST16        : SchedWrite;    // Floating point sp store
105def WriteFST32        : SchedWrite;    // Floating point sp store
106def WriteFST64        : SchedWrite;    // Floating point dp store
107
108/// Define scheduler resources associated with use operands.
109def ReadJmp         : SchedRead;
110def ReadJalr        : SchedRead;
111def ReadCSR         : SchedRead;
112def ReadMemBase     : SchedRead;
113def ReadFMemBase    : SchedRead;
114def ReadStoreData   : SchedRead;
115def ReadIALU        : SchedRead;
116def ReadIALU32      : SchedRead;    // 32-bit integer ALU operations on RV64I
117def ReadShiftImm    : SchedRead;
118def ReadShiftImm32  : SchedRead;    // 32-bit shift by immediate operations on RV64Ix
119def ReadShiftReg    : SchedRead;
120def ReadShiftReg32  : SchedRead;    // 32-bit shift by register operations on RV64Ix
121def ReadIDiv        : SchedRead;
122def ReadIDiv32      : SchedRead;
123def ReadIMul        : SchedRead;
124def ReadIMul32      : SchedRead;
125def ReadAtomicWA    : SchedRead;
126def ReadAtomicWD    : SchedRead;
127def ReadAtomicDA    : SchedRead;
128def ReadAtomicDD    : SchedRead;
129def ReadAtomicLDW   : SchedRead;    // Atomic load word
130def ReadAtomicLDD   : SchedRead;    // Atomic load double word
131def ReadAtomicSTW   : SchedRead;    // Atomic store word
132def ReadAtomicSTD   : SchedRead;    // Atomic store double word
133def ReadFALU16      : SchedRead;    // FP 16-bit computation
134def ReadFALU32      : SchedRead;    // FP 32-bit computation
135def ReadFALU64      : SchedRead;    // FP 64-bit computation
136def ReadFMul16      : SchedRead;    // 16-bit floating point multiply
137def ReadFMA16       : SchedRead;    // 16-bit floating point fused multiply-add
138def ReadFMul32      : SchedRead;    // 32-bit floating point multiply
139def ReadFMA32       : SchedRead;    // 32-bit floating point fused multiply-add
140def ReadFMul64      : SchedRead;    // 64-bit floating point multiply
141def ReadFMA64       : SchedRead;    // 64-bit floating point fused multiply-add
142def ReadFDiv16      : SchedRead;    // 16-bit floating point divide
143def ReadFDiv32      : SchedRead;    // 32-bit floating point divide
144def ReadFDiv64      : SchedRead;    // 64-bit floating point divide
145def ReadFSqrt16     : SchedRead;    // 16-bit floating point sqrt
146def ReadFSqrt32     : SchedRead;    // 32-bit floating point sqrt
147def ReadFSqrt64     : SchedRead;    // 64-bit floating point sqrt
148def ReadFCmp16      : SchedRead;
149def ReadFCmp32      : SchedRead;
150def ReadFCmp64      : SchedRead;
151def ReadFSGNJ16     : SchedRead;
152def ReadFSGNJ32     : SchedRead;
153def ReadFSGNJ64     : SchedRead;
154def ReadFMinMax16   : SchedRead;
155def ReadFMinMax32   : SchedRead;
156def ReadFMinMax64   : SchedRead;
157def ReadFCvtF16ToI32     : SchedRead;
158def ReadFCvtF16ToI64     : SchedRead;
159def ReadFCvtF32ToI32     : SchedRead;
160def ReadFCvtF32ToI64     : SchedRead;
161def ReadFCvtF64ToI32     : SchedRead;
162def ReadFCvtF64ToI64     : SchedRead;
163def ReadFCvtI32ToF16     : SchedRead;
164def ReadFCvtI32ToF32     : SchedRead;
165def ReadFCvtI32ToF64     : SchedRead;
166def ReadFCvtI64ToF16     : SchedRead;
167def ReadFCvtI64ToF32     : SchedRead;
168def ReadFCvtI64ToF64     : SchedRead;
169def ReadFMovF16ToI16     : SchedRead;
170def ReadFMovI16ToF16     : SchedRead;
171def ReadFMovF32ToI32     : SchedRead;
172def ReadFMovI32ToF32     : SchedRead;
173def ReadFMovF64ToI64     : SchedRead;
174def ReadFMovI64ToF64     : SchedRead;
175def ReadFCvtF32ToF64     : SchedRead;
176def ReadFCvtF64ToF32     : SchedRead;
177def ReadFCvtF16ToF32     : SchedRead;
178def ReadFCvtF32ToF16     : SchedRead;
179def ReadFCvtF16ToF64     : SchedRead;
180def ReadFCvtF64ToF16     : SchedRead;
181def ReadFClass16         : SchedRead;
182def ReadFClass32         : SchedRead;
183def ReadFClass64         : SchedRead;
184
185multiclass UnsupportedSchedZfh {
186let Unsupported = true in {
187def : WriteRes<WriteFALU16, []>;
188def : WriteRes<WriteFClass16, []>;
189def : WriteRes<WriteFCvtF16ToF64, []>;
190def : WriteRes<WriteFCvtF64ToF16, []>;
191def : WriteRes<WriteFCvtI64ToF16, []>;
192def : WriteRes<WriteFCvtF32ToF16, []>;
193def : WriteRes<WriteFCvtI32ToF16, []>;
194def : WriteRes<WriteFCvtF16ToI64, []>;
195def : WriteRes<WriteFCvtF16ToF32, []>;
196def : WriteRes<WriteFCvtF16ToI32, []>;
197def : WriteRes<WriteFDiv16, []>;
198def : WriteRes<WriteFCmp16, []>;
199def : WriteRes<WriteFLD16, []>;
200def : WriteRes<WriteFMA16, []>;
201def : WriteRes<WriteFMinMax16, []>;
202def : WriteRes<WriteFMul16, []>;
203def : WriteRes<WriteFMovI16ToF16, []>;
204def : WriteRes<WriteFMovF16ToI16, []>;
205def : WriteRes<WriteFSGNJ16, []>;
206def : WriteRes<WriteFST16, []>;
207def : WriteRes<WriteFSqrt16, []>;
208
209def : ReadAdvance<ReadFALU16, 0>;
210def : ReadAdvance<ReadFClass16, 0>;
211def : ReadAdvance<ReadFCvtF16ToF64, 0>;
212def : ReadAdvance<ReadFCvtF64ToF16, 0>;
213def : ReadAdvance<ReadFCvtI64ToF16, 0>;
214def : ReadAdvance<ReadFCvtF32ToF16, 0>;
215def : ReadAdvance<ReadFCvtI32ToF16, 0>;
216def : ReadAdvance<ReadFCvtF16ToI64, 0>;
217def : ReadAdvance<ReadFCvtF16ToF32, 0>;
218def : ReadAdvance<ReadFCvtF16ToI32, 0>;
219def : ReadAdvance<ReadFDiv16, 0>;
220def : ReadAdvance<ReadFCmp16, 0>;
221def : ReadAdvance<ReadFMA16, 0>;
222def : ReadAdvance<ReadFMinMax16, 0>;
223def : ReadAdvance<ReadFMul16, 0>;
224def : ReadAdvance<ReadFMovI16ToF16, 0>;
225def : ReadAdvance<ReadFMovF16ToI16, 0>;
226def : ReadAdvance<ReadFSGNJ16, 0>;
227def : ReadAdvance<ReadFSqrt16, 0>;
228} // Unsupported = true
229}
230
231// Include the scheduler resources for other instruction extensions.
232include "RISCVScheduleB.td"
233include "RISCVScheduleV.td"
234