]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/SystemZ/SystemZScheduleZ13.td
Merge llvm, clang, lld, lldb, compiler-rt and libc++ r303197, and update
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / SystemZ / SystemZScheduleZ13.td
1 //-- SystemZScheduleZ13.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 Z13 to support instruction
11 // scheduling and other instruction cost heuristics.
12 //
13 //===----------------------------------------------------------------------===//
14
15 def Z13Model : SchedMachineModel {
16
17     let UnsupportedFeatures = Arch11UnsupportedFeatures.List;
18     
19     let IssueWidth = 8;
20     let MicroOpBufferSize = 60;     // 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 = 20;
27 }
28
29 let SchedModel = Z13Model 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.
34 def : WriteRes<GroupAlone, []> {
35   let NumMicroOps = 0;
36   let BeginGroup  = 1;
37   let EndGroup    = 1;
38 }
39 def : WriteRes<BeginGroup, []> {
40   let NumMicroOps = 0;
41   let BeginGroup  = 1;
42 }
43 def : WriteRes<EndGroup, []> {
44   let NumMicroOps = 0;
45   let EndGroup    = 1;
46 }
47 def : WriteRes<Lat2, []> { let Latency = 2; let NumMicroOps = 0;}
48 def : WriteRes<Lat3, []> { let Latency = 3; let NumMicroOps = 0;}
49 def : WriteRes<Lat4, []> { let Latency = 4; let NumMicroOps = 0;}
50 def : WriteRes<Lat5, []> { let Latency = 5; let NumMicroOps = 0;}
51 def : WriteRes<Lat6, []> { let Latency = 6; let NumMicroOps = 0;}
52 def : WriteRes<Lat7, []> { let Latency = 7; let NumMicroOps = 0;}
53 def : WriteRes<Lat8, []> { let Latency = 8; let NumMicroOps = 0;}
54 def : WriteRes<Lat9, []> { let Latency = 9; let NumMicroOps = 0;}
55 def : WriteRes<Lat10, []> { let Latency = 10; let NumMicroOps = 0;}
56 def : WriteRes<Lat11, []> { let Latency = 11; let NumMicroOps = 0;}
57 def : WriteRes<Lat12, []> { let Latency = 12; let NumMicroOps = 0;}
58 def : WriteRes<Lat15, []> { let Latency = 15; let NumMicroOps = 0;}
59 def : WriteRes<Lat20, []> { let Latency = 20; let NumMicroOps = 0;}
60 def : WriteRes<Lat30, []> { let Latency = 30; let NumMicroOps = 0;}
61
62 // Execution units.
63 def Z13_FXaUnit     : ProcResource<2>;
64 def Z13_FXbUnit     : ProcResource<2>;
65 def Z13_LSUnit      : ProcResource<2>;
66 def Z13_VecUnit     : ProcResource<2>;
67 def Z13_VecFPdUnit  : ProcResource<2> { let BufferSize = 1; /* blocking */ }
68 def Z13_VBUnit      : ProcResource<2>;
69
70 // Subtarget specific definitions of scheduling resources.
71 def : WriteRes<FXa,     [Z13_FXaUnit]> { let Latency = 1; }
72 def : WriteRes<FXa2,    [Z13_FXaUnit, Z13_FXaUnit]> { let Latency = 2; }
73 def : WriteRes<FXb,     [Z13_FXbUnit]> { let Latency = 1; }
74 def : WriteRes<LSU,     [Z13_LSUnit]>  { let Latency = 4; }
75 def : WriteRes<VecBF,   [Z13_VecUnit]> { let Latency = 8; }
76 def : WriteRes<VecBF2,  [Z13_VecUnit, Z13_VecUnit]> { let Latency = 9; }
77 def : WriteRes<VecDF,   [Z13_VecUnit]> { let Latency = 8; }
78 def : WriteRes<VecDF2,  [Z13_VecUnit, Z13_VecUnit]> { let Latency = 9; }
79 def : WriteRes<VecDFX,  [Z13_VecUnit]> { let Latency = 1; }
80 def : WriteRes<VecDFX2, [Z13_VecUnit, Z13_VecUnit]> { let Latency = 2; }
81 def : WriteRes<VecFPd,  [Z13_VecFPdUnit, Z13_VecFPdUnit, Z13_VecFPdUnit,
82                          Z13_VecFPdUnit, Z13_VecFPdUnit, Z13_VecFPdUnit,
83                          Z13_VecFPdUnit, Z13_VecFPdUnit, Z13_VecFPdUnit,
84                          Z13_VecFPdUnit, Z13_VecFPdUnit, Z13_VecFPdUnit,
85                          Z13_VecFPdUnit, Z13_VecFPdUnit, Z13_VecFPdUnit,
86                          Z13_VecFPdUnit, Z13_VecFPdUnit, Z13_VecFPdUnit,
87                          Z13_VecFPdUnit, Z13_VecFPdUnit, Z13_VecFPdUnit,
88                          Z13_VecFPdUnit, Z13_VecFPdUnit, Z13_VecFPdUnit,
89                          Z13_VecFPdUnit, Z13_VecFPdUnit, Z13_VecFPdUnit,
90                          Z13_VecFPdUnit, Z13_VecFPdUnit, Z13_VecFPdUnit]>
91                          { let Latency = 30; }
92 def : WriteRes<VecMul,  [Z13_VecUnit]> { let Latency = 5; }
93 def : WriteRes<VecStr,  [Z13_VecUnit]> { let Latency = 4; }
94 def : WriteRes<VecXsPm, [Z13_VecUnit]> { let Latency = 3; }
95 def : WriteRes<VBU,     [Z13_VBUnit]>; // Virtual Branching Unit
96
97 // -------------------------- INSTRUCTIONS ---------------------------------- //
98
99 // InstRW constructs have been used in order to preserve the
100 // readability of the InstrInfo files.
101
102 // For each instruction, as matched by a regexp, provide a list of
103 // resources that it needs. These will be combined into a SchedClass.
104
105 //===----------------------------------------------------------------------===//
106 // Stack allocation
107 //===----------------------------------------------------------------------===//
108
109 def : InstRW<[FXa], (instregex "ADJDYNALLOC$")>; // Pseudo -> LA / LAY
110
111 //===----------------------------------------------------------------------===//
112 // Branch instructions
113 //===----------------------------------------------------------------------===//
114
115 // Branch
116 def : InstRW<[VBU], (instregex "(Call)?BRC(L)?(Asm.*)?$")>;
117 def : InstRW<[VBU], (instregex "(Call)?J(G)?(Asm.*)?$")>;
118 def : InstRW<[FXb], (instregex "(Call)?BC(R)?(Asm.*)?$")>;
119 def : InstRW<[FXb], (instregex "(Call)?B(R)?(Asm.*)?$")>;
120 def : InstRW<[FXa, EndGroup], (instregex "BRCT(G)?$")>;
121 def : InstRW<[FXb, FXa, Lat2, GroupAlone], (instregex "BRCTH$")>;
122 def : InstRW<[FXb, FXa, Lat2, GroupAlone], (instregex "BCT(G)?(R)?$")>;
123 def : InstRW<[FXa, FXa, FXb, FXb, Lat4, GroupAlone],
124              (instregex "B(R)?X(H|L).*$")>;
125
126 // Compare and branch
127 def : InstRW<[FXb], (instregex "C(L)?(G)?(I|R)J(Asm.*)?$")>;
128 def : InstRW<[FXb, FXb, Lat2, GroupAlone],
129              (instregex "C(L)?(G)?(I|R)B(Call|Return|Asm.*)?$")>;
130
131 //===----------------------------------------------------------------------===//
132 // Trap instructions
133 //===----------------------------------------------------------------------===//
134
135 // Trap
136 def : InstRW<[VBU], (instregex "(Cond)?Trap$")>;
137
138 // Compare and trap
139 def : InstRW<[FXb], (instregex "C(G)?(I|R)T(Asm.*)?$")>;
140 def : InstRW<[FXb], (instregex "CL(G)?RT(Asm.*)?$")>;
141 def : InstRW<[FXb], (instregex "CL(F|G)IT(Asm.*)?$")>;
142 def : InstRW<[FXb, LSU, Lat5], (instregex "CL(G)?T(Asm.*)?$")>;
143
144 //===----------------------------------------------------------------------===//
145 // Call and return instructions
146 //===----------------------------------------------------------------------===//
147
148 // Call
149 def : InstRW<[VBU, FXa, FXa, Lat3, GroupAlone], (instregex "(Call)?BRAS$")>;
150 def : InstRW<[FXa, FXa, FXb, Lat3, GroupAlone], (instregex "(Call)?BRASL$")>;
151 def : InstRW<[FXa, FXa, FXb, Lat3, GroupAlone], (instregex "(Call)?BAS(R)?$")>;
152 def : InstRW<[FXa, FXa, FXb, Lat3, GroupAlone], (instregex "TLS_(G|L)DCALL$")>;
153
154 // Return
155 def : InstRW<[FXb, EndGroup], (instregex "Return$")>;
156 def : InstRW<[FXb], (instregex "CondReturn$")>;
157
158 //===----------------------------------------------------------------------===//
159 // Select instructions
160 //===----------------------------------------------------------------------===//
161
162 // Select pseudo 
163 def : InstRW<[FXa], (instregex "Select(32|64|32Mux)$")>;
164
165 // CondStore pseudos
166 def : InstRW<[FXa], (instregex "CondStore16(Inv)?$")>;
167 def : InstRW<[FXa], (instregex "CondStore16Mux(Inv)?$")>;
168 def : InstRW<[FXa], (instregex "CondStore32(Inv)?$")>;
169 def : InstRW<[FXa], (instregex "CondStore32Mux(Inv)?$")>;
170 def : InstRW<[FXa], (instregex "CondStore64(Inv)?$")>;
171 def : InstRW<[FXa], (instregex "CondStore8(Inv)?$")>;
172 def : InstRW<[FXa], (instregex "CondStore8Mux(Inv)?$")>;
173
174 //===----------------------------------------------------------------------===//
175 // Move instructions
176 //===----------------------------------------------------------------------===//
177
178 // Moves
179 def : InstRW<[FXb, LSU, Lat5], (instregex "MV(G|H)?HI$")>;
180 def : InstRW<[FXb, LSU, Lat5], (instregex "MVI(Y)?$")>;
181
182 // Move character
183 def : InstRW<[FXb, LSU, LSU, LSU, Lat8, GroupAlone], (instregex "MVC$")>;
184 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVCL(E|U)?$")>;
185
186 // Pseudo -> reg move
187 def : InstRW<[FXa], (instregex "COPY(_TO_REGCLASS)?$")>;
188 def : InstRW<[FXa], (instregex "EXTRACT_SUBREG$")>;
189 def : InstRW<[FXa], (instregex "INSERT_SUBREG$")>;
190 def : InstRW<[FXa], (instregex "REG_SEQUENCE$")>;
191 def : InstRW<[FXa], (instregex "SUBREG_TO_REG$")>;
192
193 // Loads
194 def : InstRW<[LSU], (instregex "L(Y|FH|RL|Mux|CBB)?$")>;
195 def : InstRW<[LSU], (instregex "LG(RL)?$")>;
196 def : InstRW<[LSU], (instregex "L128$")>;
197
198 def : InstRW<[FXa], (instregex "LLIH(F|H|L)$")>;
199 def : InstRW<[FXa], (instregex "LLIL(F|H|L)$")>;
200
201 def : InstRW<[FXa], (instregex "LG(F|H)I$")>;
202 def : InstRW<[FXa], (instregex "LHI(Mux)?$")>;
203 def : InstRW<[FXa], (instregex "LR(Mux)?$")>;
204
205 // Load and zero rightmost byte
206 def : InstRW<[LSU], (instregex "LZR(F|G)$")>;
207
208 // Load and trap
209 def : InstRW<[FXb, LSU, Lat5], (instregex "L(FH|G)?AT$")>;
210
211 // Load and test
212 def : InstRW<[FXa, LSU, Lat5], (instregex "LT(G)?$")>;
213 def : InstRW<[FXa], (instregex "LT(G)?R$")>;
214
215 // Stores
216 def : InstRW<[FXb, LSU, Lat5], (instregex "STG(RL)?$")>;
217 def : InstRW<[FXb, LSU, Lat5], (instregex "ST128$")>;
218 def : InstRW<[FXb, LSU, Lat5], (instregex "ST(Y|FH|RL|Mux)?$")>;
219
220 // String moves.
221 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVST$")>;
222
223 //===----------------------------------------------------------------------===//
224 // Conditional move instructions
225 //===----------------------------------------------------------------------===//
226
227 def : InstRW<[FXa, Lat2], (instregex "LOCRMux$")>;
228 def : InstRW<[FXa, Lat2], (instregex "LOC(G|FH)?R(Asm.*)?$")>;
229 def : InstRW<[FXa, Lat2], (instregex "LOC(G|H)?HI(Asm.*)?$")>;
230 def : InstRW<[FXa, LSU, Lat6], (instregex "LOC(G|FH|Mux)?(Asm.*)?$")>;
231 def : InstRW<[FXb, LSU, Lat5], (instregex "STOC(G|FH|Mux)?(Asm.*)?$")>;
232
233 //===----------------------------------------------------------------------===//
234 // Sign extensions
235 //===----------------------------------------------------------------------===//
236
237 def : InstRW<[FXa], (instregex "L(B|H|G)R$")>;
238 def : InstRW<[FXa], (instregex "LG(B|H|F)R$")>;
239
240 def : InstRW<[FXa, LSU, Lat5], (instregex "LTGF$")>;
241 def : InstRW<[FXa], (instregex "LTGFR$")>;
242
243 def : InstRW<[FXa, LSU, Lat5], (instregex "LB(H|Mux)?$")>;
244 def : InstRW<[FXa, LSU, Lat5], (instregex "LH(Y)?$")>;
245 def : InstRW<[FXa, LSU, Lat5], (instregex "LH(H|Mux|RL)$")>;
246 def : InstRW<[FXa, LSU, Lat5], (instregex "LG(B|H|F)$")>;
247 def : InstRW<[FXa, LSU, Lat5], (instregex "LG(H|F)RL$")>;
248
249 //===----------------------------------------------------------------------===//
250 // Zero extensions
251 //===----------------------------------------------------------------------===//
252
253 def : InstRW<[FXa], (instregex "LLCR(Mux)?$")>;
254 def : InstRW<[FXa], (instregex "LLHR(Mux)?$")>;
255 def : InstRW<[FXa], (instregex "LLG(C|H|F|T)R$")>;
256 def : InstRW<[LSU], (instregex "LLC(Mux)?$")>;
257 def : InstRW<[LSU], (instregex "LLH(Mux)?$")>;
258 def : InstRW<[FXa, LSU, Lat5], (instregex "LL(C|H)H$")>;
259 def : InstRW<[LSU], (instregex "LLHRL$")>;
260 def : InstRW<[LSU], (instregex "LLG(C|H|F|T|HRL|FRL)$")>;
261
262 // Load and zero rightmost byte
263 def : InstRW<[LSU], (instregex "LLZRGF$")>;
264
265 // Load and trap
266 def : InstRW<[FXb, LSU, Lat5], (instregex "LLG(F|T)?AT$")>;
267
268 //===----------------------------------------------------------------------===//
269 // Truncations
270 //===----------------------------------------------------------------------===//
271
272 def : InstRW<[FXb, LSU, Lat5], (instregex "STC(H|Y|Mux)?$")>;
273 def : InstRW<[FXb, LSU, Lat5], (instregex "STH(H|Y|RL|Mux)?$")>;
274 def : InstRW<[FXb, LSU, Lat5], (instregex "STCM(H|Y)?$")>;
275
276 //===----------------------------------------------------------------------===//
277 // Multi-register moves
278 //===----------------------------------------------------------------------===//
279
280 // Load multiple (estimated average of 5 ops)
281 def : InstRW<[LSU, LSU, LSU, LSU, LSU, Lat10, GroupAlone],
282              (instregex "LM(H|Y|G)?$")>;
283
284 // Load multiple disjoint
285 def : InstRW<[FXb, Lat30, GroupAlone], (instregex "LMD$")>;
286
287 // Store multiple (estimated average of ceil(5/2) FXb ops)
288 def : InstRW<[LSU, LSU, FXb, FXb, FXb, Lat10,
289               GroupAlone], (instregex "STM(G|H|Y)?$")>;
290
291 //===----------------------------------------------------------------------===//
292 // Byte swaps
293 //===----------------------------------------------------------------------===//
294
295 def : InstRW<[FXa], (instregex "LRV(G)?R$")>;
296 def : InstRW<[FXa, LSU, Lat5], (instregex "LRV(G|H)?$")>;
297 def : InstRW<[FXb, LSU, Lat5], (instregex "STRV(G|H)?$")>;
298 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MVCIN$")>;
299
300 //===----------------------------------------------------------------------===//
301 // Load address instructions
302 //===----------------------------------------------------------------------===//
303
304 def : InstRW<[FXa], (instregex "LA(Y|RL)?$")>;
305
306 // Load the Global Offset Table address ( -> larl )
307 def : InstRW<[FXa], (instregex "GOT$")>;
308
309 //===----------------------------------------------------------------------===//
310 // Absolute and Negation
311 //===----------------------------------------------------------------------===//
312
313 def : InstRW<[FXa, Lat2], (instregex "LP(G)?R$")>;
314 def : InstRW<[FXa, FXa, Lat3, BeginGroup], (instregex "L(N|P)GFR$")>;
315 def : InstRW<[FXa, Lat2], (instregex "LN(R|GR)$")>;
316 def : InstRW<[FXa], (instregex "LC(R|GR)$")>;
317 def : InstRW<[FXa, FXa, Lat2, BeginGroup], (instregex "LCGFR$")>;
318
319 //===----------------------------------------------------------------------===//
320 // Insertion
321 //===----------------------------------------------------------------------===//
322
323 def : InstRW<[FXa, LSU, Lat5], (instregex "IC(Y)?$")>;
324 def : InstRW<[FXa, LSU, Lat5], (instregex "IC32(Y)?$")>;
325 def : InstRW<[FXa, LSU, Lat5], (instregex "ICM(H|Y)?$")>;
326 def : InstRW<[FXa], (instregex "II(F|H|L)Mux$")>;
327 def : InstRW<[FXa], (instregex "IIHF(64)?$")>;
328 def : InstRW<[FXa], (instregex "IIHH(64)?$")>;
329 def : InstRW<[FXa], (instregex "IIHL(64)?$")>;
330 def : InstRW<[FXa], (instregex "IILF(64)?$")>;
331 def : InstRW<[FXa], (instregex "IILH(64)?$")>;
332 def : InstRW<[FXa], (instregex "IILL(64)?$")>;
333
334 //===----------------------------------------------------------------------===//
335 // Addition
336 //===----------------------------------------------------------------------===//
337
338 def : InstRW<[FXa, LSU, Lat5], (instregex "A(Y)?$")>;
339 def : InstRW<[FXa, LSU, Lat6], (instregex "AH(Y)?$")>;
340 def : InstRW<[FXa], (instregex "AIH$")>;
341 def : InstRW<[FXa], (instregex "AFI(Mux)?$")>;
342 def : InstRW<[FXa, LSU, Lat5], (instregex "AG$")>;
343 def : InstRW<[FXa], (instregex "AGFI$")>;
344 def : InstRW<[FXa], (instregex "AGHI(K)?$")>;
345 def : InstRW<[FXa], (instregex "AGR(K)?$")>;
346 def : InstRW<[FXa], (instregex "AHI(K)?$")>;
347 def : InstRW<[FXa], (instregex "AHIMux(K)?$")>;
348 def : InstRW<[FXa, LSU, Lat5], (instregex "AL(Y)?$")>;
349 def : InstRW<[FXa], (instregex "AL(FI|HSIK)$")>;
350 def : InstRW<[FXa, LSU, Lat5], (instregex "ALG(F)?$")>;
351 def : InstRW<[FXa], (instregex "ALGHSIK$")>;
352 def : InstRW<[FXa], (instregex "ALGF(I|R)$")>;
353 def : InstRW<[FXa], (instregex "ALGR(K)?$")>;
354 def : InstRW<[FXa], (instregex "ALR(K)?$")>;
355 def : InstRW<[FXa], (instregex "AR(K)?$")>;
356 def : InstRW<[FXb, LSU, Lat5], (instregex "A(L)?(G)?SI$")>;
357
358 // Logical addition with carry
359 def : InstRW<[FXa, LSU, Lat6, GroupAlone], (instregex "ALC(G)?$")>;
360 def : InstRW<[FXa, Lat2, GroupAlone], (instregex "ALC(G)?R$")>;
361
362 // Add with sign extension (32 -> 64)
363 def : InstRW<[FXa, LSU, Lat6], (instregex "AGF$")>;
364 def : InstRW<[FXa, Lat2], (instregex "AGFR$")>;
365
366 //===----------------------------------------------------------------------===//
367 // Subtraction
368 //===----------------------------------------------------------------------===//
369
370 def : InstRW<[FXa, LSU, Lat5], (instregex "S(G|Y)?$")>;
371 def : InstRW<[FXa, LSU, Lat6], (instregex "SH(Y)?$")>;
372 def : InstRW<[FXa], (instregex "SGR(K)?$")>;
373 def : InstRW<[FXa], (instregex "SLFI$")>;
374 def : InstRW<[FXa, LSU, Lat5], (instregex "SL(G|GF|Y)?$")>;
375 def : InstRW<[FXa], (instregex "SLGF(I|R)$")>;
376 def : InstRW<[FXa], (instregex "SLGR(K)?$")>;
377 def : InstRW<[FXa], (instregex "SLR(K)?$")>;
378 def : InstRW<[FXa], (instregex "SR(K)?$")>;
379
380 // Subtraction with borrow
381 def : InstRW<[FXa, LSU, Lat6, GroupAlone], (instregex "SLB(G)?$")>;
382 def : InstRW<[FXa, Lat2, GroupAlone], (instregex "SLB(G)?R$")>;
383
384 // Subtraction with sign extension (32 -> 64)
385 def : InstRW<[FXa, LSU, Lat6], (instregex "SGF$")>;
386 def : InstRW<[FXa, Lat2], (instregex "SGFR$")>;
387
388 //===----------------------------------------------------------------------===//
389 // AND
390 //===----------------------------------------------------------------------===//
391
392 def : InstRW<[FXa, LSU, Lat5], (instregex "N(G|Y)?$")>;
393 def : InstRW<[FXa], (instregex "NGR(K)?$")>;
394 def : InstRW<[FXa], (instregex "NI(FMux|HMux|LMux)$")>;
395 def : InstRW<[FXb, LSU, Lat5], (instregex "NI(Y)?$")>;
396 def : InstRW<[FXa], (instregex "NIHF(64)?$")>;
397 def : InstRW<[FXa], (instregex "NIHH(64)?$")>;
398 def : InstRW<[FXa], (instregex "NIHL(64)?$")>;
399 def : InstRW<[FXa], (instregex "NILF(64)?$")>;
400 def : InstRW<[FXa], (instregex "NILH(64)?$")>;
401 def : InstRW<[FXa], (instregex "NILL(64)?$")>;
402 def : InstRW<[FXa], (instregex "NR(K)?$")>;
403 def : InstRW<[LSU, LSU, FXb, Lat9, BeginGroup], (instregex "NC$")>;
404
405 //===----------------------------------------------------------------------===//
406 // OR
407 //===----------------------------------------------------------------------===//
408
409 def : InstRW<[FXa, LSU, Lat5], (instregex "O(G|Y)?$")>;
410 def : InstRW<[FXa], (instregex "OGR(K)?$")>;
411 def : InstRW<[FXb, LSU, Lat5], (instregex "OI(Y)?$")>;
412 def : InstRW<[FXa], (instregex "OI(FMux|HMux|LMux)$")>;
413 def : InstRW<[FXa], (instregex "OIHF(64)?$")>;
414 def : InstRW<[FXa], (instregex "OIHH(64)?$")>;
415 def : InstRW<[FXa], (instregex "OIHL(64)?$")>;
416 def : InstRW<[FXa], (instregex "OILF(64)?$")>;
417 def : InstRW<[FXa], (instregex "OILH(64)?$")>;
418 def : InstRW<[FXa], (instregex "OILL(64)?$")>;
419 def : InstRW<[FXa], (instregex "OR(K)?$")>;
420 def : InstRW<[LSU, LSU, FXb, Lat9, BeginGroup], (instregex "OC$")>;
421
422 //===----------------------------------------------------------------------===//
423 // XOR
424 //===----------------------------------------------------------------------===//
425
426 def : InstRW<[FXa, LSU, Lat5], (instregex "X(G|Y)?$")>;
427 def : InstRW<[FXb, LSU, Lat5], (instregex "XI(Y)?$")>;
428 def : InstRW<[FXa], (instregex "XIFMux$")>;
429 def : InstRW<[FXa], (instregex "XGR(K)?$")>;
430 def : InstRW<[FXa], (instregex "XIHF(64)?$")>;
431 def : InstRW<[FXa], (instregex "XILF(64)?$")>;
432 def : InstRW<[FXa], (instregex "XR(K)?$")>;
433 def : InstRW<[LSU, LSU, FXb, Lat9, BeginGroup], (instregex "XC$")>;
434
435 //===----------------------------------------------------------------------===//
436 // Multiplication
437 //===----------------------------------------------------------------------===//
438
439 def : InstRW<[FXa, LSU, Lat10], (instregex "MS(GF|Y)?$")>;
440 def : InstRW<[FXa, Lat6], (instregex "MS(R|FI)$")>;
441 def : InstRW<[FXa, LSU, Lat12], (instregex "MSG$")>;
442 def : InstRW<[FXa, Lat8], (instregex "MSGR$")>;
443 def : InstRW<[FXa, Lat6], (instregex "MSGF(I|R)$")>;
444 def : InstRW<[FXa, LSU, Lat15, GroupAlone], (instregex "MLG$")>;
445 def : InstRW<[FXa, Lat9, GroupAlone], (instregex "MLGR$")>;
446 def : InstRW<[FXa, Lat5], (instregex "MGHI$")>;
447 def : InstRW<[FXa, Lat5], (instregex "MHI$")>;
448 def : InstRW<[FXa, LSU, Lat9], (instregex "MH(Y)?$")>;
449 def : InstRW<[FXa, Lat7, GroupAlone], (instregex "M(L)?R$")>;
450 def : InstRW<[FXa, LSU, Lat7, GroupAlone], (instregex "M(FY|L)?$")>;
451
452 //===----------------------------------------------------------------------===//
453 // Division and remainder
454 //===----------------------------------------------------------------------===//
455
456 def : InstRW<[FXa2, FXa2, Lat20, GroupAlone], (instregex "DR$")>;
457 def : InstRW<[FXa2, FXa2, LSU, Lat30, GroupAlone], (instregex "D$")>;
458 def : InstRW<[FXa, Lat30, GroupAlone], (instregex "DSG(F)?R$")>;
459 def : InstRW<[LSU, FXa, Lat30, GroupAlone], (instregex "DSG(F)?$")>;
460 def : InstRW<[FXa2, FXa2, Lat20, GroupAlone], (instregex "DLR$")>;
461 def : InstRW<[FXa2, FXa2, Lat30, GroupAlone], (instregex "DLGR$")>;
462 def : InstRW<[FXa2, FXa2, LSU, Lat30, GroupAlone], (instregex "DL(G)?$")>;
463
464 //===----------------------------------------------------------------------===//
465 // Shifts
466 //===----------------------------------------------------------------------===//
467
468 def : InstRW<[FXa], (instregex "SLL(G|K)?$")>;
469 def : InstRW<[FXa], (instregex "SRL(G|K)?$")>;
470 def : InstRW<[FXa], (instregex "SRA(G|K)?$")>;
471 def : InstRW<[FXa], (instregex "SLA(G|K)?$")>;
472 def : InstRW<[FXa, FXa, FXa, FXa, Lat8], (instregex "S(L|R)D(A|L)$")>;
473
474 // Rotate
475 def : InstRW<[FXa, LSU, Lat6], (instregex "RLL(G)?$")>;
476
477 // Rotate and insert
478 def : InstRW<[FXa], (instregex "RISBG(N|32)?$")>;
479 def : InstRW<[FXa], (instregex "RISBH(G|H|L)$")>;
480 def : InstRW<[FXa], (instregex "RISBL(G|H|L)$")>;
481 def : InstRW<[FXa], (instregex "RISBMux$")>;
482
483 // Rotate and Select
484 def : InstRW<[FXa, FXa, Lat3, BeginGroup], (instregex "R(N|O|X)SBG$")>;
485
486 //===----------------------------------------------------------------------===//
487 // Comparison
488 //===----------------------------------------------------------------------===//
489
490 def : InstRW<[FXb, LSU, Lat5], (instregex "C(G|Y|Mux|RL)?$")>;
491 def : InstRW<[FXb], (instregex "C(F|H)I(Mux)?$")>;
492 def : InstRW<[FXb], (instregex "CG(F|H)I$")>;
493 def : InstRW<[FXb, LSU, Lat5], (instregex "CG(HSI|RL)$")>;
494 def : InstRW<[FXb], (instregex "C(G)?R$")>;
495 def : InstRW<[FXb], (instregex "CIH$")>;
496 def : InstRW<[FXb, LSU, Lat5], (instregex "CH(F|SI)$")>;
497 def : InstRW<[FXb, LSU, Lat5], (instregex "CL(Y|Mux|FHSI)?$")>;
498 def : InstRW<[FXb], (instregex "CLFI(Mux)?$")>;
499 def : InstRW<[FXb, LSU, Lat5], (instregex "CLG(HRL|HSI)?$")>;
500 def : InstRW<[FXb, LSU, Lat5], (instregex "CLGF(RL)?$")>;
501 def : InstRW<[FXb], (instregex "CLGF(I|R)$")>;
502 def : InstRW<[FXb], (instregex "CLGR$")>;
503 def : InstRW<[FXb, LSU, Lat5], (instregex "CLGRL$")>;
504 def : InstRW<[FXb, LSU, Lat5], (instregex "CLH(F|RL|HSI)$")>;
505 def : InstRW<[FXb], (instregex "CLIH$")>;
506 def : InstRW<[FXb, LSU, Lat5], (instregex "CLI(Y)?$")>;
507 def : InstRW<[FXb], (instregex "CLR$")>;
508 def : InstRW<[FXb, LSU, Lat5], (instregex "CLRL$")>;
509
510 // Compare halfword
511 def : InstRW<[FXb, LSU, Lat6], (instregex "CH(Y|RL)?$")>;
512 def : InstRW<[FXb, LSU, Lat6], (instregex "CGH(RL)?$")>;
513 def : InstRW<[FXa, FXb, LSU, Lat6, BeginGroup], (instregex "CHHSI$")>;
514
515 // Compare with sign extension (32 -> 64)
516 def : InstRW<[FXb, LSU, Lat6], (instregex "CGF(RL)?$")>;
517 def : InstRW<[FXb, Lat2], (instregex "CGFR$")>;
518
519 // Compare logical character
520 def : InstRW<[FXb, LSU, LSU, Lat9, BeginGroup], (instregex "CLC$")>;
521 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "CLCL(E|U)?$")>;
522 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "CLST$")>;
523
524 // Test under mask
525 def : InstRW<[FXb, LSU, Lat5], (instregex "TM(Y)?$")>;
526 def : InstRW<[FXb], (instregex "TM(H|L)Mux$")>;
527 def : InstRW<[FXb], (instregex "TMHH(64)?$")>;
528 def : InstRW<[FXb], (instregex "TMHL(64)?$")>;
529 def : InstRW<[FXb], (instregex "TMLH(64)?$")>;
530 def : InstRW<[FXb], (instregex "TMLL(64)?$")>;
531
532 // Compare logical characters under mask
533 def : InstRW<[FXb, LSU, Lat5], (instregex "CLM(H|Y)?$")>;
534
535 //===----------------------------------------------------------------------===//
536 // Prefetch and execution hint
537 //===----------------------------------------------------------------------===//
538
539 def : InstRW<[LSU], (instregex "PFD(RL)?$")>;
540 def : InstRW<[FXb, Lat2], (instregex "BPP$")>;
541 def : InstRW<[FXb, EndGroup], (instregex "BPRP$")>;
542 def : InstRW<[FXb], (instregex "NIAI$")>;
543
544 //===----------------------------------------------------------------------===//
545 // Atomic operations
546 //===----------------------------------------------------------------------===//
547
548 def : InstRW<[FXb, EndGroup], (instregex "Serialize$")>;
549
550 def : InstRW<[FXb, LSU, Lat5], (instregex "LAA(G)?$")>;
551 def : InstRW<[FXb, LSU, Lat5], (instregex "LAAL(G)?$")>;
552 def : InstRW<[FXb, LSU, Lat5], (instregex "LAN(G)?$")>;
553 def : InstRW<[FXb, LSU, Lat5], (instregex "LAO(G)?$")>;
554 def : InstRW<[FXb, LSU, Lat5], (instregex "LAX(G)?$")>;
555
556 // Test and set
557 def : InstRW<[FXb, LSU, Lat5, EndGroup], (instregex "TS$")>;
558
559 // Compare and swap
560 def : InstRW<[FXa, FXb, LSU, Lat6, GroupAlone], (instregex "CS(G|Y)?$")>;
561
562 // Compare double and swap
563 def : InstRW<[FXa, FXa, FXb, FXb, FXa, LSU, Lat10, GroupAlone],
564              (instregex "CDS(Y)?$")>;
565 def : InstRW<[FXa, FXa, FXb, FXb, LSU, FXb, FXb, LSU, LSU, Lat20, GroupAlone],
566              (instregex "CDSG$")>;
567
568 // Compare and swap and store
569 def : InstRW<[FXa, Lat30, GroupAlone], (instregex "CSST$")>;
570
571 // Perform locked operation
572 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "PLO$")>;
573
574 // Load/store pair from/to quadword
575 def : InstRW<[LSU, LSU, Lat5, GroupAlone], (instregex "LPQ$")>;
576 def : InstRW<[FXb, FXb, LSU, Lat6, GroupAlone], (instregex "STPQ$")>;
577
578 // Load pair disjoint
579 def : InstRW<[LSU, LSU, Lat5, GroupAlone], (instregex "LPD(G)?$")>;
580
581 //===----------------------------------------------------------------------===//
582 // Translate and convert
583 //===----------------------------------------------------------------------===//
584
585 def : InstRW<[FXa, Lat30, GroupAlone], (instregex "TR(T|TR)?(E|EOpt)?$")>;
586 def : InstRW<[FXa, Lat30, GroupAlone], (instregex "TR(T|O)(T|O)(Opt)?$")>;
587 def : InstRW<[FXa, Lat30, GroupAlone], (instregex "CU(12|14|21|24|41|42)(Opt)?$")>;
588 def : InstRW<[FXa, Lat30, GroupAlone], (instregex "(CUUTF|CUTFU)(Opt)?$")>;
589
590 //===----------------------------------------------------------------------===//
591 // Message-security assist
592 //===----------------------------------------------------------------------===//
593
594 def : InstRW<[FXa, Lat30, GroupAlone], (instregex "KM(C|F|O|CTR)?$")>;
595 def : InstRW<[FXa, Lat30, GroupAlone], (instregex "(KIMD|KLMD|KMAC|PCC|PPNO)$")>;
596
597 //===----------------------------------------------------------------------===//
598 // Decimal arithmetic
599 //===----------------------------------------------------------------------===//
600
601 def : InstRW<[FXb, VecDF, LSU, Lat30, GroupAlone], (instregex "CVB(Y|G)?$")>;
602 def : InstRW<[FXb, VecDF, FXb, Lat30, GroupAlone], (instregex "CVD(Y|G)?$")>;
603 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "MV(N|Z|O)$")>;
604 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "(PACK|PKA|PKU)$")>;
605 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "UNPK(A|U)?$")>;
606
607 def : InstRW<[FXb, VecDFX, LSU, LSU, Lat9, GroupAlone],
608              (instregex "(A|S|ZA)P$")>;
609 def : InstRW<[FXb, VecDFX2, LSU, LSU, Lat30, GroupAlone],
610              (instregex "(M|D)P$")>;
611 def : InstRW<[FXb, FXb, VecDFX2, LSU, LSU, LSU, Lat15, GroupAlone],
612              (instregex "SRP$")>;
613 def : InstRW<[VecDFX, LSU, LSU, Lat5, GroupAlone], (instregex "CP$")>;
614 def : InstRW<[VecDFX, LSU, Lat4, GroupAlone], (instregex "TP$")>;
615 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "ED(MK)?$")>;
616
617 //===----------------------------------------------------------------------===//
618 // Access registers
619 //===----------------------------------------------------------------------===//
620
621 // Extract/set/copy access register
622 def : InstRW<[LSU], (instregex "(EAR|SAR|CPYA)$")>;
623
624 // Load address extended
625 def : InstRW<[LSU, FXa, Lat5, BeginGroup], (instregex "LAE(Y)?$")>;
626
627 // Load/store access multiple (not modeled precisely)
628 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "(L|ST)AM(Y)?$")>;
629
630 //===----------------------------------------------------------------------===//
631 // Program mask and addressing mode
632 //===----------------------------------------------------------------------===//
633
634 // Insert Program Mask
635 def : InstRW<[FXa, Lat3, EndGroup], (instregex "IPM$")>;
636
637 // Set Program Mask
638 def : InstRW<[LSU, EndGroup], (instregex "SPM$")>;
639
640 // Branch and link
641 def : InstRW<[FXa, FXa, FXb, Lat5, GroupAlone], (instregex "BAL(R)?$")>;
642
643 // Test addressing mode
644 def : InstRW<[FXb], (instregex "TAM$")>;
645
646 // Set addressing mode
647 def : InstRW<[FXb, Lat2, EndGroup], (instregex "SAM(24|31|64)$")>;
648
649 // Branch (and save) and set mode.
650 def : InstRW<[FXa, FXb, Lat2, GroupAlone], (instregex "BSM$")>;
651 def : InstRW<[FXa, FXa, FXb, Lat3, GroupAlone], (instregex "BASSM$")>;
652
653 //===----------------------------------------------------------------------===//
654 // Transactional execution
655 //===----------------------------------------------------------------------===//
656
657 // Transaction begin
658 def : InstRW<[LSU, LSU, FXb, FXb, FXb, FXb, FXb, Lat15, GroupAlone],
659               (instregex "TBEGIN(C|_nofloat)?$")>;
660
661 // Transaction end
662 def : InstRW<[FXb, GroupAlone], (instregex "TEND$")>;
663
664 // Transaction abort
665 def : InstRW<[LSU, GroupAlone], (instregex "TABORT$")>;
666
667 // Extract Transaction Nesting Depth
668 def : InstRW<[FXa], (instregex "ETND$")>;
669
670 // Nontransactional store
671 def : InstRW<[FXb, LSU, Lat5], (instregex "NTSTG$")>;
672
673 //===----------------------------------------------------------------------===//
674 // Processor assist
675 //===----------------------------------------------------------------------===//
676
677 def : InstRW<[FXb], (instregex "PPA$")>;
678
679 //===----------------------------------------------------------------------===//
680 // Miscellaneous Instructions.
681 //===----------------------------------------------------------------------===//
682
683 // Find leftmost one
684 def : InstRW<[FXa, Lat6, GroupAlone], (instregex "FLOGR$")>;
685
686 // Population count
687 def : InstRW<[FXa, Lat3], (instregex "POPCNT$")>;
688
689 // Extend
690 def : InstRW<[FXa], (instregex "AEXT128_64$")>;
691 def : InstRW<[FXa], (instregex "ZEXT128_(32|64)$")>;
692
693 // String instructions
694 def : InstRW<[FXa, LSU, Lat30], (instregex "SRST$")>;
695 def : InstRW<[LSU, Lat30], (instregex "SRSTU$")>;
696 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "CUSE$")>;
697
698 // Various complex instructions
699 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "CFC$")>;
700 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "UPT$")>;
701 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "CKSM$")>;
702 def : InstRW<[LSU, Lat30, GroupAlone], (instregex "CMPSC$")>;
703
704 // Move with key
705 def : InstRW<[FXa, FXa, FXb, LSU, Lat8, GroupAlone], (instregex "MVCK$")>;
706
707 // Monitor call
708 def : InstRW<[FXb], (instregex "MC$")>;
709
710 // Extract CPU attribute
711 def : InstRW<[FXb, Lat30], (instregex "ECAG$")>;
712
713 // Extract CPU Time
714 def : InstRW<[FXa, Lat5, LSU], (instregex "ECTG$")>;
715
716 // Extract PSW
717 def : InstRW<[FXb, Lat30], (instregex "EPSW$")>;
718
719 // Execute
720 def : InstRW<[FXb, GroupAlone], (instregex "EX(RL)?$")>;
721
722 // Program return
723 def : InstRW<[FXb, Lat30], (instregex "PR$")>;
724
725 // Inline assembly
726 def : InstRW<[LSU, LSU, LSU, FXa, FXa, FXb, Lat9, GroupAlone],
727              (instregex "STCK(F)?$")>;
728 def : InstRW<[LSU, LSU, LSU, LSU, FXa, FXa, FXb, FXb, Lat11, GroupAlone],
729              (instregex "STCKE$")>;
730 def : InstRW<[FXa, LSU, Lat5], (instregex "STFLE$")>;
731 def : InstRW<[FXb, Lat30], (instregex "SVC$")>;
732
733 // Store real address
734 def : InstRW<[FXb, LSU, Lat5], (instregex "STRAG$")>;
735
736 //===----------------------------------------------------------------------===//
737 // .insn directive instructions
738 //===----------------------------------------------------------------------===//
739
740 // An "empty" sched-class will be assigned instead of the "invalid sched-class".
741 // getNumDecoderSlots() will then return 1 instead of 0.
742 def : InstRW<[], (instregex "Insn.*")>;
743
744
745 // ----------------------------- Floating point ----------------------------- //
746
747 //===----------------------------------------------------------------------===//
748 // FP: Select instructions
749 //===----------------------------------------------------------------------===//
750
751 def : InstRW<[FXa], (instregex "SelectF(32|64|128)$")>;
752 def : InstRW<[FXa], (instregex "CondStoreF32(Inv)?$")>;
753 def : InstRW<[FXa], (instregex "CondStoreF64(Inv)?$")>;
754
755 //===----------------------------------------------------------------------===//
756 // FP: Move instructions
757 //===----------------------------------------------------------------------===//
758
759 // Load zero
760 def : InstRW<[FXb], (instregex "LZ(DR|ER)$")>;
761 def : InstRW<[FXb, FXb, Lat2, BeginGroup], (instregex "LZXR$")>;
762
763 // Load
764 def : InstRW<[VecXsPm], (instregex "LER$")>;
765 def : InstRW<[FXb], (instregex "LD(R|R32|GR)$")>;
766 def : InstRW<[FXb, Lat3], (instregex "LGDR$")>;
767 def : InstRW<[FXb, FXb, Lat2, GroupAlone], (instregex "LXR$")>;
768
769 // Load and Test
770 def : InstRW<[VecXsPm, Lat4], (instregex "LT(D|E)BR$")>;
771 def : InstRW<[VecXsPm, Lat4], (instregex "LTEBRCompare(_VecPseudo)?$")>;
772 def : InstRW<[VecXsPm, Lat4], (instregex "LTDBRCompare(_VecPseudo)?$")>;
773 def : InstRW<[VecDF2, VecDF2, Lat11, GroupAlone], (instregex "LTXBR$")>;
774 def : InstRW<[VecDF2, VecDF2, Lat11, GroupAlone],
775              (instregex "LTXBRCompare(_VecPseudo)?$")>;
776
777 // Copy sign
778 def : InstRW<[VecXsPm], (instregex "CPSDRd(d|s)$")>;
779 def : InstRW<[VecXsPm], (instregex "CPSDRs(d|s)$")>;
780
781 //===----------------------------------------------------------------------===//
782 // FP: Load instructions
783 //===----------------------------------------------------------------------===//
784
785 def : InstRW<[VecXsPm, LSU, Lat7], (instregex "LE(Y)?$")>;
786 def : InstRW<[LSU], (instregex "LD(Y|E32)?$")>;
787 def : InstRW<[LSU], (instregex "LX$")>;
788
789 //===----------------------------------------------------------------------===//
790 // FP: Store instructions
791 //===----------------------------------------------------------------------===//
792
793 def : InstRW<[FXb, LSU, Lat7], (instregex "STD(Y)?$")>;
794 def : InstRW<[FXb, LSU, Lat7], (instregex "STE(Y)?$")>;
795 def : InstRW<[FXb, LSU, Lat5], (instregex "STX$")>;
796
797 //===----------------------------------------------------------------------===//
798 // FP: Conversion instructions
799 //===----------------------------------------------------------------------===//
800
801 // Load rounded
802 def : InstRW<[VecBF], (instregex "LEDBR(A)?$")>;
803 def : InstRW<[VecDF, VecDF, Lat20], (instregex "LEXBR(A)?$")>;
804 def : InstRW<[VecDF, VecDF, Lat20], (instregex "LDXBR(A)?$")>;
805
806 // Load lengthened
807 def : InstRW<[VecBF, LSU, Lat12], (instregex "LDEB$")>;
808 def : InstRW<[VecBF], (instregex "LDEBR$")>;
809 def : InstRW<[VecBF2, VecBF2, LSU, Lat12 , GroupAlone], (instregex "LX(D|E)B$")>;
810 def : InstRW<[VecBF2, VecBF2, GroupAlone], (instregex "LX(D|E)BR$")>;
811
812 // Convert from fixed / logical
813 def : InstRW<[FXb, VecBF, Lat9, BeginGroup], (instregex "CE(F|G)BR(A)?$")>;
814 def : InstRW<[FXb, VecBF, Lat9, BeginGroup], (instregex "CD(F|G)BR(A)?$")>;
815 def : InstRW<[FXb, VecDF2, VecDF2, Lat12, GroupAlone], (instregex "CX(F|G)BR(A)?$")>;
816 def : InstRW<[FXb, VecBF, Lat9, BeginGroup], (instregex "CEL(F|G)BR$")>;
817 def : InstRW<[FXb, VecBF, Lat9, BeginGroup], (instregex "CDL(F|G)BR$")>;
818 def : InstRW<[FXb, VecDF2, VecDF2, Lat12, GroupAlone], (instregex "CXL(F|G)BR$")>;
819
820 // Convert to fixed / logical
821 def : InstRW<[FXb, VecBF, Lat11, BeginGroup], (instregex "CF(E|D)BR(A)?$")>;
822 def : InstRW<[FXb, VecBF, Lat11, BeginGroup], (instregex "CG(E|D)BR(A)?$")>;
823 def : InstRW<[FXb, VecDF, VecDF, Lat20, BeginGroup], (instregex "C(F|G)XBR(A)?$")>;
824 def : InstRW<[FXb, VecBF, Lat11, GroupAlone], (instregex "CLFEBR$")>;
825 def : InstRW<[FXb, VecBF, Lat11, BeginGroup], (instregex "CLFDBR$")>;
826 def : InstRW<[FXb, VecBF, Lat11, BeginGroup], (instregex "CLG(E|D)BR$")>;
827 def : InstRW<[FXb, VecDF, VecDF, Lat20, BeginGroup], (instregex "CL(F|G)XBR$")>;
828
829 //===----------------------------------------------------------------------===//
830 // FP: Unary arithmetic
831 //===----------------------------------------------------------------------===//
832
833 // Load Complement / Negative / Positive
834 def : InstRW<[VecXsPm, Lat4], (instregex "L(C|N|P)DBR$")>;
835 def : InstRW<[VecXsPm, Lat4], (instregex "L(C|N|P)EBR$")>;
836 def : InstRW<[FXb], (instregex "LCDFR(_32)?$")>;
837 def : InstRW<[FXb], (instregex "LNDFR(_32)?$")>;
838 def : InstRW<[FXb], (instregex "LPDFR(_32)?$")>;
839 def : InstRW<[VecDF2, VecDF2, Lat11, GroupAlone], (instregex "L(C|N|P)XBR$")>;
840
841 // Square root
842 def : InstRW<[VecFPd, LSU], (instregex "SQ(E|D)B$")>;
843 def : InstRW<[VecFPd], (instregex "SQ(E|D)BR$")>;
844 def : InstRW<[VecFPd, VecFPd, GroupAlone], (instregex "SQXBR$")>;
845
846 // Load FP integer
847 def : InstRW<[VecBF], (instregex "FIEBR(A)?$")>;
848 def : InstRW<[VecBF], (instregex "FIDBR(A)?$")>;
849 def : InstRW<[VecDF2, VecDF2, Lat11, GroupAlone], (instregex "FIXBR(A)?$")>;
850
851 //===----------------------------------------------------------------------===//
852 // FP: Binary arithmetic
853 //===----------------------------------------------------------------------===//
854
855 // Addition
856 def : InstRW<[VecBF, LSU, Lat12], (instregex "A(E|D)B$")>;
857 def : InstRW<[VecBF], (instregex "A(E|D)BR$")>;
858 def : InstRW<[VecDF2, VecDF2, Lat11, GroupAlone], (instregex "AXBR$")>;
859
860 // Subtraction
861 def : InstRW<[VecBF, LSU, Lat12], (instregex "S(E|D)B$")>;
862 def : InstRW<[VecBF], (instregex "S(E|D)BR$")>;
863 def : InstRW<[VecDF2, VecDF2, Lat11, GroupAlone], (instregex "SXBR$")>;
864
865 // Multiply
866 def : InstRW<[VecBF, LSU, Lat12], (instregex "M(D|DE|EE)B$")>;
867 def : InstRW<[VecBF], (instregex "M(D|DE|EE)BR$")>;
868 def : InstRW<[VecBF2, VecBF2, LSU, Lat12, GroupAlone], (instregex "MXDB$")>;
869 def : InstRW<[VecBF2, VecBF2, GroupAlone], (instregex "MXDBR$")>;
870 def : InstRW<[VecDF2, VecDF2, Lat20, GroupAlone], (instregex "MXBR$")>;
871
872 // Multiply and add / subtract
873 def : InstRW<[VecBF, LSU, Lat12, GroupAlone], (instregex "M(A|S)EB$")>;
874 def : InstRW<[VecBF, GroupAlone], (instregex "M(A|S)EBR$")>;
875 def : InstRW<[VecBF, LSU, Lat12, GroupAlone], (instregex "M(A|S)DB$")>;
876 def : InstRW<[VecBF], (instregex "M(A|S)DBR$")>;
877
878 // Division
879 def : InstRW<[VecFPd, LSU], (instregex "D(E|D)B$")>;
880 def : InstRW<[VecFPd], (instregex "D(E|D)BR$")>;
881 def : InstRW<[VecFPd, VecFPd, GroupAlone], (instregex "DXBR$")>;
882
883 // Divide to integer
884 def : InstRW<[VecFPd, Lat30, GroupAlone], (instregex "DI(E|D)BR$")>;
885
886 //===----------------------------------------------------------------------===//
887 // FP: Comparisons
888 //===----------------------------------------------------------------------===//
889
890 // Compare
891 def : InstRW<[VecXsPm, LSU, Lat8], (instregex "(K|C)(E|D)B$")>;
892 def : InstRW<[VecXsPm, Lat4], (instregex "(K|C)(E|D)BR?$")>;
893 def : InstRW<[VecDF, VecDF, Lat20, GroupAlone], (instregex "(K|C)XBR$")>;
894
895 // Test Data Class
896 def : InstRW<[LSU, VecXsPm, Lat9], (instregex "TC(E|D)B$")>;
897 def : InstRW<[LSU, VecDF2, VecDF2, Lat15, GroupAlone], (instregex "TCXB$")>;
898
899 //===----------------------------------------------------------------------===//
900 // FP: Floating-point control register instructions
901 //===----------------------------------------------------------------------===//
902
903 def : InstRW<[FXa, LSU, Lat4, GroupAlone], (instregex "EFPC$")>;
904 def : InstRW<[FXb, LSU, Lat5, GroupAlone], (instregex "STFPC$")>;
905 def : InstRW<[LSU, Lat3, GroupAlone], (instregex "SFPC$")>;
906 def : InstRW<[LSU, LSU, Lat6, GroupAlone], (instregex "LFPC$")>;
907 def : InstRW<[FXa, Lat30, GroupAlone], (instregex "SFASR$")>;
908 def : InstRW<[FXa, LSU, Lat30, GroupAlone], (instregex "LFAS$")>;
909 def : InstRW<[FXb, Lat3, GroupAlone], (instregex "SRNM(B|T)?$")>;
910
911 // --------------------------------- Vector --------------------------------- //
912
913 //===----------------------------------------------------------------------===//
914 // Vector: Move instructions
915 //===----------------------------------------------------------------------===//
916
917 def : InstRW<[FXb], (instregex "VLR(32|64)?$")>;
918 def : InstRW<[FXb, Lat4], (instregex "VLGV(B|F|G|H)?$")>;
919 def : InstRW<[FXb], (instregex "VLVG(B|F|G|H)?$")>;
920 def : InstRW<[FXb, Lat2], (instregex "VLVGP(32)?$")>;
921
922 //===----------------------------------------------------------------------===//
923 // Vector: Immediate instructions
924 //===----------------------------------------------------------------------===//
925
926 def : InstRW<[VecXsPm], (instregex "VZERO$")>;
927 def : InstRW<[VecXsPm], (instregex "VONE$")>;
928 def : InstRW<[VecXsPm], (instregex "VGBM$")>;
929 def : InstRW<[VecXsPm], (instregex "VGM(B|F|G|H)?$")>;
930 def : InstRW<[VecXsPm], (instregex "VREPI(B|F|G|H)?$")>;
931 def : InstRW<[VecXsPm], (instregex "VLEI(B|F|G|H)$")>;
932
933 //===----------------------------------------------------------------------===//
934 // Vector: Loads
935 //===----------------------------------------------------------------------===//
936
937 def : InstRW<[LSU], (instregex "VL(L|BB)?$")>;
938 def : InstRW<[LSU], (instregex "VL(32|64)$")>;
939 def : InstRW<[LSU], (instregex "VLLEZ(B|F|G|H)?$")>;
940 def : InstRW<[LSU], (instregex "VLREP(B|F|G|H)?$")>;
941 def : InstRW<[VecXsPm, LSU, Lat7], (instregex "VLE(B|F|G|H)$")>;
942 def : InstRW<[FXb, LSU, VecXsPm, Lat11, BeginGroup], (instregex "VGE(F|G)$")>;
943 def : InstRW<[LSU, LSU, LSU, LSU, LSU, Lat10, GroupAlone],
944               (instregex "VLM$")>;
945
946 //===----------------------------------------------------------------------===//
947 // Vector: Stores
948 //===----------------------------------------------------------------------===//
949
950 def : InstRW<[FXb, LSU, Lat8], (instregex "VST(L|32|64)?$")>;
951 def : InstRW<[FXb, LSU, Lat8], (instregex "VSTE(F|G)$")>;
952 def : InstRW<[FXb, LSU, VecXsPm, Lat11, BeginGroup], (instregex "VSTE(B|H)$")>;
953 def : InstRW<[LSU, LSU, FXb, FXb, FXb, FXb, FXb, Lat20, GroupAlone],
954               (instregex "VSTM$")>;
955 def : InstRW<[FXb, FXb, LSU, Lat12, BeginGroup], (instregex "VSCE(F|G)$")>;
956
957 //===----------------------------------------------------------------------===//
958 // Vector: Selects and permutes
959 //===----------------------------------------------------------------------===//
960
961 def : InstRW<[VecXsPm], (instregex "VMRH(B|F|G|H)?$")>;
962 def : InstRW<[VecXsPm], (instregex "VMRL(B|F|G|H)?$")>;
963 def : InstRW<[VecXsPm], (instregex "VPERM$")>;
964 def : InstRW<[VecXsPm], (instregex "VPDI$")>;
965 def : InstRW<[VecXsPm], (instregex "VREP(B|F|G|H)?$")>;
966 def : InstRW<[VecXsPm], (instregex "VSEL$")>;
967
968 //===----------------------------------------------------------------------===//
969 // Vector: Widening and narrowing
970 //===----------------------------------------------------------------------===//
971
972 def : InstRW<[VecXsPm], (instregex "VPK(F|G|H)?$")>;
973 def : InstRW<[VecXsPm], (instregex "VPKS(F|G|H)?$")>;
974 def : InstRW<[VecXsPm, Lat4], (instregex "VPKS(F|G|H)S$")>;
975 def : InstRW<[VecXsPm], (instregex "VPKLS(F|G|H)?$")>;
976 def : InstRW<[VecXsPm, Lat4], (instregex "VPKLS(F|G|H)S$")>;
977 def : InstRW<[VecXsPm], (instregex "VSEG(B|F|H)?$")>;
978 def : InstRW<[VecXsPm], (instregex "VUPH(B|F|H)?$")>;
979 def : InstRW<[VecXsPm], (instregex "VUPL(B|F)?$")>;
980 def : InstRW<[VecXsPm], (instregex "VUPLH(B|F|H|W)?$")>;
981 def : InstRW<[VecXsPm], (instregex "VUPLL(B|F|H)?$")>;
982
983 //===----------------------------------------------------------------------===//
984 // Vector: Integer arithmetic
985 //===----------------------------------------------------------------------===//
986
987 def : InstRW<[VecXsPm], (instregex "VA(B|F|G|H|Q|C|CQ)?$")>;
988 def : InstRW<[VecXsPm], (instregex "VACC(B|F|G|H|Q|C|CQ)?$")>;
989 def : InstRW<[VecXsPm], (instregex "VAVG(B|F|G|H)?$")>;
990 def : InstRW<[VecXsPm], (instregex "VAVGL(B|F|G|H)?$")>;
991 def : InstRW<[VecXsPm], (instregex "VN(C|O)?$")>;
992 def : InstRW<[VecXsPm], (instregex "VO$")>;
993 def : InstRW<[VecMul], (instregex "VCKSM$")>;
994 def : InstRW<[VecXsPm], (instregex "VCLZ(B|F|G|H)?$")>;
995 def : InstRW<[VecXsPm], (instregex "VCTZ(B|F|G|H)?$")>;
996 def : InstRW<[VecXsPm], (instregex "VX$")>;
997 def : InstRW<[VecMul], (instregex "VGFM?$")>;
998 def : InstRW<[VecMul], (instregex "VGFMA(B|F|G|H)?$")>;
999 def : InstRW<[VecMul], (instregex "VGFM(B|F|G|H)$")>;
1000 def : InstRW<[VecXsPm], (instregex "VLC(B|F|G|H)?$")>;
1001 def : InstRW<[VecXsPm], (instregex "VLP(B|F|G|H)?$")>;
1002 def : InstRW<[VecXsPm], (instregex "VMX(B|F|G|H)?$")>;
1003 def : InstRW<[VecXsPm], (instregex "VMXL(B|F|G|H)?$")>;
1004 def : InstRW<[VecXsPm], (instregex "VMN(B|F|G|H)?$")>;
1005 def : InstRW<[VecXsPm], (instregex "VMNL(B|F|G|H)?$")>;
1006 def : InstRW<[VecMul], (instregex "VMAL(B|F)?$")>;
1007 def : InstRW<[VecMul], (instregex "VMALE(B|F|H)?$")>;
1008 def : InstRW<[VecMul], (instregex "VMALH(B|F|H|W)?$")>;
1009 def : InstRW<[VecMul], (instregex "VMALO(B|F|H)?$")>;
1010 def : InstRW<[VecMul], (instregex "VMAO(B|F|H)?$")>;
1011 def : InstRW<[VecMul], (instregex "VMAE(B|F|H)?$")>;
1012 def : InstRW<[VecMul], (instregex "VMAH(B|F|H)?$")>;
1013 def : InstRW<[VecMul], (instregex "VME(B|F|H)?$")>;
1014 def : InstRW<[VecMul], (instregex "VMH(B|F|H)?$")>;
1015 def : InstRW<[VecMul], (instregex "VML(B|F)?$")>;
1016 def : InstRW<[VecMul], (instregex "VMLE(B|F|H)?$")>;
1017 def : InstRW<[VecMul], (instregex "VMLH(B|F|H|W)?$")>;
1018 def : InstRW<[VecMul], (instregex "VMLO(B|F|H)?$")>;
1019 def : InstRW<[VecMul], (instregex "VMO(B|F|H)?$")>;
1020
1021 def : InstRW<[VecXsPm], (instregex "VPOPCT$")>;
1022
1023 def : InstRW<[VecXsPm], (instregex "VERLL(B|F|G|H)?$")>;
1024 def : InstRW<[VecXsPm], (instregex "VERLLV(B|F|G|H)?$")>;
1025 def : InstRW<[VecXsPm], (instregex "VERIM(B|F|G|H)?$")>;
1026 def : InstRW<[VecXsPm], (instregex "VESL(B|F|G|H)?$")>;
1027 def : InstRW<[VecXsPm], (instregex "VESLV(B|F|G|H)?$")>;
1028 def : InstRW<[VecXsPm], (instregex "VESRA(B|F|G|H)?$")>;
1029 def : InstRW<[VecXsPm], (instregex "VESRAV(B|F|G|H)?$")>;
1030 def : InstRW<[VecXsPm], (instregex "VESRL(B|F|G|H)?$")>;
1031 def : InstRW<[VecXsPm], (instregex "VESRLV(B|F|G|H)?$")>;
1032
1033 def : InstRW<[VecXsPm], (instregex "VSL(DB)?$")>;
1034 def : InstRW<[VecXsPm, VecXsPm, Lat8], (instregex "VSLB$")>;
1035 def : InstRW<[VecXsPm], (instregex "VSR(A|L)$")>;
1036 def : InstRW<[VecXsPm, VecXsPm, Lat8], (instregex "VSR(A|L)B$")>;
1037
1038 def : InstRW<[VecXsPm], (instregex "VSB(I|IQ|CBI|CBIQ)?$")>;
1039 def : InstRW<[VecXsPm], (instregex "VSCBI(B|F|G|H|Q)?$")>;
1040 def : InstRW<[VecXsPm], (instregex "VS(F|G|H|Q)?$")>;
1041
1042 def : InstRW<[VecMul], (instregex "VSUM(B|H)?$")>;
1043 def : InstRW<[VecMul], (instregex "VSUMG(F|H)?$")>;
1044 def : InstRW<[VecMul], (instregex "VSUMQ(F|G)?$")>;
1045
1046 //===----------------------------------------------------------------------===//
1047 // Vector: Integer comparison
1048 //===----------------------------------------------------------------------===//
1049
1050 def : InstRW<[VecXsPm, Lat4], (instregex "VEC(B|F|G|H)?$")>;
1051 def : InstRW<[VecXsPm, Lat4], (instregex "VECL(B|F|G|H)?$")>;
1052 def : InstRW<[VecXsPm], (instregex "VCEQ(B|F|G|H)?$")>;
1053 def : InstRW<[VecXsPm, Lat4], (instregex "VCEQ(B|F|G|H)S$")>;
1054 def : InstRW<[VecXsPm], (instregex "VCH(B|F|G|H)?$")>;
1055 def : InstRW<[VecXsPm, Lat4], (instregex "VCH(B|F|G|H)S$")>;
1056 def : InstRW<[VecXsPm], (instregex "VCHL(B|F|G|H)?$")>;
1057 def : InstRW<[VecXsPm, Lat4], (instregex "VCHL(B|F|G|H)S$")>;
1058 def : InstRW<[VecStr, Lat5], (instregex "VTM$")>;
1059
1060 //===----------------------------------------------------------------------===//
1061 // Vector: Floating-point arithmetic
1062 //===----------------------------------------------------------------------===//
1063
1064 def : InstRW<[VecBF2], (instregex "VCD(G|GB|LG|LGB)$")>;
1065 def : InstRW<[VecBF], (instregex "WCD(GB|LGB)$")>;
1066 def : InstRW<[VecBF2], (instregex "VC(L)?GD$")>;
1067 def : InstRW<[VecBF2], (instregex "VFADB$")>;
1068 def : InstRW<[VecBF], (instregex "WFADB$")>;
1069 def : InstRW<[VecBF2], (instregex "VCGDB$")>;
1070 def : InstRW<[VecBF], (instregex "WCGDB$")>;
1071 def : InstRW<[VecBF2], (instregex "VF(I|M|A|S)$")>;
1072 def : InstRW<[VecBF2], (instregex "VF(I|M|S)DB$")>;
1073 def : InstRW<[VecBF], (instregex "WF(I|M|S)DB$")>;
1074 def : InstRW<[VecBF2], (instregex "VCLGDB$")>;
1075 def : InstRW<[VecBF], (instregex "WCLGDB$")>;
1076 def : InstRW<[VecXsPm], (instregex "VFL(C|N|P)DB$")>;
1077 def : InstRW<[VecXsPm], (instregex "WFL(C|N|P)DB$")>;
1078 def : InstRW<[VecBF2], (instregex "VFM(A|S)$")>;
1079 def : InstRW<[VecBF2], (instregex "VFM(A|S)DB$")>;
1080 def : InstRW<[VecBF], (instregex "WFM(A|S)DB$")>;
1081 def : InstRW<[VecXsPm], (instregex "VFPSO$")>;
1082 def : InstRW<[VecXsPm], (instregex "(V|W)FPSODB$")>;
1083 def : InstRW<[VecXsPm, Lat4], (instregex "VFTCI(DB)?$")>;
1084 def : InstRW<[VecXsPm, Lat4], (instregex "WFTCIDB$")>;
1085 def : InstRW<[VecBF2], (instregex "VL(DE|ED)$")>;
1086 def : InstRW<[VecBF2], (instregex "VL(DE|ED)B$")>;
1087 def : InstRW<[VecBF], (instregex "WL(DE|ED)B$")>;
1088
1089 // divide / square root
1090 def : InstRW<[VecFPd], (instregex "VFD$")>;
1091 def : InstRW<[VecFPd], (instregex "(V|W)FDDB$")>;
1092 def : InstRW<[VecFPd], (instregex "VFSQ$")>;
1093 def : InstRW<[VecFPd], (instregex "(V|W)FSQDB$")>;
1094
1095 //===----------------------------------------------------------------------===//
1096 // Vector: Floating-point comparison
1097 //===----------------------------------------------------------------------===//
1098
1099 def : InstRW<[VecXsPm], (instregex "VFC(E|H|HE)$")>;
1100 def : InstRW<[VecXsPm], (instregex "VFC(E|H|HE)DB$")>;
1101 def : InstRW<[VecXsPm, Lat4], (instregex "WF(C|K)$")>;
1102 def : InstRW<[VecXsPm], (instregex "WFC(E|H|HE)DB$")>;
1103 def : InstRW<[VecXsPm, Lat4], (instregex "VFC(E|H|HE)DBS$")>;
1104 def : InstRW<[VecXsPm, Lat4], (instregex "WFC(E|H|HE)DBS$")>;
1105 def : InstRW<[VecXsPm, Lat4], (instregex "WF(C|K)DB$")>;
1106
1107 //===----------------------------------------------------------------------===//
1108 // Vector: Floating-point insertion and extraction
1109 //===----------------------------------------------------------------------===//
1110
1111 def : InstRW<[FXb], (instregex "LEFR$")>;
1112 def : InstRW<[FXb, Lat4], (instregex "LFER$")>;
1113
1114 //===----------------------------------------------------------------------===//
1115 // Vector: String instructions
1116 //===----------------------------------------------------------------------===//
1117
1118 def : InstRW<[VecStr], (instregex "VFAE(B)?$")>;
1119 def : InstRW<[VecStr, Lat5], (instregex "VFAEBS$")>;
1120 def : InstRW<[VecStr], (instregex "VFAE(F|H)$")>;
1121 def : InstRW<[VecStr, Lat5], (instregex "VFAE(F|H)S$")>;
1122 def : InstRW<[VecStr], (instregex "VFAEZ(B|F|H)$")>;
1123 def : InstRW<[VecStr, Lat5], (instregex "VFAEZ(B|F|H)S$")>;
1124 def : InstRW<[VecStr], (instregex "VFEE(B|F|H|ZB|ZF|ZH)?$")>;
1125 def : InstRW<[VecStr, Lat5], (instregex "VFEE(B|F|H|ZB|ZF|ZH)S$")>;
1126 def : InstRW<[VecStr], (instregex "VFENE(B|F|H|ZB|ZF|ZH)?$")>;
1127 def : InstRW<[VecStr, Lat5], (instregex "VFENE(B|F|H|ZB|ZF|ZH)S$")>;
1128 def : InstRW<[VecStr], (instregex "VISTR(B|F|H)?$")>;
1129 def : InstRW<[VecStr, Lat5], (instregex "VISTR(B|F|H)S$")>;
1130 def : InstRW<[VecStr], (instregex "VSTRC(B|F|H)?$")>;
1131 def : InstRW<[VecStr, Lat5], (instregex "VSTRC(B|F|H)S$")>;
1132 def : InstRW<[VecStr], (instregex "VSTRCZ(B|F|H)$")>;
1133 def : InstRW<[VecStr, Lat5], (instregex "VSTRCZ(B|F|H)S$")>;
1134
1135 }
1136