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