blob: b7511d50ff39158fc7a646c31c38bfe5db1b110d [file] [log] [blame]
Ulrich Weigand5f613df2013-05-06 16:15:19 +00001//==- SystemZInstrFormats.td - SystemZ Instruction Formats --*- tablegen -*-==//
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//===----------------------------------------------------------------------===//
11// Basic SystemZ instruction definition
12//===----------------------------------------------------------------------===//
13
14class InstSystemZ<int size, dag outs, dag ins, string asmstr,
15 list<dag> pattern> : Instruction {
16 let Namespace = "SystemZ";
17
18 dag OutOperandList = outs;
19 dag InOperandList = ins;
20 let Size = size;
21 let Pattern = pattern;
22 let AsmString = asmstr;
23
24 // Used to identify a group of related instructions, such as ST and STY.
25 string Function = "";
26
27 // "12" for an instruction that has a ...Y equivalent, "20" for that
28 // ...Y equivalent.
29 string PairType = "none";
30
31 // True if this instruction is a simple D(X,B) load of a register
32 // (with no sign or zero extension).
33 bit SimpleBDXLoad = 0;
34
35 // True if this instruction is a simple D(X,B) store of a register
36 // (with no truncation).
37 bit SimpleBDXStore = 0;
38
39 // True if this instruction has a 20-bit displacement field.
40 bit Has20BitOffset = 0;
41
42 // True if addresses in this instruction have an index register.
43 bit HasIndex = 0;
44
45 // True if this is a 128-bit pseudo instruction that combines two 64-bit
46 // operations.
47 bit Is128Bit = 0;
48
49 let TSFlags{0} = SimpleBDXLoad;
50 let TSFlags{1} = SimpleBDXStore;
51 let TSFlags{2} = Has20BitOffset;
52 let TSFlags{3} = HasIndex;
53 let TSFlags{4} = Is128Bit;
54}
55
56//===----------------------------------------------------------------------===//
57// Mappings between instructions
58//===----------------------------------------------------------------------===//
59
60// Return the version of an instruction that has an unsigned 12-bit
61// displacement.
62def getDisp12Opcode : InstrMapping {
63 let FilterClass = "InstSystemZ";
64 let RowFields = ["Function"];
65 let ColFields = ["PairType"];
66 let KeyCol = ["20"];
67 let ValueCols = [["12"]];
68}
69
70// Return the version of an instruction that has a signed 20-bit displacement.
71def getDisp20Opcode : InstrMapping {
72 let FilterClass = "InstSystemZ";
73 let RowFields = ["Function"];
74 let ColFields = ["PairType"];
75 let KeyCol = ["12"];
76 let ValueCols = [["20"]];
77}
78
79//===----------------------------------------------------------------------===//
80// Instruction formats
81//===----------------------------------------------------------------------===//
82//
83// Formats are specified using operand field declarations of the form:
84//
Richard Sandifordd454ec02013-05-14 09:28:21 +000085// bits<4> Rn : register input or output for operand n
86// bits<m> In : immediate value of width m for operand n
87// bits<4> BDn : address operand n, which has a base and a displacement
88// bits<m> XBDn : address operand n, which has an index, a base and a
89// displacement
90// bits<4> Xn : index register for address operand n
91// bits<4> Mn : mode value for operand n
Ulrich Weigand5f613df2013-05-06 16:15:19 +000092//
Richard Sandifordd454ec02013-05-14 09:28:21 +000093// The operand numbers ("n" in the list above) follow the architecture manual.
94// Assembly operands sometimes have a different order; in particular, R3 often
95// is often written between operands 1 and 2.
Ulrich Weigand5f613df2013-05-06 16:15:19 +000096//
97//===----------------------------------------------------------------------===//
98
99class InstRI<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
100 : InstSystemZ<4, outs, ins, asmstr, pattern> {
101 field bits<32> Inst;
102
103 bits<4> R1;
104 bits<16> I2;
105
106 let Inst{31-24} = op{11-4};
107 let Inst{23-20} = R1;
108 let Inst{19-16} = op{3-0};
109 let Inst{15-0} = I2;
110}
111
112class InstRIEf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
113 : InstSystemZ<6, outs, ins, asmstr, pattern> {
114 field bits<48> Inst;
115
116 bits<4> R1;
117 bits<4> R2;
118 bits<8> I3;
119 bits<8> I4;
120 bits<8> I5;
121
122 let Inst{47-40} = op{15-8};
123 let Inst{39-36} = R1;
124 let Inst{35-32} = R2;
125 let Inst{31-24} = I3;
126 let Inst{23-16} = I4;
127 let Inst{15-8} = I5;
128 let Inst{7-0} = op{7-0};
129}
130
131class InstRIL<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern>
132 : InstSystemZ<6, outs, ins, asmstr, pattern> {
133 field bits<48> Inst;
134
135 bits<4> R1;
136 bits<32> I2;
137
138 let Inst{47-40} = op{11-4};
139 let Inst{39-36} = R1;
140 let Inst{35-32} = op{3-0};
141 let Inst{31-0} = I2;
142}
143
144class InstRR<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
145 : InstSystemZ<2, outs, ins, asmstr, pattern> {
146 field bits<16> Inst;
147
148 bits<4> R1;
149 bits<4> R2;
150
151 let Inst{15-8} = op;
152 let Inst{7-4} = R1;
153 let Inst{3-0} = R2;
154}
155
156class InstRRD<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
157 : InstSystemZ<4, outs, ins, asmstr, pattern> {
158 field bits<32> Inst;
159
160 bits<4> R1;
161 bits<4> R3;
162 bits<4> R2;
163
164 let Inst{31-16} = op;
165 let Inst{15-12} = R1;
166 let Inst{11-8} = 0;
167 let Inst{7-4} = R3;
168 let Inst{3-0} = R2;
169}
170
171class InstRRE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
172 : InstSystemZ<4, outs, ins, asmstr, pattern> {
173 field bits<32> Inst;
174
175 bits<4> R1;
176 bits<4> R2;
177
178 let Inst{31-16} = op;
179 let Inst{15-8} = 0;
180 let Inst{7-4} = R1;
181 let Inst{3-0} = R2;
182}
183
184class InstRRF<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
185 : InstSystemZ<4, outs, ins, asmstr, pattern> {
186 field bits<32> Inst;
187
188 bits<4> R1;
189 bits<4> R2;
190 bits<4> R3;
191
192 let Inst{31-16} = op;
193 let Inst{15-12} = R3;
194 let Inst{11-8} = 0;
195 let Inst{7-4} = R1;
196 let Inst{3-0} = R2;
197}
198
199class InstRX<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
200 : InstSystemZ<4, outs, ins, asmstr, pattern> {
201 field bits<32> Inst;
202
203 bits<4> R1;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000204 bits<20> XBD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000205
206 let Inst{31-24} = op;
207 let Inst{23-20} = R1;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000208 let Inst{19-0} = XBD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000209
210 let HasIndex = 1;
211}
212
213class InstRXE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
214 : InstSystemZ<6, outs, ins, asmstr, pattern> {
215 field bits<48> Inst;
216
217 bits<4> R1;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000218 bits<20> XBD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000219
220 let Inst{47-40} = op{15-8};
221 let Inst{39-36} = R1;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000222 let Inst{35-16} = XBD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000223 let Inst{15-8} = 0;
224 let Inst{7-0} = op{7-0};
225
226 let HasIndex = 1;
227}
228
229class InstRXF<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
230 : InstSystemZ<6, outs, ins, asmstr, pattern> {
231 field bits<48> Inst;
232
233 bits<4> R1;
234 bits<4> R3;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000235 bits<20> XBD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000236
237 let Inst{47-40} = op{15-8};
238 let Inst{39-36} = R3;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000239 let Inst{35-16} = XBD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000240 let Inst{15-12} = R1;
241 let Inst{11-8} = 0;
242 let Inst{7-0} = op{7-0};
243
244 let HasIndex = 1;
245}
246
247class InstRXY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
248 : InstSystemZ<6, outs, ins, asmstr, pattern> {
249 field bits<48> Inst;
250
251 bits<4> R1;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000252 bits<28> XBD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000253
254 let Inst{47-40} = op{15-8};
255 let Inst{39-36} = R1;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000256 let Inst{35-8} = XBD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000257 let Inst{7-0} = op{7-0};
258
259 let Has20BitOffset = 1;
260 let HasIndex = 1;
261}
262
263class InstRS<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
264 : InstSystemZ<4, outs, ins, asmstr, pattern> {
265 field bits<32> Inst;
266
267 bits<4> R1;
268 bits<4> R3;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000269 bits<16> BD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000270
271 let Inst{31-24} = op;
272 let Inst{23-20} = R1;
273 let Inst{19-16} = R3;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000274 let Inst{15-0} = BD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000275}
276
277class InstRSY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
278 : InstSystemZ<6, outs, ins, asmstr, pattern> {
279 field bits<48> Inst;
280
281 bits<4> R1;
282 bits<4> R3;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000283 bits<24> BD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000284
285 let Inst{47-40} = op{15-8};
286 let Inst{39-36} = R1;
287 let Inst{35-32} = R3;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000288 let Inst{31-8} = BD2;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000289 let Inst{7-0} = op{7-0};
290
291 let Has20BitOffset = 1;
292}
293
294class InstSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern>
295 : InstSystemZ<4, outs, ins, asmstr, pattern> {
296 field bits<32> Inst;
297
Richard Sandifordd454ec02013-05-14 09:28:21 +0000298 bits<16> BD1;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000299 bits<8> I2;
300
301 let Inst{31-24} = op;
302 let Inst{23-16} = I2;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000303 let Inst{15-0} = BD1;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000304}
305
306class InstSIL<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
307 : InstSystemZ<6, outs, ins, asmstr, pattern> {
308 field bits<48> Inst;
309
Richard Sandifordd454ec02013-05-14 09:28:21 +0000310 bits<16> BD1;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000311 bits<16> I2;
312
313 let Inst{47-32} = op;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000314 let Inst{31-16} = BD1;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000315 let Inst{15-0} = I2;
316}
317
318class InstSIY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern>
319 : InstSystemZ<6, outs, ins, asmstr, pattern> {
320 field bits<48> Inst;
321
Richard Sandifordd454ec02013-05-14 09:28:21 +0000322 bits<24> BD1;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000323 bits<8> I2;
324
325 let Inst{47-40} = op{15-8};
326 let Inst{39-32} = I2;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000327 let Inst{31-8} = BD1;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000328 let Inst{7-0} = op{7-0};
329
330 let Has20BitOffset = 1;
331}
332
333//===----------------------------------------------------------------------===//
334// Instruction definitions with semantics
335//===----------------------------------------------------------------------===//
336//
337// These classes have the form <Category><Format>, where <Format> is one
338// of the formats defined above and where <Category> describes the inputs
339// and outputs. <Category> can be one of:
340//
341// Inherent:
342// One register output operand and no input operands.
343//
344// Store:
345// One register or immediate input operand and one address input operand.
346// The instruction stores the first operand to the address.
347//
348// This category is used for both pure and truncating stores.
349//
350// LoadMultiple:
351// One address input operand and two explicit output operands.
352// The instruction loads a range of registers from the address,
353// with the explicit operands giving the first and last register
354// to load. Other loaded registers are added as implicit definitions.
355//
356// StoreMultiple:
357// Two explicit input register operands and an address operand.
358// The instruction stores a range of registers to the address,
359// with the explicit operands giving the first and last register
360// to store. Other stored registers are added as implicit uses.
361//
362// Unary:
363// One register output operand and one input operand. The input
364// operand may be a register, immediate or memory.
365//
366// Binary:
367// One register output operand and two input operands. The first
368// input operand is always a register and he second may be a register,
369// immediate or memory.
370//
371// Shift:
372// One register output operand and two input operands. The first
373// input operand is a register and the second has the same form as
374// an address (although it isn't actually used to address memory).
375//
376// Compare:
377// Two input operands. The first operand is always a register,
378// the second may be a register, immediate or memory.
379//
380// Ternary:
381// One register output operand and three register input operands.
382//
383// CmpSwap:
384// One output operand and three input operands. The first two
385// operands are registers and the third is an address. The instruction
386// both reads from and writes to the address.
387//
388// RotateSelect:
389// One output operand and five input operands. The first two operands
390// are registers and the other three are immediates.
391//
392// The format determines which input operands are tied to output operands,
393// and also determines the shape of any address operand.
394//
395// Multiclasses of the form <Category><Format>Pair define two instructions,
396// one with <Category><Format> and one with <Category><Format>Y. The name
397// of the first instruction has no suffix, the name of the second has
398// an extra "y".
399//
400//===----------------------------------------------------------------------===//
401
402class InherentRRE<string mnemonic, bits<16> opcode, RegisterOperand cls,
403 dag src>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000404 : InstRRE<opcode, (outs cls:$R1), (ins),
405 mnemonic#"\t$R1",
406 [(set cls:$R1, src)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000407 let R2 = 0;
408}
409
410class LoadMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000411 : InstRSY<opcode, (outs cls:$R1, cls:$R3), (ins bdaddr20only:$BD2),
412 mnemonic#"\t$R1, $R3, $BD2", []> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000413 let mayLoad = 1;
414}
415
416class StoreRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
417 RegisterOperand cls>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000418 : InstRIL<opcode, (outs), (ins cls:$R1, pcrel32:$I2),
419 mnemonic#"\t$R1, $I2",
420 [(operator cls:$R1, pcrel32:$I2)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000421 let mayStore = 1;
422 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
423 // However, BDXs have two extra operands and are therefore 6 units more
424 // complex.
425 let AddedComplexity = 7;
426}
427
428class StoreRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
429 RegisterOperand cls, AddressingMode mode = bdxaddr12only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000430 : InstRX<opcode, (outs), (ins cls:$R1, mode:$XBD2),
431 mnemonic#"\t$R1, $XBD2",
432 [(operator cls:$R1, mode:$XBD2)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000433 let mayStore = 1;
434}
435
436class StoreRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
437 RegisterOperand cls, AddressingMode mode = bdxaddr20only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000438 : InstRXY<opcode, (outs), (ins cls:$R1, mode:$XBD2),
439 mnemonic#"\t$R1, $XBD2",
440 [(operator cls:$R1, mode:$XBD2)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000441 let mayStore = 1;
442}
443
444multiclass StoreRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
445 SDPatternOperator operator, RegisterOperand cls> {
446 let Function = mnemonic ## #cls in {
447 let PairType = "12" in
448 def "" : StoreRX<mnemonic, rxOpcode, operator, cls, bdxaddr12pair>;
449 let PairType = "20" in
450 def Y : StoreRXY<mnemonic#"y", rxyOpcode, operator, cls, bdxaddr20pair>;
451 }
452}
453
454class StoreMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000455 : InstRSY<opcode, (outs), (ins cls:$R1, cls:$R3, bdaddr20only:$BD2),
456 mnemonic#"\t$R1, $R3, $BD2", []> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000457 let mayStore = 1;
458}
459
460class StoreSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
461 Immediate imm, AddressingMode mode = bdaddr12only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000462 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
463 mnemonic#"\t$BD1, $I2",
464 [(operator imm:$I2, mode:$BD1)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000465 let mayStore = 1;
466}
467
468class StoreSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
469 Immediate imm, AddressingMode mode = bdaddr20only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000470 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
471 mnemonic#"\t$BD1, $I2",
472 [(operator imm:$I2, mode:$BD1)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000473 let mayStore = 1;
474}
475
476class StoreSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
477 Immediate imm>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000478 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
479 mnemonic#"\t$BD1, $I2",
480 [(operator imm:$I2, bdaddr12only:$BD1)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000481 let mayStore = 1;
482}
483
484multiclass StoreSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
485 SDPatternOperator operator, Immediate imm> {
486 let Function = mnemonic in {
487 let PairType = "12" in
488 def "" : StoreSI<mnemonic, siOpcode, operator, imm, bdaddr12pair>;
489 let PairType = "20" in
490 def Y : StoreSIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>;
491 }
492}
493
494class UnaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
495 RegisterOperand cls1, RegisterOperand cls2>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000496 : InstRR<opcode, (outs cls1:$R1), (ins cls2:$R2),
497 mnemonic#"\t$R1, $R2",
498 [(set cls1:$R1, (operator cls2:$R2))]>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000499
500class UnaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
501 RegisterOperand cls1, RegisterOperand cls2>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000502 : InstRRE<opcode, (outs cls1:$R1), (ins cls2:$R2),
503 mnemonic#"\t$R1, $R2",
504 [(set cls1:$R1, (operator cls2:$R2))]>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000505
506class UnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1,
507 RegisterOperand cls2>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000508 : InstRRF<opcode, (outs cls1:$R1), (ins uimm8zx4:$R3, cls2:$R2),
509 mnemonic#"\t$R1, $R3, $R2", []>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000510
511class UnaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
512 RegisterOperand cls, Immediate imm>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000513 : InstRI<opcode, (outs cls:$R1), (ins imm:$I2),
514 mnemonic#"\t$R1, $I2",
515 [(set cls:$R1, (operator imm:$I2))]>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000516
517class UnaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
518 RegisterOperand cls, Immediate imm>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000519 : InstRIL<opcode, (outs cls:$R1), (ins imm:$I2),
520 mnemonic#"\t$R1, $I2",
521 [(set cls:$R1, (operator imm:$I2))]>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000522
523class UnaryRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
524 RegisterOperand cls>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000525 : InstRIL<opcode, (outs cls:$R1), (ins pcrel32:$I2),
526 mnemonic#"\t$R1, $I2",
527 [(set cls:$R1, (operator pcrel32:$I2))]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000528 let mayLoad = 1;
529 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
530 // However, BDXs have two extra operands and are therefore 6 units more
531 // complex.
532 let AddedComplexity = 7;
533}
534
535class UnaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
536 RegisterOperand cls, AddressingMode mode = bdxaddr12only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000537 : InstRX<opcode, (outs cls:$R1), (ins mode:$XBD2),
538 mnemonic#"\t$R1, $XBD2",
539 [(set cls:$R1, (operator mode:$XBD2))]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000540 let mayLoad = 1;
541}
542
543class UnaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
544 RegisterOperand cls>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000545 : InstRXE<opcode, (outs cls:$R1), (ins bdxaddr12only:$XBD2),
546 mnemonic#"\t$R1, $XBD2",
547 [(set cls:$R1, (operator bdxaddr12only:$XBD2))]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000548 let mayLoad = 1;
549}
550
551class UnaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
552 RegisterOperand cls, AddressingMode mode = bdxaddr20only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000553 : InstRXY<opcode, (outs cls:$R1), (ins mode:$XBD2),
554 mnemonic#"\t$R1, $XBD2",
555 [(set cls:$R1, (operator mode:$XBD2))]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000556 let mayLoad = 1;
557}
558
559multiclass UnaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
560 SDPatternOperator operator, RegisterOperand cls> {
561 let Function = mnemonic ## #cls in {
562 let PairType = "12" in
563 def "" : UnaryRX<mnemonic, rxOpcode, operator, cls, bdxaddr12pair>;
564 let PairType = "20" in
565 def Y : UnaryRXY<mnemonic#"y", rxyOpcode, operator, cls, bdxaddr20pair>;
566 }
567}
568
569class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
570 RegisterOperand cls1, RegisterOperand cls2>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000571 : InstRR<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
572 mnemonic#"\t$R1, $R2",
573 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
574 let Constraints = "$R1 = $R1src";
575 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000576}
577
578class BinaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
579 RegisterOperand cls1, RegisterOperand cls2>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000580 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2),
581 mnemonic#"\t$R1, $R2",
582 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> {
583 let Constraints = "$R1 = $R1src";
584 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000585}
586
Richard Sandifordd454ec02013-05-14 09:28:21 +0000587class BinaryRRF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
588 RegisterOperand cls1, RegisterOperand cls2>
589 : InstRRF<opcode, (outs cls1:$R1), (ins cls1:$R3, cls2:$R2),
590 mnemonic#"\t$R1, $R3, $R2",
591 [(set cls1:$R1, (operator cls1:$R3, cls2:$R2))]>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000592
593class BinaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
594 RegisterOperand cls, Immediate imm>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000595 : InstRI<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
596 mnemonic#"\t$R1, $I2",
597 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
598 let Constraints = "$R1 = $R1src";
599 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000600}
601
602class BinaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
603 RegisterOperand cls, Immediate imm>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000604 : InstRIL<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2),
605 mnemonic#"\t$R1, $I2",
606 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> {
607 let Constraints = "$R1 = $R1src";
608 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000609}
610
611class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
612 RegisterOperand cls, SDPatternOperator load,
613 AddressingMode mode = bdxaddr12only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000614 : InstRX<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2),
615 mnemonic#"\t$R1, $XBD2",
616 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
617 let Constraints = "$R1 = $R1src";
618 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000619 let mayLoad = 1;
620}
621
622class BinaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
623 RegisterOperand cls, SDPatternOperator load>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000624 : InstRXE<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2),
625 mnemonic#"\t$R1, $XBD2",
626 [(set cls:$R1, (operator cls:$R1src,
627 (load bdxaddr12only:$XBD2)))]> {
628 let Constraints = "$R1 = $R1src";
629 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000630 let mayLoad = 1;
631}
632
633class BinaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
634 RegisterOperand cls, SDPatternOperator load,
635 AddressingMode mode = bdxaddr20only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000636 : InstRXY<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2),
637 mnemonic#"\t$R1, $XBD2",
638 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> {
639 let Constraints = "$R1 = $R1src";
640 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000641 let mayLoad = 1;
642}
643
644multiclass BinaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
645 SDPatternOperator operator, RegisterOperand cls,
646 SDPatternOperator load> {
647 let Function = mnemonic ## #cls in {
648 let PairType = "12" in
649 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bdxaddr12pair>;
650 let PairType = "20" in
651 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load,
652 bdxaddr20pair>;
653 }
654}
655
656class BinarySI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
657 Operand imm, AddressingMode mode = bdaddr12only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000658 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
659 mnemonic#"\t$BD1, $I2",
660 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000661 let mayLoad = 1;
662 let mayStore = 1;
663}
664
665class BinarySIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
666 Operand imm, AddressingMode mode = bdaddr20only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000667 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
668 mnemonic#"\t$BD1, $I2",
669 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000670 let mayLoad = 1;
671 let mayStore = 1;
672}
673
674multiclass BinarySIPair<string mnemonic, bits<8> siOpcode,
675 bits<16> siyOpcode, SDPatternOperator operator,
676 Operand imm> {
677 let Function = mnemonic ## #cls in {
678 let PairType = "12" in
679 def "" : BinarySI<mnemonic, siOpcode, operator, imm, bdaddr12pair>;
680 let PairType = "20" in
681 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>;
682 }
683}
684
685class ShiftRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
686 RegisterOperand cls, AddressingMode mode>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000687 : InstRS<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2),
688 mnemonic#"\t$R1, $BD2",
689 [(set cls:$R1, (operator cls:$R1src, mode:$BD2))]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000690 let R3 = 0;
Richard Sandifordd454ec02013-05-14 09:28:21 +0000691 let Constraints = "$R1 = $R1src";
692 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000693}
694
695class ShiftRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
696 RegisterOperand cls, AddressingMode mode>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000697 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R3, mode:$BD2),
698 mnemonic#"\t$R1, $R3, $BD2",
699 [(set cls:$R1, (operator cls:$R3, mode:$BD2))]>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000700
701class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator,
702 RegisterOperand cls1, RegisterOperand cls2>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000703 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2),
704 mnemonic#"\t$R1, $R2",
705 [(operator cls1:$R1, cls2:$R2)]>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000706
707class CompareRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
708 RegisterOperand cls1, RegisterOperand cls2>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000709 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2),
710 mnemonic#"\t$R1, $R2",
711 [(operator cls1:$R1, cls2:$R2)]>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000712
713class CompareRI<string mnemonic, bits<12> opcode, SDPatternOperator operator,
714 RegisterOperand cls, Immediate imm>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000715 : InstRI<opcode, (outs), (ins cls:$R1, imm:$I2),
716 mnemonic#"\t$R1, $I2",
717 [(operator cls:$R1, imm:$I2)]>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000718
719class CompareRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator,
720 RegisterOperand cls, Immediate imm>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000721 : InstRIL<opcode, (outs), (ins cls:$R1, imm:$I2),
722 mnemonic#"\t$R1, $I2",
723 [(operator cls:$R1, imm:$I2)]>;
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000724
725class CompareRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator,
726 RegisterOperand cls, SDPatternOperator load>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000727 : InstRIL<opcode, (outs), (ins cls:$R1, pcrel32:$I2),
728 mnemonic#"\t$R1, $I2",
729 [(operator cls:$R1, (load pcrel32:$I2))]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000730 let mayLoad = 1;
731 // We want PC-relative addresses to be tried ahead of BD and BDX addresses.
732 // However, BDXs have two extra operands and are therefore 6 units more
733 // complex.
734 let AddedComplexity = 7;
735}
736
737class CompareRX<string mnemonic, bits<8> opcode, SDPatternOperator operator,
738 RegisterOperand cls, SDPatternOperator load,
739 AddressingMode mode = bdxaddr12only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000740 : InstRX<opcode, (outs), (ins cls:$R1, mode:$XBD2),
741 mnemonic#"\t$R1, $XBD2",
742 [(operator cls:$R1, (load mode:$XBD2))]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000743 let mayLoad = 1;
744}
745
746class CompareRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator,
747 RegisterOperand cls, SDPatternOperator load>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000748 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2),
749 mnemonic#"\t$R1, $XBD2",
750 [(operator cls:$R1, (load bdxaddr12only:$XBD2))]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000751 let mayLoad = 1;
752}
753
754class CompareRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
755 RegisterOperand cls, SDPatternOperator load,
756 AddressingMode mode = bdxaddr20only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000757 : InstRXY<opcode, (outs), (ins cls:$R1, mode:$XBD2),
758 mnemonic#"\t$R1, $XBD2",
759 [(operator cls:$R1, (load mode:$XBD2))]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000760 let mayLoad = 1;
761}
762
763multiclass CompareRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode,
764 SDPatternOperator operator, RegisterOperand cls,
765 SDPatternOperator load> {
766 let Function = mnemonic ## #cls in {
767 let PairType = "12" in
768 def "" : CompareRX<mnemonic, rxOpcode, operator, cls,
769 load, bdxaddr12pair>;
770 let PairType = "20" in
771 def Y : CompareRXY<mnemonic#"y", rxyOpcode, operator, cls,
772 load, bdxaddr20pair>;
773 }
774}
775
776class CompareSI<string mnemonic, bits<8> opcode, SDPatternOperator operator,
777 SDPatternOperator load, Immediate imm,
778 AddressingMode mode = bdaddr12only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000779 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2),
780 mnemonic#"\t$BD1, $I2",
781 [(operator (load mode:$BD1), imm:$I2)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000782 let mayLoad = 1;
783}
784
785class CompareSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator,
786 SDPatternOperator load, Immediate imm>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000787 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2),
788 mnemonic#"\t$BD1, $I2",
789 [(operator (load bdaddr12only:$BD1), imm:$I2)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000790 let mayLoad = 1;
791}
792
793class CompareSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
794 SDPatternOperator load, Immediate imm,
795 AddressingMode mode = bdaddr20only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000796 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2),
797 mnemonic#"\t$BD1, $I2",
798 [(operator (load mode:$BD1), imm:$I2)]> {
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000799 let mayLoad = 1;
800}
801
802multiclass CompareSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode,
803 SDPatternOperator operator, SDPatternOperator load,
804 Immediate imm> {
805 let Function = mnemonic in {
806 let PairType = "12" in
807 def "" : CompareSI<mnemonic, siOpcode, operator, load, imm, bdaddr12pair>;
808 let PairType = "20" in
809 def Y : CompareSIY<mnemonic#"y", siyOpcode, operator, load, imm,
810 bdaddr20pair>;
811 }
812}
813
814class TernaryRRD<string mnemonic, bits<16> opcode,
815 SDPatternOperator operator, RegisterOperand cls>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000816 : InstRRD<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, cls:$R2),
817 mnemonic#"\t$R1, $R3, $R2",
818 [(set cls:$R1, (operator cls:$R1src, cls:$R3, cls:$R2))]> {
819 let Constraints = "$R1 = $R1src";
820 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000821}
822
823class TernaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator,
824 RegisterOperand cls, SDPatternOperator load>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000825 : InstRXF<opcode, (outs cls:$R1),
826 (ins cls:$R1src, cls:$R3, bdxaddr12only:$XBD2),
827 mnemonic#"\t$R1, $R3, $XBD2",
828 [(set cls:$R1, (operator cls:$R1src, cls:$R3,
829 (load bdxaddr12only:$XBD2)))]> {
830 let Constraints = "$R1 = $R1src";
831 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000832 let mayLoad = 1;
833}
834
835class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator,
836 RegisterOperand cls, AddressingMode mode = bdaddr12only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000837 : InstRS<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
838 mnemonic#"\t$R1, $R3, $BD2",
839 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
840 let Constraints = "$R1 = $R1src";
841 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000842 let mayLoad = 1;
843 let mayStore = 1;
844}
845
846class CmpSwapRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator,
847 RegisterOperand cls, AddressingMode mode = bdaddr20only>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000848 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2),
849 mnemonic#"\t$R1, $R3, $BD2",
850 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> {
851 let Constraints = "$R1 = $R1src";
852 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000853 let mayLoad = 1;
854 let mayStore = 1;
855}
856
857multiclass CmpSwapRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode,
858 SDPatternOperator operator, RegisterOperand cls> {
859 let Function = mnemonic ## #cls in {
860 let PairType = "12" in
861 def "" : CmpSwapRS<mnemonic, rsOpcode, operator, cls, bdaddr12pair>;
862 let PairType = "20" in
863 def Y : CmpSwapRSY<mnemonic#"y", rsyOpcode, operator, cls, bdaddr20pair>;
864 }
865}
866
867class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1,
868 RegisterOperand cls2>
Richard Sandifordd454ec02013-05-14 09:28:21 +0000869 : InstRIEf<opcode, (outs cls1:$R1),
870 (ins cls1:$R1src, cls2:$R2,
871 uimm8zx6:$I3, uimm8zx6:$I4, uimm8zx6:$I5),
872 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> {
873 let Constraints = "$R1 = $R1src";
874 let DisableEncoding = "$R1src";
Ulrich Weigand5f613df2013-05-06 16:15:19 +0000875}
876
877//===----------------------------------------------------------------------===//
878// Pseudo instructions
879//===----------------------------------------------------------------------===//
880//
881// Convenience instructions that get lowered to real instructions
882// by either SystemZTargetLowering::EmitInstrWithCustomInserter()
883// or SystemZInstrInfo::expandPostRAPseudo().
884//
885//===----------------------------------------------------------------------===//
886
887class Pseudo<dag outs, dag ins, list<dag> pattern>
888 : InstSystemZ<0, outs, ins, "", pattern> {
889 let isPseudo = 1;
890 let isCodeGenOnly = 1;
891}
892
893// Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is
894// the value of the PSW's 2-bit condition code field.
895class SelectWrapper<RegisterOperand cls>
896 : Pseudo<(outs cls:$dst), (ins cls:$src1, cls:$src2, i8imm:$cc),
897 [(set cls:$dst, (z_select_ccmask cls:$src1, cls:$src2, imm:$cc))]> {
898 let usesCustomInserter = 1;
899 // Although the instructions used by these nodes do not in themselves
900 // change the PSW, the insertion requires new blocks, and the PSW cannot
901 // be live across them.
902 let Defs = [PSW];
903 let Uses = [PSW];
904}
905
906// OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation. PAT and OPERAND
907// describe the second (non-memory) operand.
908class AtomicLoadBinary<SDPatternOperator operator, RegisterOperand cls,
909 dag pat, DAGOperand operand>
910 : Pseudo<(outs cls:$dst), (ins bdaddr20only:$ptr, operand:$src2),
911 [(set cls:$dst, (operator bdaddr20only:$ptr, pat))]> {
912 let Defs = [PSW];
913 let Has20BitOffset = 1;
914 let mayLoad = 1;
915 let mayStore = 1;
916 let usesCustomInserter = 1;
917}
918
919// Specializations of AtomicLoadWBinary.
920class AtomicLoadBinaryReg32<SDPatternOperator operator>
921 : AtomicLoadBinary<operator, GR32, (i32 GR32:$src2), GR32>;
922class AtomicLoadBinaryImm32<SDPatternOperator operator, Immediate imm>
923 : AtomicLoadBinary<operator, GR32, (i32 imm:$src2), imm>;
924class AtomicLoadBinaryReg64<SDPatternOperator operator>
925 : AtomicLoadBinary<operator, GR64, (i64 GR64:$src2), GR64>;
926class AtomicLoadBinaryImm64<SDPatternOperator operator, Immediate imm>
927 : AtomicLoadBinary<operator, GR64, (i64 imm:$src2), imm>;
928
929// OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation. PAT and OPERAND
930// describe the second (non-memory) operand.
931class AtomicLoadWBinary<SDPatternOperator operator, dag pat,
932 DAGOperand operand>
933 : Pseudo<(outs GR32:$dst),
934 (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift,
935 ADDR32:$negbitshift, uimm32:$bitsize),
936 [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift,
937 ADDR32:$negbitshift, uimm32:$bitsize))]> {
938 let Defs = [PSW];
939 let Has20BitOffset = 1;
940 let mayLoad = 1;
941 let mayStore = 1;
942 let usesCustomInserter = 1;
943}
944
945// Specializations of AtomicLoadWBinary.
946class AtomicLoadWBinaryReg<SDPatternOperator operator>
947 : AtomicLoadWBinary<operator, (i32 GR32:$src2), GR32>;
948class AtomicLoadWBinaryImm<SDPatternOperator operator, Immediate imm>
949 : AtomicLoadWBinary<operator, (i32 imm:$src2), imm>;