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