1//=- SystemZScheduleZ196.td - SystemZ Scheduling Definitions ---*- tblgen -*-=//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the machine model for Z196 to support instruction
11// scheduling and other instruction cost heuristics.
12//
13//===----------------------------------------------------------------------===//
14
15def Z196Model : SchedMachineModel {
16
17    let UnsupportedFeatures = Arch9UnsupportedFeatures.List;
18
19    let IssueWidth = 5;
20    let MicroOpBufferSize = 40;     // Issue queues
21    let LoadLatency = 1;            // Optimistic load latency.
22
23    let PostRAScheduler = 1;
24
25    // Extra cycles for a mispredicted branch.
26    let MispredictPenalty = 16;
27}
28
29let SchedModel = Z196Model in  {
30
31// These definitions could be put in a subtarget common include file,
32// but it seems the include system in Tablegen currently rejects
33// multiple includes of same file.
34def : WriteRes<GroupAlone, []> {
35  let NumMicroOps = 0;
36  let BeginGroup  = 1;
37  let EndGroup    = 1;
38}
39def : WriteRes<EndGroup, []> {
40  let NumMicroOps = 0;
41  let EndGroup    = 1;
42}
43def : WriteRes<Lat2, []> { let Latency = 2; let NumMicroOps = 0;}
44def : WriteRes<Lat3, []> { let Latency = 3; let NumMicroOps = 0;}
45def : WriteRes<Lat4, []> { let Latency = 4; let NumMicroOps = 0;}
46def : WriteRes<Lat5, []> { let Latency = 5; let NumMicroOps = 0;}
47def : WriteRes<Lat6, []> { let Latency = 6; let NumMicroOps = 0;}
48def : WriteRes<Lat7, []> { let Latency = 7; let NumMicroOps = 0;}
49def : WriteRes<Lat8, []> { let Latency = 8; let NumMicroOps = 0;}
50def : WriteRes<Lat9, []> { let Latency = 9; let NumMicroOps = 0;}
51def : WriteRes<Lat10, []> { let Latency = 10; let NumMicroOps = 0;}
52def : WriteRes<Lat11, []> { let Latency = 11; let NumMicroOps = 0;}
53def : WriteRes<Lat12, []> { let Latency = 12; let NumMicroOps = 0;}
54def : WriteRes<Lat15, []> { let Latency = 15; let NumMicroOps = 0;}
55def : WriteRes<Lat20, []> { let Latency = 20; let NumMicroOps = 0;}
56def : WriteRes<Lat30, []> { let Latency = 30; let NumMicroOps = 0;}
57
58// Execution units.
59def Z196_FXUnit : ProcResource<2>;
60def Z196_LSUnit : ProcResource<2>;
61def Z196_FPUnit : ProcResource<1>;
62def Z196_DFUnit : ProcResource<1>;
63
64// Subtarget specific definitions of scheduling resources.
65def : WriteRes<FXU,       [Z196_FXUnit]> { let Latency = 1; }
66def : WriteRes<LSU,       [Z196_LSUnit]> { let Latency = 4; }
67def : WriteRes<LSU_lat1,  [Z196_LSUnit]> { let Latency = 1; }
68def : WriteRes<FPU,       [Z196_FPUnit]> { let Latency = 8; }
69def : WriteRes<FPU2,      [Z196_FPUnit, Z196_FPUnit]> { let Latency = 9; }
70def : WriteRes<DFU,       [Z196_DFUnit]> { let Latency = 2; }
71def : WriteRes<DFU2,      [Z196_DFUnit, Z196_DFUnit]> { let Latency = 3; }
72
73// -------------------------- INSTRUCTIONS ---------------------------------- //
74
75// InstRW constructs have been used in order to preserve the
76// readability of the InstrInfo files.
77
78// For each instruction, as matched by a regexp, provide a list of
79// resources that it needs. These will be combined into a SchedClass.
80
81//===----------------------------------------------------------------------===//
82// Stack allocation
83//===----------------------------------------------------------------------===//
84
85def : InstRW<[FXU], (instregex "ADJDYNALLOC$")>; // Pseudo -> LA / LAY
86
87//===----------------------------------------------------------------------===//
88// Branch instructions
89//===----------------------------------------------------------------------===//
90
91// Branch
92def : InstRW<[LSU, EndGroup], (instregex "(Call)?BRC(L)?(Asm.*)?$")>;
93def : InstRW<[LSU, EndGroup], (instregex "(Call)?J(G)?(Asm.*)?$")>;
94def : InstRW<[LSU, EndGroup], (instregex "(Call)?BC(R)?(Asm.*)?$")>;
95def : InstRW<[LSU, EndGroup], (instregex "(Call)?B(R)?(Asm.*)?$")>;
96def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "BRCT(G|H)?$")>;
97def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "BCT(G)?(R)?$")>;
98def : InstRW<[FXU, FXU, FXU, LSU, Lat7, GroupAlone],
99             (instregex "B(R)?X(H|L).*$")>;
100
101// Compare and branch
102def : InstRW<[FXU, LSU, Lat5, GroupAlone],
103             (instregex "C(L)?(G)?(I|R)J(Asm.*)?$")>;
104def : InstRW<[FXU, LSU, Lat5, GroupAlone],
105             (instregex "C(L)?(G)?(I|R)B(Call|Return|Asm.*)?$")>;
106
107//===----------------------------------------------------------------------===//
108// Trap instructions
109//===----------------------------------------------------------------------===//
110
111// Trap
112def : InstRW<[LSU, EndGroup], (instregex "(Cond)?Trap$")>;
113
114// Compare and trap
115def : InstRW<[FXU], (instregex "C(G)?(I|R)T(Asm.*)?$")>;
116def : InstRW<[FXU], (instregex "CL(G)?RT(Asm.*)?$")>;
117def : InstRW<[FXU], (instregex "CL(F|G)IT(Asm.*)?$")>;
118
119//===----------------------------------------------------------------------===//
120// Call and return instructions
121//===----------------------------------------------------------------------===//
122
123// Call
124def : InstRW<[LSU, FXU, FXU, Lat6, GroupAlone], (instregex "(Call)?BRAS$")>;
125def : InstRW<[LSU, FXU, FXU, Lat6, GroupAlone], (instregex "(Call)?BRASL$")>;
126def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "(Call)?BAS(R)?$")>;
127def : InstRW<[LSU, FXU, FXU, Lat6, GroupAlone], (instregex "TLS_(G|L)DCALL$")>;
128
129// Return
130def : InstRW<[LSU_lat1, EndGroup], (instregex "Return$")>;
131def : InstRW<[LSU_lat1, EndGroup], (instregex "CondReturn$")>;
132
133//===----------------------------------------------------------------------===//
134// Select instructions
135//===----------------------------------------------------------------------===//
136
137// Select pseudo
138def : InstRW<[FXU], (instregex "Select(32|64|32Mux)$")>;
139
140// CondStore pseudos
141def : InstRW<[FXU], (instregex "CondStore16(Inv)?$")>;
142def : InstRW<[FXU], (instregex "CondStore16Mux(Inv)?$")>;
143def : InstRW<[FXU], (instregex "CondStore32(Inv)?$")>;
144def : InstRW<[FXU], (instregex "CondStore64(Inv)?$")>;
145def : InstRW<[FXU], (instregex "CondStore8(Inv)?$")>;
146def : InstRW<[FXU], (instregex "CondStore8Mux(Inv)?$")>;
147
148//===----------------------------------------------------------------------===//
149// Move instructions
150//===----------------------------------------------------------------------===//
151
152// Moves
153def : InstRW<[FXU, LSU, Lat5], (instregex "MV(G|H)?HI$")>;
154def : InstRW<[FXU, LSU, Lat5], (instregex "MVI(Y)?$")>;
155
156// Move character
157def : InstRW<[LSU, LSU, LSU, FXU, Lat8, GroupAlone], (instregex "MVC$")>;
158def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVCL(E|U)?$")>;
159
160// Pseudo -> reg move
161def : InstRW<[FXU], (instregex "COPY(_TO_REGCLASS)?$")>;
162def : InstRW<[FXU], (instregex "EXTRACT_SUBREG$")>;
163def : InstRW<[FXU], (instregex "INSERT_SUBREG$")>;
164def : InstRW<[FXU], (instregex "REG_SEQUENCE$")>;
165def : InstRW<[FXU], (instregex "SUBREG_TO_REG$")>;
166
167// Loads
168def : InstRW<[LSU], (instregex "L(Y|FH|RL|Mux)?$")>;
169def : InstRW<[LSU], (instregex "LG(RL)?$")>;
170def : InstRW<[LSU], (instregex "L128$")>;
171
172def : InstRW<[FXU], (instregex "LLIH(F|H|L)$")>;
173def : InstRW<[FXU], (instregex "LLIL(F|H|L)$")>;
174
175def : InstRW<[FXU], (instregex "LG(F|H)I$")>;
176def : InstRW<[FXU], (instregex "LHI(Mux)?$")>;
177def : InstRW<[FXU], (instregex "LR(Mux)?$")>;
178
179// Load and test
180def : InstRW<[FXU, LSU, Lat5], (instregex "LT(G)?$")>;
181def : InstRW<[FXU], (instregex "LT(G)?R$")>;
182
183// Stores
184def : InstRW<[FXU, LSU, Lat5], (instregex "STG(RL)?$")>;
185def : InstRW<[FXU, LSU, Lat5], (instregex "ST128$")>;
186def : InstRW<[FXU, LSU, Lat5], (instregex "ST(Y|FH|RL|Mux)?$")>;
187
188// String moves.
189def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVST$")>;
190
191//===----------------------------------------------------------------------===//
192// Conditional move instructions
193//===----------------------------------------------------------------------===//
194
195def : InstRW<[FXU, Lat2, EndGroup], (instregex "LOC(G)?R(Asm.*)?$")>;
196def : InstRW<[FXU, LSU, Lat6, EndGroup], (instregex "LOC(G)?(Asm.*)?$")>;
197def : InstRW<[FXU, LSU, Lat5, EndGroup], (instregex "STOC(G)?(Asm.*)?$")>;
198
199//===----------------------------------------------------------------------===//
200// Sign extensions
201//===----------------------------------------------------------------------===//
202def : InstRW<[FXU], (instregex "L(B|H|G)R$")>;
203def : InstRW<[FXU], (instregex "LG(B|H|F)R$")>;
204
205def : InstRW<[FXU, LSU, Lat5], (instregex "LTGF$")>;
206def : InstRW<[FXU], (instregex "LTGFR$")>;
207
208def : InstRW<[FXU, LSU, Lat5], (instregex "LB(H|Mux)?$")>;
209def : InstRW<[FXU, LSU, Lat5], (instregex "LH(Y)?$")>;
210def : InstRW<[FXU, LSU, Lat5], (instregex "LH(H|Mux|RL)$")>;
211def : InstRW<[FXU, LSU, Lat5], (instregex "LG(B|H|F)$")>;
212def : InstRW<[FXU, LSU, Lat5], (instregex "LG(H|F)RL$")>;
213
214//===----------------------------------------------------------------------===//
215// Zero extensions
216//===----------------------------------------------------------------------===//
217
218def : InstRW<[FXU], (instregex "LLCR(Mux)?$")>;
219def : InstRW<[FXU], (instregex "LLHR(Mux)?$")>;
220def : InstRW<[FXU], (instregex "LLG(C|F|H|T)R$")>;
221def : InstRW<[LSU], (instregex "LLC(Mux)?$")>;
222def : InstRW<[LSU], (instregex "LLH(Mux)?$")>;
223def : InstRW<[FXU, LSU, Lat5], (instregex "LL(C|H)H$")>;
224def : InstRW<[LSU], (instregex "LLHRL$")>;
225def : InstRW<[LSU], (instregex "LLG(C|F|H|T|FRL|HRL)$")>;
226
227//===----------------------------------------------------------------------===//
228// Truncations
229//===----------------------------------------------------------------------===//
230
231def : InstRW<[FXU, LSU, Lat5], (instregex "STC(H|Y|Mux)?$")>;
232def : InstRW<[FXU, LSU, Lat5], (instregex "STH(H|Y|RL|Mux)?$")>;
233def : InstRW<[FXU, LSU, Lat5], (instregex "STCM(H|Y)?$")>;
234
235//===----------------------------------------------------------------------===//
236// Multi-register moves
237//===----------------------------------------------------------------------===//
238
239// Load multiple (estimated average of 5 ops)
240def : InstRW<[LSU, LSU, LSU, LSU, LSU, Lat10, GroupAlone],
241             (instregex "LM(H|Y|G)?$")>;
242
243// Load multiple disjoint
244def : InstRW<[LSU, Lat30, GroupAlone], (instregex "LMD$")>;
245
246// Store multiple (estimated average of 3 ops)
247def : InstRW<[LSU, LSU, FXU, FXU, FXU, Lat10, GroupAlone],
248             (instregex "STM(H|Y|G)?$")>;
249
250//===----------------------------------------------------------------------===//
251// Byte swaps
252//===----------------------------------------------------------------------===//
253
254def : InstRW<[FXU], (instregex "LRV(G)?R$")>;
255def : InstRW<[FXU, LSU, Lat5], (instregex "LRV(G|H)?$")>;
256def : InstRW<[FXU, LSU, Lat5], (instregex "STRV(G|H)?$")>;
257def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVCIN$")>;
258
259//===----------------------------------------------------------------------===//
260// Load address instructions
261//===----------------------------------------------------------------------===//
262
263def : InstRW<[FXU], (instregex "LA(Y|RL)?$")>;
264
265// Load the Global Offset Table address
266def : InstRW<[FXU], (instregex "GOT$")>;
267
268//===----------------------------------------------------------------------===//
269// Absolute and Negation
270//===----------------------------------------------------------------------===//
271
272def : InstRW<[FXU, Lat2], (instregex "LP(G)?R$")>;
273def : InstRW<[FXU, FXU, Lat3, GroupAlone], (instregex "L(N|P)GFR$")>;
274def : InstRW<[FXU, Lat2], (instregex "LN(R|GR)$")>;
275def : InstRW<[FXU], (instregex "LC(R|GR)$")>;
276def : InstRW<[FXU, FXU, Lat2, GroupAlone], (instregex "LCGFR$")>;
277
278//===----------------------------------------------------------------------===//
279// Insertion
280//===----------------------------------------------------------------------===//
281
282def : InstRW<[FXU, LSU, Lat5], (instregex "IC(Y)?$")>;
283def : InstRW<[FXU, LSU, Lat5], (instregex "IC32(Y)?$")>;
284def : InstRW<[FXU, LSU, Lat5], (instregex "ICM(H|Y)?$")>;
285def : InstRW<[FXU], (instregex "II(F|H|L)Mux$")>;
286def : InstRW<[FXU], (instregex "IIHF(64)?$")>;
287def : InstRW<[FXU], (instregex "IIHH(64)?$")>;
288def : InstRW<[FXU], (instregex "IIHL(64)?$")>;
289def : InstRW<[FXU], (instregex "IILF(64)?$")>;
290def : InstRW<[FXU], (instregex "IILH(64)?$")>;
291def : InstRW<[FXU], (instregex "IILL(64)?$")>;
292
293//===----------------------------------------------------------------------===//
294// Addition
295//===----------------------------------------------------------------------===//
296
297def : InstRW<[FXU, LSU, Lat5], (instregex "A(L)?(Y|SI)?$")>;
298def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "AH(Y)?$")>;
299def : InstRW<[FXU], (instregex "AIH$")>;
300def : InstRW<[FXU], (instregex "AFI(Mux)?$")>;
301def : InstRW<[FXU], (instregex "AGFI$")>;
302def : InstRW<[FXU], (instregex "AGHI(K)?$")>;
303def : InstRW<[FXU], (instregex "AGR(K)?$")>;
304def : InstRW<[FXU], (instregex "AHI(K)?$")>;
305def : InstRW<[FXU], (instregex "AHIMux(K)?$")>;
306def : InstRW<[FXU], (instregex "AL(FI|HSIK)$")>;
307def : InstRW<[FXU, LSU, Lat5], (instregex "ALGF$")>;
308def : InstRW<[FXU], (instregex "ALGHSIK$")>;
309def : InstRW<[FXU], (instregex "ALGF(I|R)$")>;
310def : InstRW<[FXU], (instregex "ALGR(K)?$")>;
311def : InstRW<[FXU], (instregex "ALR(K)?$")>;
312def : InstRW<[FXU], (instregex "AR(K)?$")>;
313def : InstRW<[FXU], (instregex "A(L)?HHHR$")>;
314def : InstRW<[FXU, FXU, Lat3, GroupAlone], (instregex "A(L)?HHLR$")>;
315def : InstRW<[FXU], (instregex "ALSIH(N)?$")>;
316def : InstRW<[FXU, LSU, Lat5], (instregex "A(L)?G(SI)?$")>;
317
318// Logical addition with carry
319def : InstRW<[FXU, LSU, Lat7, GroupAlone], (instregex "ALC(G)?$")>;
320def : InstRW<[FXU, Lat3, GroupAlone], (instregex "ALC(G)?R$")>;
321
322// Add with sign extension (32 -> 64)
323def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "AGF$")>;
324def : InstRW<[FXU, FXU, Lat2, GroupAlone], (instregex "AGFR$")>;
325
326//===----------------------------------------------------------------------===//
327// Subtraction
328//===----------------------------------------------------------------------===//
329
330def : InstRW<[FXU, LSU, Lat5], (instregex "S(G|Y)?$")>;
331def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "SH(Y)?$")>;
332def : InstRW<[FXU], (instregex "SGR(K)?$")>;
333def : InstRW<[FXU], (instregex "SLFI$")>;
334def : InstRW<[FXU, LSU, Lat5], (instregex "SL(G|GF|Y)?$")>;
335def : InstRW<[FXU], (instregex "SLGF(I|R)$")>;
336def : InstRW<[FXU], (instregex "SLGR(K)?$")>;
337def : InstRW<[FXU], (instregex "SLR(K)?$")>;
338def : InstRW<[FXU], (instregex "SR(K)?$")>;
339def : InstRW<[FXU], (instregex "S(L)?HHHR$")>;
340def : InstRW<[FXU, FXU, Lat3, GroupAlone], (instregex "S(L)?HHLR$")>;
341
342// Subtraction with borrow
343def : InstRW<[FXU, LSU, Lat7, GroupAlone], (instregex "SLB(G)?$")>;
344def : InstRW<[FXU, Lat3, GroupAlone], (instregex "SLB(G)?R$")>;
345
346// Subtraction with sign extension (32 -> 64)
347def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "SGF$")>;
348def : InstRW<[FXU, FXU, Lat2, GroupAlone], (instregex "SGFR$")>;
349
350//===----------------------------------------------------------------------===//
351// AND
352//===----------------------------------------------------------------------===//
353
354def : InstRW<[FXU, LSU, Lat5], (instregex "N(G|Y)?$")>;
355def : InstRW<[FXU], (instregex "NGR(K)?$")>;
356def : InstRW<[FXU], (instregex "NI(FMux|HMux|LMux)$")>;
357def : InstRW<[FXU, LSU, Lat5], (instregex "NI(Y)?$")>;
358def : InstRW<[FXU], (instregex "NIHF(64)?$")>;
359def : InstRW<[FXU], (instregex "NIHH(64)?$")>;
360def : InstRW<[FXU], (instregex "NIHL(64)?$")>;
361def : InstRW<[FXU], (instregex "NILF(64)?$")>;
362def : InstRW<[FXU], (instregex "NILH(64)?$")>;
363def : InstRW<[FXU], (instregex "NILL(64)?$")>;
364def : InstRW<[FXU], (instregex "NR(K)?$")>;
365def : InstRW<[LSU, LSU, FXU, Lat9, GroupAlone], (instregex "NC$")>;
366
367//===----------------------------------------------------------------------===//
368// OR
369//===----------------------------------------------------------------------===//
370
371def : InstRW<[FXU, LSU, Lat5], (instregex "O(G|Y)?$")>;
372def : InstRW<[FXU], (instregex "OGR(K)?$")>;
373def : InstRW<[FXU, LSU, Lat5], (instregex "OI(Y)?$")>;
374def : InstRW<[FXU], (instregex "OI(FMux|HMux|LMux)$")>;
375def : InstRW<[FXU], (instregex "OIHF(64)?$")>;
376def : InstRW<[FXU], (instregex "OIHH(64)?$")>;
377def : InstRW<[FXU], (instregex "OIHL(64)?$")>;
378def : InstRW<[FXU], (instregex "OILF(64)?$")>;
379def : InstRW<[FXU], (instregex "OILH(64)?$")>;
380def : InstRW<[FXU], (instregex "OILL(64)?$")>;
381def : InstRW<[FXU], (instregex "OR(K)?$")>;
382def : InstRW<[LSU, LSU, FXU, Lat9, GroupAlone], (instregex "OC$")>;
383
384//===----------------------------------------------------------------------===//
385// XOR
386//===----------------------------------------------------------------------===//
387
388def : InstRW<[FXU, LSU, Lat5], (instregex "X(G|Y)?$")>;
389def : InstRW<[FXU, LSU, Lat5], (instregex "XI(Y)?$")>;
390def : InstRW<[FXU], (instregex "XIFMux$")>;
391def : InstRW<[FXU], (instregex "XGR(K)?$")>;
392def : InstRW<[FXU], (instregex "XIHF(64)?$")>;
393def : InstRW<[FXU], (instregex "XILF(64)?$")>;
394def : InstRW<[FXU], (instregex "XR(K)?$")>;
395def : InstRW<[LSU, LSU, FXU, Lat9, GroupAlone], (instregex "XC$")>;
396
397//===----------------------------------------------------------------------===//
398// Multiplication
399//===----------------------------------------------------------------------===//
400
401def : InstRW<[FXU, LSU, Lat10], (instregex "MS(GF|Y)?$")>;
402def : InstRW<[FXU, Lat6], (instregex "MS(R|FI)$")>;
403def : InstRW<[FXU, LSU, Lat12], (instregex "MSG$")>;
404def : InstRW<[FXU, Lat8], (instregex "MSGR$")>;
405def : InstRW<[FXU, Lat6], (instregex "MSGF(I|R)$")>;
406def : InstRW<[FXU, FXU, LSU, Lat15, GroupAlone], (instregex "MLG$")>;
407def : InstRW<[FXU, FXU, Lat9, GroupAlone], (instregex "MLGR$")>;
408def : InstRW<[FXU, Lat5], (instregex "MGHI$")>;
409def : InstRW<[FXU, Lat5], (instregex "MHI$")>;
410def : InstRW<[FXU, LSU, Lat9], (instregex "MH(Y)?$")>;
411def : InstRW<[FXU, FXU, Lat7, GroupAlone], (instregex "M(L)?R$")>;
412def : InstRW<[FXU, FXU, LSU, Lat7, GroupAlone], (instregex "M(FY|L)?$")>;
413
414//===----------------------------------------------------------------------===//
415// Division and remainder
416//===----------------------------------------------------------------------===//
417
418def : InstRW<[FPU2, FPU2, FXU, FXU, FXU, FXU, FXU, Lat30, GroupAlone],
419              (instregex "DR$")>;
420def : InstRW<[FPU2, FPU2, LSU, FXU, FXU, FXU, FXU, Lat30, GroupAlone],
421              (instregex "D$")>;
422def : InstRW<[FPU2, FPU2, FXU, FXU, FXU, FXU, Lat30, GroupAlone],
423              (instregex "DSG(F)?R$")>;
424def : InstRW<[FPU2, FPU2, LSU, FXU, FXU, FXU, Lat30, GroupAlone],
425              (instregex "DSG(F)?$")>;
426def : InstRW<[FPU2, FPU2, FXU, FXU, FXU, FXU, FXU, Lat30, GroupAlone],
427              (instregex "DL(G)?R$")>;
428def : InstRW<[FPU2, FPU2, LSU, FXU, FXU, FXU, FXU, Lat30, GroupAlone],
429              (instregex "DL(G)?$")>;
430
431//===----------------------------------------------------------------------===//
432// Shifts
433//===----------------------------------------------------------------------===//
434
435def : InstRW<[FXU], (instregex "SLL(G|K)?$")>;
436def : InstRW<[FXU], (instregex "SRL(G|K)?$")>;
437def : InstRW<[FXU], (instregex "SRA(G|K)?$")>;
438def : InstRW<[FXU, Lat2], (instregex "SLA(G|K)?$")>;
439def : InstRW<[FXU, FXU, FXU, FXU, LSU, Lat8, GroupAlone],
440             (instregex "S(L|R)D(A|L)$")>;
441
442// Rotate
443def : InstRW<[FXU, LSU, Lat6], (instregex "RLL(G)?$")>;
444
445// Rotate and insert
446def : InstRW<[FXU], (instregex "RISBG(32)?$")>;
447def : InstRW<[FXU], (instregex "RISBH(G|H|L)$")>;
448def : InstRW<[FXU], (instregex "RISBL(G|H|L)$")>;
449def : InstRW<[FXU], (instregex "RISBMux$")>;
450
451// Rotate and Select
452def : InstRW<[FXU, FXU, Lat3, GroupAlone], (instregex "R(N|O|X)SBG$")>;
453
454//===----------------------------------------------------------------------===//
455// Comparison
456//===----------------------------------------------------------------------===//
457
458def : InstRW<[FXU, LSU, Lat5], (instregex "C(G|Y|Mux|RL)?$")>;
459def : InstRW<[FXU], (instregex "C(F|H)I(Mux)?$")>;
460def : InstRW<[FXU], (instregex "CG(F|H)I$")>;
461def : InstRW<[FXU, LSU, Lat5], (instregex "CG(HSI|RL)$")>;
462def : InstRW<[FXU], (instregex "C(G)?R$")>;
463def : InstRW<[FXU], (instregex "CIH$")>;
464def : InstRW<[FXU, LSU, Lat5], (instregex "CH(F|SI)$")>;
465def : InstRW<[FXU, LSU, Lat5], (instregex "CL(Y|Mux|FHSI)?$")>;
466def : InstRW<[FXU], (instregex "CLFI(Mux)?$")>;
467def : InstRW<[FXU, LSU, Lat5], (instregex "CLG(HRL|HSI)?$")>;
468def : InstRW<[FXU, LSU, Lat5], (instregex "CLGF(RL)?$")>;
469def : InstRW<[FXU], (instregex "CLGF(I|R)$")>;
470def : InstRW<[FXU], (instregex "CLGR$")>;
471def : InstRW<[FXU, LSU, Lat5], (instregex "CLGRL$")>;
472def : InstRW<[FXU, LSU, Lat5], (instregex "CLH(F|RL|HSI)$")>;
473def : InstRW<[FXU], (instregex "CLIH$")>;
474def : InstRW<[FXU, LSU, Lat5], (instregex "CLI(Y)?$")>;
475def : InstRW<[FXU], (instregex "CLR$")>;
476def : InstRW<[FXU, LSU, Lat5], (instregex "CLRL$")>;
477def : InstRW<[FXU], (instregex "C(L)?HHR$")>;
478def : InstRW<[FXU, FXU, Lat3, GroupAlone], (instregex "C(L)?HLR$")>;
479
480// Compare halfword
481def : InstRW<[FXU, LSU, FXU, Lat6, GroupAlone], (instregex "CH(Y|RL)?$")>;
482def : InstRW<[FXU, LSU, FXU, Lat6, GroupAlone], (instregex "CGH(RL)?$")>;
483def : InstRW<[FXU, LSU, FXU, Lat6, GroupAlone], (instregex "CHHSI$")>;
484
485// Compare with sign extension (32 -> 64)
486def : InstRW<[FXU, FXU, LSU, Lat6, Lat2, GroupAlone], (instregex "CGF(RL)?$")>;
487def : InstRW<[FXU, FXU, Lat2, GroupAlone], (instregex "CGFR$")>;
488
489// Compare logical character
490def : InstRW<[LSU, LSU, FXU, Lat9, GroupAlone], (instregex "CLC$")>;
491def : InstRW<[LSU, Lat30, GroupAlone], (instregex "CLCL(E|U)?$")>;
492def : InstRW<[LSU, Lat30, GroupAlone], (instregex "CLST$")>;
493
494// Test under mask
495def : InstRW<[FXU, LSU, Lat5], (instregex "TM(Y)?$")>;
496def : InstRW<[FXU], (instregex "TM(H|L)Mux$")>;
497def : InstRW<[FXU], (instregex "TMHH(64)?$")>;
498def : InstRW<[FXU], (instregex "TMHL(64)?$")>;
499def : InstRW<[FXU], (instregex "TMLH(64)?$")>;
500def : InstRW<[FXU], (instregex "TMLL(64)?$")>;
501
502// Compare logical characters under mask
503def : InstRW<[FXU, FXU, LSU, Lat5, GroupAlone], (instregex "CLM(H|Y)?$")>;
504
505//===----------------------------------------------------------------------===//
506// Prefetch
507//===----------------------------------------------------------------------===//
508
509def : InstRW<[LSU, GroupAlone], (instregex "PFD(RL)?$")>;
510
511//===----------------------------------------------------------------------===//
512// Atomic operations
513//===----------------------------------------------------------------------===//
514
515def : InstRW<[LSU, EndGroup], (instregex "Serialize$")>;
516
517def : InstRW<[FXU, LSU, Lat5], (instregex "LAA(G)?$")>;
518def : InstRW<[FXU, LSU, Lat5], (instregex "LAAL(G)?$")>;
519def : InstRW<[FXU, LSU, Lat5], (instregex "LAN(G)?$")>;
520def : InstRW<[FXU, LSU, Lat5], (instregex "LAO(G)?$")>;
521def : InstRW<[FXU, LSU, Lat5], (instregex "LAX(G)?$")>;
522
523// Test and set
524def : InstRW<[FXU, LSU, Lat5, EndGroup], (instregex "TS$")>;
525
526// Compare and swap
527def : InstRW<[FXU, LSU, FXU, Lat6, GroupAlone], (instregex "CS(G|Y)?$")>;
528
529// Compare double and swap
530def : InstRW<[FXU, FXU, FXU, FXU, FXU, LSU, Lat10, GroupAlone],
531             (instregex "CDS(Y)?$")>;
532def : InstRW<[FXU, FXU, FXU, FXU, FXU, FXU, LSU, LSU, Lat12, GroupAlone],
533             (instregex "CDSG$")>;
534
535// Compare and swap and store
536def : InstRW<[FXU, LSU, Lat30], (instregex "CSST$")>;
537
538// Perform locked operation
539def : InstRW<[LSU, Lat30, GroupAlone], (instregex "PLO$")>;
540
541// Load/store pair from/to quadword
542def : InstRW<[LSU, LSU, Lat5, GroupAlone], (instregex "LPQ$")>;
543def : InstRW<[FXU, FXU, LSU, LSU, Lat6, GroupAlone], (instregex "STPQ$")>;
544
545// Load pair disjoint
546def : InstRW<[LSU, LSU, Lat5, GroupAlone], (instregex "LPD(G)?$")>;
547
548//===----------------------------------------------------------------------===//
549// Translate and convert
550//===----------------------------------------------------------------------===//
551
552def : InstRW<[LSU, Lat30, GroupAlone], (instregex "TR$")>;
553def : InstRW<[LSU, Lat30, GroupAlone], (instregex "TRT$")>;
554def : InstRW<[FXU, LSU, Lat30], (instregex "TRTR$")>;
555def : InstRW<[FXU, Lat30], (instregex "TR(TR)?(T)?(E|EOpt)?$")>;
556def : InstRW<[LSU, Lat30], (instregex "TR(T|O)(T|O)(Opt)?$")>;
557def : InstRW<[FXU, Lat30], (instregex "CU(12|14|21|24|41|42)(Opt)?$")>;
558def : InstRW<[FXU, Lat30], (instregex "(CUUTF|CUTFU)(Opt)?$")>;
559
560//===----------------------------------------------------------------------===//
561// Message-security assist
562//===----------------------------------------------------------------------===//
563
564def : InstRW<[FXU, Lat30], (instregex "KM(C|F|O|CTR)?$")>;
565def : InstRW<[FXU, Lat30], (instregex "(KIMD|KLMD|KMAC|PCC)$")>;
566
567//===----------------------------------------------------------------------===//
568// Decimal arithmetic
569//===----------------------------------------------------------------------===//
570
571def : InstRW<[FXU, DFU2, LSU, LSU, Lat30, GroupAlone], (instregex "CVBG$")>;
572def : InstRW<[FXU, DFU, LSU, Lat30, GroupAlone], (instregex "CVB(Y)?$")>;
573def : InstRW<[FXU, FXU, FXU, DFU2, DFU2, LSU, Lat30, GroupAlone],
574             (instregex "CVDG$")>;
575def : InstRW<[FXU, FXU, DFU, LSU, Lat30, GroupAlone], (instregex "CVD(Y)?$")>;
576def : InstRW<[LSU, Lat10, GroupAlone], (instregex "MVO$")>;
577def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MV(N|Z)$")>;
578def : InstRW<[LSU, Lat30, GroupAlone], (instregex "(PACK|PKA|PKU)$")>;
579def : InstRW<[LSU, Lat30, GroupAlone], (instregex "UNPK$")>;
580def : InstRW<[LSU, Lat12, GroupAlone], (instregex "UNPK(A|U)$")>;
581
582def : InstRW<[FXU, DFU2, DFU2, LSU, LSU, Lat15, GroupAlone],
583             (instregex "(A|S|ZA)P$")>;
584def : InstRW<[FXU, DFU2, DFU2, LSU, LSU, Lat30, GroupAlone],
585             (instregex "(M|D)P$")>;
586def : InstRW<[FXU, FXU, DFU2, DFU2, LSU, LSU, LSU, Lat15, GroupAlone],
587             (instregex "SRP$")>;
588def : InstRW<[DFU2, DFU2, LSU, LSU, Lat11, GroupAlone], (instregex "CP$")>;
589def : InstRW<[DFU2, LSU, LSU, GroupAlone], (instregex "TP$")>;
590def : InstRW<[LSU, Lat30, GroupAlone], (instregex "ED(MK)?$")>;
591
592//===----------------------------------------------------------------------===//
593// Access registers
594//===----------------------------------------------------------------------===//
595
596// Extract/set/copy access register
597def : InstRW<[LSU], (instregex "(EAR|SAR|CPYA)$")>;
598
599// Load address extended
600def : InstRW<[LSU, FXU, Lat5, GroupAlone], (instregex "LAE(Y)?$")>;
601
602// Load/store access multiple (not modeled precisely)
603def : InstRW<[LSU, Lat30, GroupAlone], (instregex "(L|ST)AM(Y)?$")>;
604
605//===----------------------------------------------------------------------===//
606// Program mask and addressing mode
607//===----------------------------------------------------------------------===//
608
609// Insert Program Mask
610def : InstRW<[FXU, Lat3, EndGroup], (instregex "IPM$")>;
611
612// Set Program Mask
613def : InstRW<[LSU, EndGroup], (instregex "SPM$")>;
614
615// Branch and link
616def : InstRW<[FXU, FXU, LSU, Lat8, GroupAlone], (instregex "BAL(R)?$")>;
617
618// Test addressing mode
619def : InstRW<[FXU], (instregex "TAM$")>;
620
621// Set addressing mode
622def : InstRW<[LSU, EndGroup], (instregex "SAM(24|31|64)$")>;
623
624// Branch (and save) and set mode.
625def : InstRW<[FXU, LSU, Lat5, GroupAlone], (instregex "BSM$")>;
626def : InstRW<[FXU, FXU, LSU, Lat6, GroupAlone], (instregex "BASSM$")>;
627
628//===----------------------------------------------------------------------===//
629// Miscellaneous Instructions.
630//===----------------------------------------------------------------------===//
631
632// Find leftmost one
633def : InstRW<[FXU, FXU, Lat7, GroupAlone], (instregex "FLOGR$")>;
634
635// Population count
636def : InstRW<[FXU, Lat3], (instregex "POPCNT$")>;
637
638// Extend
639def : InstRW<[FXU], (instregex "AEXT128$")>;
640def : InstRW<[FXU], (instregex "ZEXT128$")>;
641
642// String instructions
643def : InstRW<[FXU, LSU, Lat30], (instregex "SRST$")>;
644def : InstRW<[FXU, Lat30], (instregex "SRSTU$")>;
645def : InstRW<[LSU, Lat30, GroupAlone], (instregex "CUSE$")>;
646
647// Various complex instructions
648def : InstRW<[LSU, Lat30], (instregex "CFC$")>;
649def : InstRW<[FXU, LSU, Lat30], (instregex "UPT$")>;
650def : InstRW<[LSU, Lat30], (instregex "CKSM$")>;
651def : InstRW<[FXU, Lat30], (instregex "CMPSC$")>;
652
653// Execute
654def : InstRW<[LSU, GroupAlone], (instregex "EX(RL)?$")>;
655
656//===----------------------------------------------------------------------===//
657// .insn directive instructions
658//===----------------------------------------------------------------------===//
659
660// An "empty" sched-class will be assigned instead of the "invalid sched-class".
661// getNumDecoderSlots() will then return 1 instead of 0.
662def : InstRW<[], (instregex "Insn.*")>;
663
664
665// ----------------------------- Floating point ----------------------------- //
666
667//===----------------------------------------------------------------------===//
668// FP: Select instructions
669//===----------------------------------------------------------------------===//
670
671def : InstRW<[FXU], (instregex "SelectF(32|64|128)$")>;
672def : InstRW<[FXU], (instregex "CondStoreF32(Inv)?$")>;
673def : InstRW<[FXU], (instregex "CondStoreF64(Inv)?$")>;
674
675//===----------------------------------------------------------------------===//
676// FP: Move instructions
677//===----------------------------------------------------------------------===//
678
679// Load zero
680def : InstRW<[FXU], (instregex "LZ(DR|ER)$")>;
681def : InstRW<[FXU, FXU, Lat2, GroupAlone], (instregex "LZXR$")>;
682
683// Load
684def : InstRW<[FXU], (instregex "LER$")>;
685def : InstRW<[FXU], (instregex "LD(R|R32|GR)$")>;
686def : InstRW<[FXU, Lat3], (instregex "LGDR$")>;
687def : InstRW<[FXU, FXU, Lat2, GroupAlone], (instregex "LXR$")>;
688
689// Load and Test
690def : InstRW<[FPU], (instregex "LT(D|E)BR$")>;
691def : InstRW<[FPU], (instregex "LTEBRCompare(_VecPseudo)?$")>;
692def : InstRW<[FPU], (instregex "LTDBRCompare(_VecPseudo)?$")>;
693def : InstRW<[FPU2, FPU2, Lat9, GroupAlone], (instregex "LTXBR$")>;
694def : InstRW<[FPU2, FPU2, Lat9, GroupAlone],
695             (instregex "LTXBRCompare(_VecPseudo)?$")>;
696
697// Copy sign
698def : InstRW<[FXU, FXU, Lat5, GroupAlone], (instregex "CPSDRd(d|s)$")>;
699def : InstRW<[FXU, FXU, Lat5, GroupAlone], (instregex "CPSDRs(d|s)$")>;
700
701//===----------------------------------------------------------------------===//
702// FP: Load instructions
703//===----------------------------------------------------------------------===//
704
705def : InstRW<[LSU], (instregex "LE(Y)?$")>;
706def : InstRW<[LSU], (instregex "LD(Y|E32)?$")>;
707def : InstRW<[LSU], (instregex "LX$")>;
708
709//===----------------------------------------------------------------------===//
710// FP: Store instructions
711//===----------------------------------------------------------------------===//
712
713def : InstRW<[FXU, LSU, Lat7], (instregex "STD(Y)?$")>;
714def : InstRW<[FXU, LSU, Lat7], (instregex "STE(Y)?$")>;
715def : InstRW<[FXU, LSU, Lat5], (instregex "STX$")>;
716
717//===----------------------------------------------------------------------===//
718// FP: Conversion instructions
719//===----------------------------------------------------------------------===//
720
721// Load rounded
722def : InstRW<[FPU], (instregex "LEDBR(A)?$")>;
723def : InstRW<[FPU, FPU, Lat20], (instregex "LEXBR(A)?$")>;
724def : InstRW<[FPU, FPU, Lat20], (instregex "LDXBR(A)?$")>;
725
726// Load lengthened
727def : InstRW<[FPU, LSU, Lat12], (instregex "LDEB$")>;
728def : InstRW<[FPU], (instregex "LDEBR$")>;
729def : InstRW<[FPU2, FPU2, LSU, Lat15, GroupAlone], (instregex "LX(D|E)B$")>;
730def : InstRW<[FPU2, FPU2, Lat10, GroupAlone], (instregex "LX(D|E)BR$")>;
731
732// Convert from fixed / logical
733def : InstRW<[FXU, FPU, Lat9, GroupAlone], (instregex "CE(F|G)BR(A)?$")>;
734def : InstRW<[FXU, FPU, Lat9, GroupAlone], (instregex "CD(F|G)BR(A)?$")>;
735def : InstRW<[FXU, FPU2, FPU2, Lat11, GroupAlone], (instregex "CX(F|G)BR(A)?$")>;
736def : InstRW<[FXU, FPU, Lat9, GroupAlone], (instregex "CEL(F|G)BR$")>;
737def : InstRW<[FXU, FPU, Lat9, GroupAlone], (instregex "CDL(F|G)BR$")>;
738def : InstRW<[FXU, FPU2, FPU2, Lat11, GroupAlone], (instregex "CXL(F|G)BR$")>;
739
740// Convert to fixed / logical
741def : InstRW<[FXU, FPU, Lat12, GroupAlone], (instregex "CF(E|D)BR(A)?$")>;
742def : InstRW<[FXU, FPU, Lat12, GroupAlone], (instregex "CG(E|D)BR(A)?$")>;
743def : InstRW<[FXU, FPU, FPU, Lat20, GroupAlone], (instregex "C(F|G)XBR(A)?$")>;
744def : InstRW<[FXU, FPU, Lat11, GroupAlone], (instregex "CLF(E|D)BR$")>;
745def : InstRW<[FXU, FPU, Lat11, GroupAlone], (instregex "CLG(E|D)BR$")>;
746def : InstRW<[FXU, FPU, FPU, Lat20, GroupAlone], (instregex "CL(F|G)XBR$")>;
747
748//===----------------------------------------------------------------------===//
749// FP: Unary arithmetic
750//===----------------------------------------------------------------------===//
751
752// Load Complement / Negative / Positive
753def : InstRW<[FPU], (instregex "L(C|N|P)DBR$")>;
754def : InstRW<[FPU], (instregex "L(C|N|P)EBR$")>;
755def : InstRW<[FXU], (instregex "LCDFR(_32)?$")>;
756def : InstRW<[FXU], (instregex "LNDFR(_32)?$")>;
757def : InstRW<[FXU], (instregex "LPDFR(_32)?$")>;
758def : InstRW<[FPU2, FPU2, Lat9, GroupAlone], (instregex "L(C|N|P)XBR$")>;
759
760// Square root
761def : InstRW<[FPU, LSU, Lat30], (instregex "SQ(E|D)B$")>;
762def : InstRW<[FPU, Lat30], (instregex "SQ(E|D)BR$")>;
763def : InstRW<[FPU2, FPU2, Lat30, GroupAlone], (instregex "SQXBR$")>;
764
765// Load FP integer
766def : InstRW<[FPU], (instregex "FIEBR(A)?$")>;
767def : InstRW<[FPU], (instregex "FIDBR(A)?$")>;
768def : InstRW<[FPU2, FPU2, Lat15, GroupAlone], (instregex "FIXBR(A)?$")>;
769
770//===----------------------------------------------------------------------===//
771// FP: Binary arithmetic
772//===----------------------------------------------------------------------===//
773
774// Addition
775def : InstRW<[FPU, LSU, Lat12], (instregex "A(E|D)B$")>;
776def : InstRW<[FPU], (instregex "A(E|D)BR$")>;
777def : InstRW<[FPU2, FPU2, Lat20, GroupAlone], (instregex "AXBR$")>;
778
779// Subtraction
780def : InstRW<[FPU, LSU, Lat12], (instregex "S(E|D)B$")>;
781def : InstRW<[FPU], (instregex "S(E|D)BR$")>;
782def : InstRW<[FPU2, FPU2, Lat20, GroupAlone], (instregex "SXBR$")>;
783
784// Multiply
785def : InstRW<[FPU, LSU, Lat12], (instregex "M(D|DE|EE)B$")>;
786def : InstRW<[FPU], (instregex "M(D|DE|EE)BR$")>;
787def : InstRW<[FPU2, FPU2, LSU, Lat15, GroupAlone], (instregex "MXDB$")>;
788def : InstRW<[FPU2, FPU2, Lat10, GroupAlone], (instregex "MXDBR$")>;
789def : InstRW<[FPU2, FPU2, Lat30, GroupAlone], (instregex "MXBR$")>;
790
791// Multiply and add / subtract
792def : InstRW<[FPU, FPU, LSU, Lat12, GroupAlone], (instregex "M(A|S)EB$")>;
793def : InstRW<[FPU, GroupAlone], (instregex "M(A|S)EBR$")>;
794def : InstRW<[FPU, FPU, LSU, Lat12, GroupAlone], (instregex "M(A|S)DB$")>;
795def : InstRW<[FPU, GroupAlone], (instregex "M(A|S)DBR$")>;
796
797// Division
798def : InstRW<[FPU, LSU, Lat30], (instregex "D(E|D)B$")>;
799def : InstRW<[FPU, Lat30], (instregex "D(E|D)BR$")>;
800def : InstRW<[FPU2, FPU2, Lat30, GroupAlone], (instregex "DXBR$")>;
801
802// Divide to integer
803def : InstRW<[FPU, Lat30], (instregex "DI(E|D)BR$")>;
804
805//===----------------------------------------------------------------------===//
806// FP: Comparisons
807//===----------------------------------------------------------------------===//
808
809// Compare
810def : InstRW<[FPU, LSU, Lat12], (instregex "(K|C)(E|D)B$")>;
811def : InstRW<[FPU], (instregex "(K|C)(E|D)BR$")>;
812def : InstRW<[FPU, FPU, Lat30], (instregex "(K|C)XBR$")>;
813
814// Test Data Class
815def : InstRW<[FPU, LSU, Lat15], (instregex "TC(E|D)B$")>;
816def : InstRW<[FPU2, FPU2, LSU, Lat15, GroupAlone], (instregex "TCXB$")>;
817
818//===----------------------------------------------------------------------===//
819// FP: Floating-point control register instructions
820//===----------------------------------------------------------------------===//
821
822def : InstRW<[FXU, LSU, Lat4, GroupAlone], (instregex "EFPC$")>;
823def : InstRW<[LSU, Lat3, GroupAlone], (instregex "SFPC$")>;
824def : InstRW<[LSU, LSU, Lat6, GroupAlone], (instregex "LFPC$")>;
825def : InstRW<[FXU, LSU, Lat3, GroupAlone], (instregex "STFPC$")>;
826def : InstRW<[FXU, Lat30], (instregex "SFASR$")>;
827def : InstRW<[FXU, LSU, Lat30], (instregex "LFAS$")>;
828def : InstRW<[FXU, Lat2, GroupAlone], (instregex "SRNM(B|T)?$")>;
829
830
831// --------------------- Hexadecimal floating point ------------------------- //
832
833//===----------------------------------------------------------------------===//
834// HFP: Move instructions
835//===----------------------------------------------------------------------===//
836
837// Load and Test
838def : InstRW<[FPU], (instregex "LT(D|E)R$")>;
839def : InstRW<[FPU2, FPU2, Lat9, GroupAlone], (instregex "LTXR$")>;
840
841//===----------------------------------------------------------------------===//
842// HFP: Conversion instructions
843//===----------------------------------------------------------------------===//
844
845// Load rounded
846def : InstRW<[FPU], (instregex "(LEDR|LRER)$")>;
847def : InstRW<[FPU], (instregex "LEXR$")>;
848def : InstRW<[FPU], (instregex "(LDXR|LRDR)$")>;
849
850// Load lengthened
851def : InstRW<[LSU], (instregex "LDE$")>;
852def : InstRW<[FXU], (instregex "LDER$")>;
853def : InstRW<[FPU2, FPU2, LSU, Lat15, GroupAlone], (instregex "LX(D|E)$")>;
854def : InstRW<[FPU2, FPU2, Lat10, GroupAlone], (instregex "LX(D|E)R$")>;
855
856// Convert from fixed
857def : InstRW<[FXU, FPU, Lat9, GroupAlone], (instregex "CE(F|G)R$")>;
858def : InstRW<[FXU, FPU, Lat9, GroupAlone], (instregex "CD(F|G)R$")>;
859def : InstRW<[FXU, FPU2, FPU2, Lat11, GroupAlone], (instregex "CX(F|G)R$")>;
860
861// Convert to fixed
862def : InstRW<[FXU, FPU, Lat12, GroupAlone], (instregex "CF(E|D)R$")>;
863def : InstRW<[FXU, FPU, Lat12, GroupAlone], (instregex "CG(E|D)R$")>;
864def : InstRW<[FXU, FPU, FPU, Lat20, GroupAlone], (instregex "C(F|G)XR$")>;
865
866// Convert BFP to HFP / HFP to BFP.
867def : InstRW<[FPU], (instregex "THD(E)?R$")>;
868def : InstRW<[FPU], (instregex "TB(E)?DR$")>;
869
870//===----------------------------------------------------------------------===//
871// HFP: Unary arithmetic
872//===----------------------------------------------------------------------===//
873
874// Load Complement / Negative / Positive
875def : InstRW<[FPU], (instregex "L(C|N|P)DR$")>;
876def : InstRW<[FPU], (instregex "L(C|N|P)ER$")>;
877def : InstRW<[FPU2, FPU2, Lat9, GroupAlone], (instregex "L(C|N|P)XR$")>;
878
879// Halve
880def : InstRW<[FPU], (instregex "H(E|D)R$")>;
881
882// Square root
883def : InstRW<[FPU, LSU, Lat30], (instregex "SQ(E|D)$")>;
884def : InstRW<[FPU, Lat30], (instregex "SQ(E|D)R$")>;
885def : InstRW<[FPU2, FPU2, Lat30, GroupAlone], (instregex "SQXR$")>;
886
887// Load FP integer
888def : InstRW<[FPU], (instregex "FIER$")>;
889def : InstRW<[FPU], (instregex "FIDR$")>;
890def : InstRW<[FPU2, FPU2, Lat15, GroupAlone], (instregex "FIXR$")>;
891
892//===----------------------------------------------------------------------===//
893// HFP: Binary arithmetic
894//===----------------------------------------------------------------------===//
895
896// Addition
897def : InstRW<[FPU, LSU, Lat12], (instregex "A(E|D|U|W)$")>;
898def : InstRW<[FPU], (instregex "A(E|D|U|W)R$")>;
899def : InstRW<[FPU2, FPU2, Lat20, GroupAlone], (instregex "AXR$")>;
900
901// Subtraction
902def : InstRW<[FPU, LSU, Lat12], (instregex "S(E|D|U|W)$")>;
903def : InstRW<[FPU], (instregex "S(E|D|U|W)R$")>;
904def : InstRW<[FPU2, FPU2, Lat20, GroupAlone], (instregex "SXR$")>;
905
906// Multiply
907def : InstRW<[FPU, LSU, Lat12], (instregex "M(D|DE|E|EE)$")>;
908def : InstRW<[FPU], (instregex "M(D|DE|E|EE)R$")>;
909def : InstRW<[FPU2, FPU2, LSU, Lat15, GroupAlone], (instregex "MXD$")>;
910def : InstRW<[FPU2, FPU2, Lat10, GroupAlone], (instregex "MXDR$")>;
911def : InstRW<[FPU2, FPU2, Lat30, GroupAlone], (instregex "MXR$")>;
912def : InstRW<[FPU2, FPU2, LSU, Lat15, GroupAlone], (instregex "MY$")>;
913def : InstRW<[FPU, FPU, LSU, Lat15, GroupAlone], (instregex "MY(H|L)$")>;
914def : InstRW<[FPU2, FPU2,  Lat10, GroupAlone], (instregex "MYR$")>;
915def : InstRW<[FPU, Lat10, GroupAlone], (instregex "MY(H|L)R$")>;
916
917// Multiply and add / subtract
918def : InstRW<[FPU, FPU, LSU, Lat12, GroupAlone], (instregex "M(A|S)E$")>;
919def : InstRW<[FPU, GroupAlone], (instregex "M(A|S)ER$")>;
920def : InstRW<[FPU, FPU, LSU, Lat12, GroupAlone], (instregex "M(A|S)D$")>;
921def : InstRW<[FPU, GroupAlone], (instregex "M(A|S)DR$")>;
922def : InstRW<[FPU2, FPU2, LSU, GroupAlone], (instregex "MAY$")>;
923def : InstRW<[FPU2, FPU2, GroupAlone], (instregex "MAYR$")>;
924def : InstRW<[FPU, FPU, LSU, Lat12, GroupAlone], (instregex "MAY(H|L)$")>;
925def : InstRW<[FPU, GroupAlone], (instregex "MAY(H|L)R$")>;
926
927// Division
928def : InstRW<[FPU, LSU, Lat30], (instregex "D(E|D)$")>;
929def : InstRW<[FPU, Lat30], (instregex "D(E|D)R$")>;
930def : InstRW<[FPU2, FPU2, Lat30, GroupAlone], (instregex "DXR$")>;
931
932//===----------------------------------------------------------------------===//
933// HFP: Comparisons
934//===----------------------------------------------------------------------===//
935
936// Compare
937def : InstRW<[FPU, LSU, Lat12], (instregex "C(E|D)$")>;
938def : InstRW<[FPU], (instregex "C(E|D)R$")>;
939def : InstRW<[FPU, FPU, Lat15], (instregex "CXR$")>;
940
941
942// ------------------------ Decimal floating point -------------------------- //
943
944//===----------------------------------------------------------------------===//
945// DFP: Move instructions
946//===----------------------------------------------------------------------===//
947
948// Load and Test
949def : InstRW<[DFU, Lat20], (instregex "LTDTR$")>;
950def : InstRW<[DFU2, DFU2, Lat20, GroupAlone], (instregex "LTXTR$")>;
951
952//===----------------------------------------------------------------------===//
953// DFP: Conversion instructions
954//===----------------------------------------------------------------------===//
955
956// Load rounded
957def : InstRW<[DFU, Lat30], (instregex "LEDTR$")>;
958def : InstRW<[DFU, DFU, Lat30], (instregex "LDXTR$")>;
959
960// Load lengthened
961def : InstRW<[DFU, Lat20], (instregex "LDETR$")>;
962def : InstRW<[DFU2, DFU2, Lat20, GroupAlone], (instregex "LXDTR$")>;
963
964// Convert from fixed / logical
965def : InstRW<[FXU, DFU, Lat9, GroupAlone], (instregex "CDFTR$")>;
966def : InstRW<[FXU, DFU, Lat30, GroupAlone], (instregex "CDGTR(A)?$")>;
967def : InstRW<[FXU, DFU2, DFU2, GroupAlone], (instregex "CXFTR$")>;
968def : InstRW<[FXU, DFU2, DFU2, Lat30, GroupAlone], (instregex "CXGTR(A)?$")>;
969def : InstRW<[FXU, DFU, Lat11, GroupAlone], (instregex "CDL(F|G)TR$")>;
970def : InstRW<[FXU, DFU2, DFU2, Lat11, GroupAlone], (instregex "CXLFTR$")>;
971def : InstRW<[FXU, DFU2, DFU2, Lat6, GroupAlone], (instregex "CXLGTR$")>;
972
973// Convert to fixed / logical
974def : InstRW<[FXU, DFU, Lat11, GroupAlone], (instregex "CFDTR(A)?$")>;
975def : InstRW<[FXU, DFU, Lat30, GroupAlone], (instregex "CGDTR(A)?$")>;
976def : InstRW<[FXU, DFU, DFU, Lat11, GroupAlone], (instregex "CFXTR$")>;
977def : InstRW<[FXU, DFU, DFU, Lat30, GroupAlone], (instregex "CGXTR(A)?$")>;
978def : InstRW<[FXU, DFU, Lat11, GroupAlone], (instregex "CL(F|G)DTR$")>;
979def : InstRW<[FXU, DFU, DFU, Lat11, GroupAlone], (instregex "CL(F|G)XTR$")>;
980
981// Convert from / to signed / unsigned packed
982def : InstRW<[FXU, DFU, Lat12, GroupAlone], (instregex "CD(S|U)TR$")>;
983def : InstRW<[FXU, FXU, DFU2, DFU2, Lat20, GroupAlone], (instregex "CX(S|U)TR$")>;
984def : InstRW<[FXU, DFU, Lat12, GroupAlone], (instregex "C(S|U)DTR$")>;
985def : InstRW<[FXU, FXU, DFU2, DFU2, Lat20, GroupAlone], (instregex "C(S|U)XTR$")>;
986
987// Perform floating-point operation
988def : InstRW<[FXU, Lat30], (instregex "PFPO$")>;
989
990//===----------------------------------------------------------------------===//
991// DFP: Unary arithmetic
992//===----------------------------------------------------------------------===//
993
994// Load FP integer
995def : InstRW<[DFU, Lat20], (instregex "FIDTR$")>;
996def : InstRW<[DFU2, DFU2, Lat20, GroupAlone], (instregex "FIXTR$")>;
997
998// Extract biased exponent
999def : InstRW<[FXU, DFU, Lat15, GroupAlone], (instregex "EEDTR$")>;
1000def : InstRW<[FXU, DFU2, Lat15, GroupAlone], (instregex "EEXTR$")>;
1001
1002// Extract significance
1003def : InstRW<[FXU, DFU, Lat15, GroupAlone], (instregex "ESDTR$")>;
1004def : InstRW<[FXU, DFU, DFU, Lat20, GroupAlone], (instregex "ESXTR$")>;
1005
1006//===----------------------------------------------------------------------===//
1007// DFP: Binary arithmetic
1008//===----------------------------------------------------------------------===//
1009
1010// Addition
1011def : InstRW<[DFU, Lat30], (instregex "ADTR(A)?$")>;
1012def : InstRW<[DFU2, DFU2, Lat30, GroupAlone], (instregex "AXTR(A)?$")>;
1013
1014// Subtraction
1015def : InstRW<[DFU, Lat30], (instregex "SDTR(A)?$")>;
1016def : InstRW<[DFU2, DFU2, Lat30, GroupAlone], (instregex "SXTR(A)?$")>;
1017
1018// Multiply
1019def : InstRW<[DFU, Lat30], (instregex "MDTR(A)?$")>;
1020def : InstRW<[DFU2, DFU2, Lat30, GroupAlone], (instregex "MXTR(A)?$")>;
1021
1022// Division
1023def : InstRW<[DFU, Lat30], (instregex "DDTR(A)?$")>;
1024def : InstRW<[DFU2, DFU2, Lat30, GroupAlone], (instregex "DXTR(A)?$")>;
1025
1026// Quantize
1027def : InstRW<[DFU, Lat30], (instregex "QADTR$")>;
1028def : InstRW<[DFU2, DFU2, Lat30, GroupAlone], (instregex "QAXTR$")>;
1029
1030// Reround
1031def : InstRW<[FXU, DFU, Lat30, GroupAlone], (instregex "RRDTR$")>;
1032def : InstRW<[FXU, DFU2, DFU2, Lat30, GroupAlone], (instregex "RRXTR$")>;
1033
1034// Shift significand left/right
1035def : InstRW<[LSU, DFU, Lat11, GroupAlone], (instregex "S(L|R)DT$")>;
1036def : InstRW<[LSU, DFU2, DFU2, Lat15, GroupAlone], (instregex "S(L|R)XT$")>;
1037
1038// Insert biased exponent
1039def : InstRW<[FXU, DFU, Lat11, GroupAlone], (instregex "IEDTR$")>;
1040def : InstRW<[FXU, DFU2, DFU2, Lat15, GroupAlone], (instregex "IEXTR$")>;
1041
1042//===----------------------------------------------------------------------===//
1043// DFP: Comparisons
1044//===----------------------------------------------------------------------===//
1045
1046// Compare
1047def : InstRW<[DFU, Lat11], (instregex "(K|C)DTR$")>;
1048def : InstRW<[DFU, DFU, Lat15], (instregex "(K|C)XTR$")>;
1049
1050// Compare biased exponent
1051def : InstRW<[DFU, Lat8], (instregex "CEDTR$")>;
1052def : InstRW<[DFU2, Lat9], (instregex "CEXTR$")>;
1053
1054// Test Data Class/Group
1055def : InstRW<[LSU, DFU, Lat15], (instregex "TD(C|G)(E|D)T$")>;
1056def : InstRW<[LSU, DFU2, Lat15], (instregex "TD(C|G)XT$")>;
1057
1058
1059// -------------------------------- System ---------------------------------- //
1060
1061//===----------------------------------------------------------------------===//
1062// System: Program-Status Word Instructions
1063//===----------------------------------------------------------------------===//
1064
1065def : InstRW<[FXU, Lat30], (instregex "EPSW$")>;
1066def : InstRW<[FXU, LSU, Lat30], (instregex "LPSW(E)?$")>;
1067def : InstRW<[FXU, Lat3, GroupAlone], (instregex "IPK$")>;
1068def : InstRW<[LSU, EndGroup], (instregex "SPKA$")>;
1069def : InstRW<[LSU, EndGroup], (instregex "SSM$")>;
1070def : InstRW<[FXU, LSU, GroupAlone], (instregex "ST(N|O)SM$")>;
1071def : InstRW<[FXU, Lat3], (instregex "IAC$")>;
1072def : InstRW<[LSU, EndGroup], (instregex "SAC(F)?$")>;
1073
1074//===----------------------------------------------------------------------===//
1075// System: Control Register Instructions
1076//===----------------------------------------------------------------------===//
1077
1078def : InstRW<[FXU, LSU, Lat30], (instregex "LCTL(G)?$")>;
1079def : InstRW<[FXU, LSU, LSU, LSU, LSU, Lat10, GroupAlone],
1080             (instregex "STCT(L|G)$")>;
1081def : InstRW<[LSU], (instregex "E(P|S)A(I)?R$")>;
1082def : InstRW<[FXU, Lat30], (instregex "SSA(I)?R$")>;
1083def : InstRW<[FXU, Lat30], (instregex "ESEA$")>;
1084
1085//===----------------------------------------------------------------------===//
1086// System: Prefix-Register Instructions
1087//===----------------------------------------------------------------------===//
1088
1089def : InstRW<[FXU, LSU, Lat30], (instregex "SPX$")>;
1090def : InstRW<[FXU, LSU, Lat30], (instregex "STPX$")>;
1091
1092//===----------------------------------------------------------------------===//
1093// System: Storage-Key and Real Memory Instructions
1094//===----------------------------------------------------------------------===//
1095
1096def : InstRW<[FXU, Lat30], (instregex "ISKE$")>;
1097def : InstRW<[FXU, Lat30], (instregex "IVSK$")>;
1098def : InstRW<[FXU, Lat30], (instregex "SSKE(Opt)?$")>;
1099def : InstRW<[FXU, Lat30], (instregex "RRB(E|M)$")>;
1100def : InstRW<[FXU, Lat30], (instregex "PFMF$")>;
1101def : InstRW<[FXU, Lat30], (instregex "TB$")>;
1102def : InstRW<[FXU, LSU, Lat30], (instregex "PGIN$")>;
1103def : InstRW<[FXU, LSU, Lat30], (instregex "PGOUT$")>;
1104
1105//===----------------------------------------------------------------------===//
1106// System: Dynamic-Address-Translation Instructions
1107//===----------------------------------------------------------------------===//
1108
1109def : InstRW<[FXU, LSU, Lat30], (instregex "IPTE(Opt)?(Opt)?$")>;
1110def : InstRW<[FXU, Lat30], (instregex "IDTE(Opt)?$")>;
1111def : InstRW<[FXU, Lat30], (instregex "PTLB$")>;
1112def : InstRW<[FXU, LSU, Lat30], (instregex "CSP(G)?$")>;
1113def : InstRW<[FXU, LSU, Lat30], (instregex "LPTEA$")>;
1114def : InstRW<[FXU, LSU, Lat30], (instregex "LRA(Y|G)?$")>;
1115def : InstRW<[FXU, LSU, Lat30], (instregex "STRAG$")>;
1116def : InstRW<[FXU, LSU, Lat30], (instregex "LURA(G)?$")>;
1117def : InstRW<[FXU, LSU, Lat30], (instregex "STUR(A|G)$")>;
1118def : InstRW<[FXU, LSU, Lat30], (instregex "TPROT$")>;
1119
1120//===----------------------------------------------------------------------===//
1121// System: Memory-move Instructions
1122//===----------------------------------------------------------------------===//
1123
1124def : InstRW<[LSU, Lat8, GroupAlone], (instregex "MVC(K|P|S)$")>;
1125def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVCSK$")>;
1126def : InstRW<[LSU, Lat6, GroupAlone], (instregex "MVCDK$")>;
1127def : InstRW<[FXU, LSU, Lat30], (instregex "MVCOS$")>;
1128def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVPG$")>;
1129
1130//===----------------------------------------------------------------------===//
1131// System: Address-Space Instructions
1132//===----------------------------------------------------------------------===//
1133
1134def : InstRW<[FXU, LSU, Lat30], (instregex "LASP$")>;
1135def : InstRW<[LSU, GroupAlone], (instregex "PALB$")>;
1136def : InstRW<[FXU, LSU, Lat30], (instregex "PC$")>;
1137def : InstRW<[FXU, Lat30], (instregex "PR$")>;
1138def : InstRW<[FXU, Lat30], (instregex "PT(I)?$")>;
1139def : InstRW<[FXU, LSU, Lat30], (instregex "RP$")>;
1140def : InstRW<[FXU, Lat30], (instregex "BS(G|A)$")>;
1141def : InstRW<[FXU, Lat20], (instregex "TAR$")>;
1142
1143//===----------------------------------------------------------------------===//
1144// System: Linkage-Stack Instructions
1145//===----------------------------------------------------------------------===//
1146
1147def : InstRW<[FXU, LSU, Lat30, EndGroup], (instregex "BAKR$")>;
1148def : InstRW<[FXU, Lat30], (instregex "EREG(G)?$")>;
1149def : InstRW<[FXU, Lat30], (instregex "(E|M)STA$")>;
1150
1151//===----------------------------------------------------------------------===//
1152// System: Time-Related Instructions
1153//===----------------------------------------------------------------------===//
1154
1155def : InstRW<[FXU, Lat30], (instregex "PTFF$")>;
1156def : InstRW<[FXU, LSU, Lat20], (instregex "SCK$")>;
1157def : InstRW<[FXU, Lat30], (instregex "SCKPF$")>;
1158def : InstRW<[FXU, LSU, Lat20], (instregex "SCKC$")>;
1159def : InstRW<[FXU, LSU, Lat20], (instregex "SPT$")>;
1160def : InstRW<[FXU, LSU, Lat15], (instregex "STCK$")>;
1161def : InstRW<[FXU, LSU, Lat12], (instregex "STCKF$")>;
1162def : InstRW<[FXU, LSU, Lat30], (instregex "STCKE$")>;
1163def : InstRW<[FXU, LSU, Lat9], (instregex "STCKC$")>;
1164def : InstRW<[FXU, LSU, Lat8], (instregex "STPT$")>;
1165
1166//===----------------------------------------------------------------------===//
1167// System: CPU-Related Instructions
1168//===----------------------------------------------------------------------===//
1169
1170def : InstRW<[FXU, LSU, Lat30], (instregex "STAP$")>;
1171def : InstRW<[FXU, LSU, Lat30], (instregex "STIDP$")>;
1172def : InstRW<[FXU, LSU, Lat30], (instregex "STSI$")>;
1173def : InstRW<[FXU, LSU, Lat30], (instregex "STFL(E)?$")>;
1174def : InstRW<[FXU, LSU, Lat30], (instregex "ECAG$")>;
1175def : InstRW<[FXU, LSU, Lat30], (instregex "ECTG$")>;
1176def : InstRW<[FXU, Lat30], (instregex "PTF$")>;
1177def : InstRW<[FXU, Lat30], (instregex "PCKMO$")>;
1178
1179//===----------------------------------------------------------------------===//
1180// System: Miscellaneous Instructions
1181//===----------------------------------------------------------------------===//
1182
1183def : InstRW<[FXU, Lat30], (instregex "SVC$")>;
1184def : InstRW<[FXU, GroupAlone], (instregex "MC$")>;
1185def : InstRW<[FXU, Lat30], (instregex "DIAG$")>;
1186def : InstRW<[FXU, LSU, Lat30], (instregex "TRAC(E|G)$")>;
1187def : InstRW<[FXU, Lat30], (instregex "TRAP(2|4)$")>;
1188def : InstRW<[FXU, Lat30], (instregex "SIGP$")>;
1189def : InstRW<[FXU, LSU, Lat30], (instregex "SIGA$")>;
1190def : InstRW<[FXU, LSU, Lat30], (instregex "SIE$")>;
1191
1192//===----------------------------------------------------------------------===//
1193// System: CPU-Measurement Facility Instructions
1194//===----------------------------------------------------------------------===//
1195
1196def : InstRW<[FXU], (instregex "LPP$")>;
1197def : InstRW<[FXU, Lat30], (instregex "ECPGA$")>;
1198def : InstRW<[FXU, Lat30], (instregex "E(C|P)CTR$")>;
1199def : InstRW<[FXU, Lat30], (instregex "LCCTL$")>;
1200def : InstRW<[FXU, LSU, Lat30], (instregex "L(P|S)CTL$")>;
1201def : InstRW<[FXU, LSU, Lat30], (instregex "Q(S|CTR)I$")>;
1202def : InstRW<[FXU, Lat30], (instregex "S(C|P)CTR$")>;
1203
1204//===----------------------------------------------------------------------===//
1205// System: I/O Instructions
1206//===----------------------------------------------------------------------===//
1207
1208def : InstRW<[FXU, Lat30], (instregex "(C|H|R|X)SCH$")>;
1209def : InstRW<[FXU, LSU, Lat30], (instregex "(M|S|ST|T)SCH$")>;
1210def : InstRW<[FXU, Lat30], (instregex "RCHP$")>;
1211def : InstRW<[FXU, Lat30], (instregex "SCHM$")>;
1212def : InstRW<[FXU, LSU, Lat30], (instregex "STC(PS|RW)$")>;
1213def : InstRW<[FXU, LSU, Lat30], (instregex "TPI$")>;
1214def : InstRW<[FXU, Lat30], (instregex "SAL$")>;
1215
1216}
1217
1218