xref: /freebsd/contrib/llvm-project/llvm/lib/Target/RISCV/RISCVScheduleZb.td (revision a03411e84728e9b267056fd31c7d1d9d1dc1b01e)
1//===- RISCVScheduleB.td - RISC-V Scheduling Definitions B -*- 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.
10
11// Zba extension
12def WriteSHXADD      : SchedWrite; // sh1add/sh2add/sh3add
13def WriteSHXADD32    : SchedWrite; // sh1add.uw/sh2add.uw/sh3add.uw
14
15// Zbb extension
16def WriteRotateImm   : SchedWrite;
17def WriteRotateImm32 : SchedWrite;
18def WriteRotateReg   : SchedWrite;
19def WriteRotateReg32 : SchedWrite;
20def WriteCLZ         : SchedWrite;
21def WriteCLZ32       : SchedWrite;
22def WriteCTZ         : SchedWrite;
23def WriteCTZ32       : SchedWrite;
24def WriteCPOP        : SchedWrite;
25def WriteCPOP32      : SchedWrite;
26def WriteREV8        : SchedWrite;
27def WriteORCB        : SchedWrite;
28
29// Zbc extension
30def WriteCLMUL       : SchedWrite; // CLMUL/CLMULR/CLMULH
31
32// Zbs extension
33def WriteSingleBit   : SchedWrite; // BCLR/BSET/BINV
34def WriteSingleBitImm: SchedWrite; // BCLRI/BSETI/BINVI
35def WriteBEXT : SchedWrite; // BEXT
36def WriteBEXTI : SchedWrite; // BEXTI
37
38// Zbkb extension
39def WriteBREV8       : SchedWrite; // brev8
40def WritePACK        : SchedWrite; // pack/packh
41def WritePACK32      : SchedWrite; // packw
42def WriteZIP         : SchedWrite; // zip/unzip
43
44// Zbkx extension
45def WriteXPERM       : SchedWrite; // xperm4/xperm8
46
47/// Define scheduler resources associated with use operands.
48
49// Zba extension
50def ReadSHXADD      : SchedRead; // sh1add/sh2add/sh3add
51def ReadSHXADD32    : SchedRead; // sh1add.uw/sh2add.uw/sh3add.uw
52
53// Zbb extension
54def ReadRotateImm   : SchedRead;
55def ReadRotateImm32 : SchedRead;
56def ReadRotateReg   : SchedRead;
57def ReadRotateReg32 : SchedRead;
58def ReadCLZ         : SchedRead;
59def ReadCLZ32       : SchedRead;
60def ReadCTZ         : SchedRead;
61def ReadCTZ32       : SchedRead;
62def ReadCPOP        : SchedRead;
63def ReadCPOP32      : SchedRead;
64def ReadREV8        : SchedRead;
65def ReadORCB        : SchedRead;
66
67// Zbc extension
68def ReadCLMUL       : SchedRead; // CLMUL/CLMULR/CLMULH
69
70// Zbs extension
71def ReadSingleBit   : SchedRead; // BCLR/BSET/BINV/BEXT
72def ReadSingleBitImm: SchedRead; // BCLRI/BSETI/BINVI/BEXTI
73
74// Zbkb extension
75def ReadBREV8       : SchedRead; // brev8
76def ReadPACK        : SchedRead; // pack/packh
77def ReadPACK32      : SchedRead; // packw
78def ReadZIP         : SchedRead; // zip/unzip
79
80// Zbkx extension
81def ReadXPERM       : SchedRead; // xperm4/xperm8
82
83/// Define default scheduler resources for B.
84
85multiclass UnsupportedSchedZba {
86let Unsupported = true in {
87def : WriteRes<WriteSHXADD, []>;
88def : WriteRes<WriteSHXADD32, []>;
89
90def : ReadAdvance<ReadSHXADD, 0>;
91def : ReadAdvance<ReadSHXADD32, 0>;
92}
93}
94
95multiclass UnsupportedSchedZbb {
96let Unsupported = true in {
97def : WriteRes<WriteRotateImm, []>;
98def : WriteRes<WriteRotateImm32, []>;
99def : WriteRes<WriteRotateReg, []>;
100def : WriteRes<WriteRotateReg32, []>;
101def : WriteRes<WriteCLZ, []>;
102def : WriteRes<WriteCLZ32, []>;
103def : WriteRes<WriteCTZ, []>;
104def : WriteRes<WriteCTZ32, []>;
105def : WriteRes<WriteCPOP, []>;
106def : WriteRes<WriteCPOP32, []>;
107def : WriteRes<WriteREV8, []>;
108def : WriteRes<WriteORCB, []>;
109
110def : ReadAdvance<ReadRotateImm, 0>;
111def : ReadAdvance<ReadRotateImm32, 0>;
112def : ReadAdvance<ReadRotateReg, 0>;
113def : ReadAdvance<ReadRotateReg32, 0>;
114def : ReadAdvance<ReadCLZ, 0>;
115def : ReadAdvance<ReadCLZ32, 0>;
116def : ReadAdvance<ReadCTZ, 0>;
117def : ReadAdvance<ReadCTZ32, 0>;
118def : ReadAdvance<ReadCPOP, 0>;
119def : ReadAdvance<ReadCPOP32, 0>;
120def : ReadAdvance<ReadREV8, 0>;
121def : ReadAdvance<ReadORCB, 0>;
122}
123}
124
125multiclass UnsupportedSchedZbc {
126let Unsupported = true in {
127def : WriteRes<WriteCLMUL, []>;
128
129def : ReadAdvance<ReadCLMUL, 0>;
130}
131}
132
133multiclass UnsupportedSchedZbs {
134let Unsupported = true in {
135def : WriteRes<WriteSingleBit, []>;
136def : WriteRes<WriteSingleBitImm, []>;
137def : WriteRes<WriteBEXT, []>;
138def : WriteRes<WriteBEXTI, []>;
139
140def : ReadAdvance<ReadSingleBit, 0>;
141def : ReadAdvance<ReadSingleBitImm, 0>;
142}
143}
144
145multiclass UnsupportedSchedZbkb {
146let Unsupported = true in {
147def : WriteRes<WriteBREV8, []>;
148def : WriteRes<WritePACK, []>;
149def : WriteRes<WritePACK32, []>;
150def : WriteRes<WriteZIP, []>;
151
152def : ReadAdvance<ReadBREV8, 0>;
153def : ReadAdvance<ReadPACK, 0>;
154def : ReadAdvance<ReadPACK32, 0>;
155def : ReadAdvance<ReadZIP, 0>;
156}
157}
158
159multiclass UnsupportedSchedZbkx {
160let Unsupported = true in {
161def : WriteRes<WriteXPERM, []>;
162
163def : ReadAdvance<ReadXPERM, 0>;
164}
165}
166