1 //==- SystemZInstrSystem.td - SystemZ system instructions -*- tblgen-*-----==//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // The instructions in this file implement SystemZ system-level instructions.
10 // Most of these instructions are privileged or semi-privileged. They are
11 // not used for code generation, but are provided for use with the assembler
12 // and disassembler only.
14 //===----------------------------------------------------------------------===//
16 //===----------------------------------------------------------------------===//
17 // Program-Status Word Instructions.
18 //===----------------------------------------------------------------------===//
21 let hasSideEffects = 1, Uses = [CC] in
22 def EPSW : InherentDualRRE<"epsw", 0xB98D, GR32>;
24 // Load PSW (extended).
25 let hasSideEffects = 1, Defs = [CC] in {
26 def LPSW : SideEffectUnaryS<"lpsw", 0x8200, null_frag, 8>;
27 def LPSWE : SideEffectUnaryS<"lpswe", 0xB2B2, null_frag, 16>;
31 let Uses = [R2L], Defs = [R2L] in
32 def IPK : SideEffectInherentS<"ipk", 0xB20B, null_frag>;
34 // Set PSW key from address.
35 let hasSideEffects = 1 in
36 def SPKA : SideEffectAddressS<"spka", 0xB20A, null_frag>;
39 let hasSideEffects = 1 in
40 def SSM : SideEffectUnaryS<"ssm", 0x8000, null_frag, 1>;
42 // Store then AND/OR system mask.
43 let hasSideEffects = 1 in {
44 def STNSM : StoreSI<"stnsm", 0xAC, null_frag, imm32zx8>;
45 def STOSM : StoreSI<"stosm", 0xAD, null_frag, imm32zx8>;
48 // Insert address space control.
49 let hasSideEffects = 1 in
50 def IAC : InherentRRE<"iac", 0xB224, GR32, null_frag>;
52 // Set address space control (fast).
53 let hasSideEffects = 1 in {
54 def SAC : SideEffectAddressS<"sac", 0xB219, null_frag>;
55 def SACF : SideEffectAddressS<"sacf", 0xB279, null_frag>;
58 //===----------------------------------------------------------------------===//
59 // Control Register Instructions.
60 //===----------------------------------------------------------------------===//
62 let hasSideEffects = 1 in {
64 def LCTL : LoadMultipleRS<"lctl", 0xB7, CR64>;
65 def LCTLG : LoadMultipleRSY<"lctlg", 0xEB2F, CR64>;
68 def STCTL : StoreMultipleRS<"stctl", 0xB6, CR64>;
69 def STCTG : StoreMultipleRSY<"stctg", 0xEB25, CR64>;
72 // Extract primary ASN (and instance).
73 let hasSideEffects = 1 in {
74 def EPAR : InherentRRE<"epar", 0xB226, GR32, null_frag>;
75 def EPAIR : InherentRRE<"epair", 0xB99A, GR64, null_frag>;
78 // Extract secondary ASN (and instance).
79 let hasSideEffects = 1 in {
80 def ESAR : InherentRRE<"esar", 0xB227, GR32, null_frag>;
81 def ESAIR : InherentRRE<"esair", 0xB99B, GR64, null_frag>;
84 // Set secondary ASN (and instance).
85 let hasSideEffects = 1 in {
86 def SSAR : SideEffectUnaryRRE<"ssar", 0xB225, GR32, null_frag>;
87 def SSAIR : SideEffectUnaryRRE<"ssair", 0xB99F, GR64, null_frag>;
90 // Extract and set extended authority.
91 let hasSideEffects = 1 in
92 def ESEA : UnaryTiedRRE<"esea", 0xB99D, GR32>;
94 //===----------------------------------------------------------------------===//
95 // Prefix-Register Instructions.
96 //===----------------------------------------------------------------------===//
99 let hasSideEffects = 1 in
100 def SPX : SideEffectUnaryS<"spx", 0xB210, null_frag, 4>;
103 let hasSideEffects = 1 in
104 def STPX : StoreInherentS<"stpx", 0xB211, null_frag, 4>;
106 //===----------------------------------------------------------------------===//
107 // Storage-Key and Real Memory Instructions.
108 //===----------------------------------------------------------------------===//
110 // Insert storage key extended.
111 let hasSideEffects = 1 in
112 def ISKE : BinaryRRE<"iske", 0xB229, null_frag, GR32, GR64>;
114 // Insert virtual storage key.
115 let hasSideEffects = 1 in
116 def IVSK : BinaryRRE<"ivsk", 0xB223, null_frag, GR32, GR64>;
118 // Set storage key extended.
119 let hasSideEffects = 1, Defs = [CC] in
120 defm SSKE : SideEffectTernaryRRFcOpt<"sske", 0xB22B, GR32, GR64>;
122 // Reset reference bit extended.
123 let hasSideEffects = 1, Defs = [CC] in
124 def RRBE : SideEffectBinaryRRE<"rrbe", 0xB22A, GR32, GR64>;
126 // Reset reference bits multiple.
127 let Predicates = [FeatureResetReferenceBitsMultiple], hasSideEffects = 1 in
128 def RRBM : UnaryRRE<"rrbm", 0xB9AE, null_frag, GR64, GR64>;
130 // Insert reference bits multiple.
131 let Predicates = [FeatureInsertReferenceBitsMultiple], hasSideEffects = 1 in
132 def IRBM : UnaryRRE<"irbm", 0xB9AC, null_frag, GR64, GR64>;
134 // Perform frame management function.
135 let hasSideEffects = 1 in
136 def PFMF : SideEffectBinaryMemRRE<"pfmf", 0xB9AF, GR32, GR64>;
139 let hasSideEffects = 1, mayStore = 1, Uses = [R0D], Defs = [R0D, CC] in
140 def TB : SideEffectBinaryRRE<"tb", 0xB22C, GR64, GR64>;
143 let mayLoad = 1, mayStore = 1, Defs = [CC] in {
144 def PGIN : SideEffectBinaryRRE<"pgin", 0xB22E, GR64, GR64>;
145 def PGOUT : SideEffectBinaryRRE<"pgout", 0xB22F, GR64, GR64>;
148 //===----------------------------------------------------------------------===//
149 // Dynamic-Address-Translation Instructions.
150 //===----------------------------------------------------------------------===//
152 // Invalidate page table entry.
153 let hasSideEffects = 1 in
154 defm IPTE : SideEffectQuaternaryRRFaOptOpt<"ipte", 0xB221, GR64, GR32, GR32>;
156 // Invalidate DAT table entry.
157 let hasSideEffects = 1 in
158 defm IDTE : SideEffectQuaternaryRRFbOpt<"idte", 0xB98E, GR64, GR64, GR64>;
160 // Compare and replace DAT table entry.
161 let Predicates = [FeatureEnhancedDAT2], hasSideEffects = 1, Defs = [CC] in
162 defm CRDTE : SideEffectQuaternaryRRFbOpt<"crdte", 0xB98F, GR128, GR128, GR64>;
165 let hasSideEffects = 1 in
166 def PTLB : SideEffectInherentS<"ptlb", 0xB20D, null_frag>;
168 // Compare and swap and purge.
169 let hasSideEffects = 1, Defs = [CC] in {
170 def CSP : CmpSwapRRE<"csp", 0xB250, GR128, GR64>;
171 def CSPG : CmpSwapRRE<"cspg", 0xB98A, GR128, GR64>;
174 // Load page-table-entry address.
175 let hasSideEffects = 1, Defs = [CC] in
176 def LPTEA : TernaryRRFb<"lptea", 0xB9AA, GR64, GR64, GR64>;
178 // Load real address.
179 let hasSideEffects = 1, Defs = [CC] in {
180 defm LRA : LoadAddressRXPair<"lra", 0xB1, 0xE313, null_frag>;
181 def LRAG : LoadAddressRXY<"lrag", 0xE303, null_frag, laaddr20pair>;
184 // Store real address.
185 def STRAG : StoreSSE<"strag", 0xE502>;
187 // Load using real address.
189 def LURA : UnaryRRE<"lura", 0xB24B, null_frag, GR32, GR64>;
190 def LURAG : UnaryRRE<"lurag", 0xB905, null_frag, GR64, GR64>;
193 // Store using real address.
194 let mayStore = 1 in {
195 def STURA : SideEffectBinaryRRE<"stura", 0xB246, GR32, GR64>;
196 def STURG : SideEffectBinaryRRE<"sturg", 0xB925, GR64, GR64>;
200 let hasSideEffects = 1, Defs = [CC] in
201 def TPROT : SideEffectBinarySSE<"tprot", 0xE501>;
203 //===----------------------------------------------------------------------===//
204 // Memory-move Instructions.
205 //===----------------------------------------------------------------------===//
208 let mayLoad = 1, mayStore = 1, Defs = [CC] in
209 def MVCK : MemoryBinarySSd<"mvck", 0xD9, GR64>;
211 // Move to primary / secondary.
212 let mayLoad = 1, mayStore = 1, Defs = [CC] in {
213 def MVCP : MemoryBinarySSd<"mvcp", 0xDA, GR64>;
214 def MVCS : MemoryBinarySSd<"mvcs", 0xDB, GR64>;
217 // Move with source / destination key.
218 let mayLoad = 1, mayStore = 1, Uses = [R0L, R1L] in {
219 def MVCSK : SideEffectBinarySSE<"mvcsk", 0xE50E>;
220 def MVCDK : SideEffectBinarySSE<"mvcdk", 0xE50F>;
223 // Move with optional specifications.
224 let mayLoad = 1, mayStore = 1, Uses = [R0L] in
225 def MVCOS : SideEffectTernarySSF<"mvcos", 0xC80, GR64>;
228 let mayLoad = 1, mayStore = 1, Uses = [R0L], Defs = [CC] in
229 def MVPG : SideEffectBinaryRRE<"mvpg", 0xB254, GR64, GR64>;
231 //===----------------------------------------------------------------------===//
232 // Address-Space Instructions.
233 //===----------------------------------------------------------------------===//
235 // Load address space parameters.
236 let hasSideEffects = 1, Defs = [CC] in
237 def LASP : SideEffectBinarySSE<"lasp", 0xE500>;
240 let hasSideEffects = 1 in
241 def PALB : SideEffectInherentRRE<"palb", 0xB248>;
244 let hasSideEffects = 1 in
245 def PC : SideEffectAddressS<"pc", 0xB218, null_frag>;
248 let hasSideEffects = 1, Defs = [CC] in
249 def PR : SideEffectInherentE<"pr", 0x0101>;
251 // Program transfer (with instance).
252 let hasSideEffects = 1 in {
253 def PT : SideEffectBinaryRRE<"pt", 0xB228, GR32, GR64>;
254 def PTI : SideEffectBinaryRRE<"pti", 0xB99E, GR64, GR64>;
258 let hasSideEffects = 1, Defs = [CC] in
259 def RP : SideEffectAddressS<"rp", 0xB277, null_frag>;
261 // Branch in subspace group.
262 let hasSideEffects = 1 in
263 def BSG : UnaryRRE<"bsg", 0xB258, null_frag, GR64, GR64>;
265 // Branch and set authority.
266 let hasSideEffects = 1 in
267 def BSA : UnaryRRE<"bsa", 0xB25A, null_frag, GR64, GR64>;
271 def TAR : SideEffectBinaryRRE<"tar", 0xB24C, AR32, GR32>;
273 //===----------------------------------------------------------------------===//
274 // Linkage-Stack Instructions.
275 //===----------------------------------------------------------------------===//
278 let hasSideEffects = 1 in
279 def BAKR : SideEffectBinaryRRE<"bakr", 0xB240, GR64, GR64>;
281 // Extract stacked registers.
282 let hasSideEffects = 1 in {
283 def EREG : SideEffectBinaryRRE<"ereg", 0xB249, GR32, GR32>;
284 def EREGG : SideEffectBinaryRRE<"eregg", 0xB90E, GR64, GR64>;
287 // Extract stacked state.
288 let hasSideEffects = 1, Defs = [CC] in
289 def ESTA : UnaryRRE<"esta", 0xB24A, null_frag, GR128, GR32>;
291 // Modify stacked state.
292 let hasSideEffects = 1 in
293 def MSTA : SideEffectUnaryRRE<"msta", 0xB247, GR128, null_frag>;
295 //===----------------------------------------------------------------------===//
296 // Time-Related Instructions.
297 //===----------------------------------------------------------------------===//
299 // Perform timing facility function.
300 let hasSideEffects = 1, mayLoad = 1, Uses = [R0L, R1D], Defs = [CC] in
301 def PTFF : SideEffectInherentE<"ptff", 0x0104>;
304 let hasSideEffects = 1, Defs = [CC] in
305 def SCK : SideEffectUnaryS<"sck", 0xB204, null_frag, 8>;
307 // Set clock programmable field.
308 let hasSideEffects = 1, Uses = [R0L] in
309 def SCKPF : SideEffectInherentE<"sckpf", 0x0107>;
311 // Set clock comparator.
312 let hasSideEffects = 1 in
313 def SCKC : SideEffectUnaryS<"sckc", 0xB206, null_frag, 8>;
316 let hasSideEffects = 1 in
317 def SPT : SideEffectUnaryS<"spt", 0xB208, null_frag, 8>;
319 // Store clock (fast / extended).
320 let hasSideEffects = 1, Defs = [CC] in {
321 def STCK : StoreInherentS<"stck", 0xB205, null_frag, 8>;
322 def STCKF : StoreInherentS<"stckf", 0xB27C, null_frag, 8>;
323 def STCKE : StoreInherentS<"stcke", 0xB278, null_frag, 16>;
326 // Store clock comparator.
327 let hasSideEffects = 1 in
328 def STCKC : StoreInherentS<"stckc", 0xB207, null_frag, 8>;
331 let hasSideEffects = 1 in
332 def STPT : StoreInherentS<"stpt", 0xB209, null_frag, 8>;
334 //===----------------------------------------------------------------------===//
335 // CPU-Related Instructions.
336 //===----------------------------------------------------------------------===//
338 // Store CPU address.
339 let hasSideEffects = 1 in
340 def STAP : StoreInherentS<"stap", 0xB212, null_frag, 2>;
343 let hasSideEffects = 1 in
344 def STIDP : StoreInherentS<"stidp", 0xB202, null_frag, 8>;
346 // Store system information.
347 let hasSideEffects = 1, Uses = [R0L, R1L], Defs = [R0L, CC] in
348 def STSI : StoreInherentS<"stsi", 0xB27D, null_frag, 0>;
350 // Store facility list.
351 let hasSideEffects = 1 in
352 def STFL : StoreInherentS<"stfl", 0xB2B1, null_frag, 4>;
354 // Store facility list extended.
355 let hasSideEffects = 1, Uses = [R0D], Defs = [R0D, CC] in
356 def STFLE : StoreInherentS<"stfle", 0xB2B0, null_frag, 0>;
358 // Extract CPU attribute.
359 let hasSideEffects = 1 in
360 def ECAG : BinaryRSY<"ecag", 0xEB4C, null_frag, GR64>;
363 let hasSideEffects = 1, mayLoad = 1, Defs = [R0D, R1D] in
364 def ECTG : SideEffectTernarySSF<"ectg", 0xC81, GR64>;
366 // Perform topology function.
367 let hasSideEffects = 1 in
368 def PTF : UnaryTiedRRE<"ptf", 0xB9A2, GR64>;
370 // Perform cryptographic key management operation.
371 let Predicates = [FeatureMessageSecurityAssist3],
372 hasSideEffects = 1, Uses = [R0L, R1D] in
373 def PCKMO : SideEffectInherentRRE<"pckmo", 0xB928>;
375 //===----------------------------------------------------------------------===//
376 // Miscellaneous Instructions.
377 //===----------------------------------------------------------------------===//
380 let hasSideEffects = 1, isCall = 1, Defs = [CC] in
381 def SVC : SideEffectUnaryI<"svc", 0x0A, imm32zx8>;
384 let hasSideEffects = 1, isCall = 1 in
385 def MC : SideEffectBinarySI<"mc", 0xAF, imm32zx8>;
388 let hasSideEffects = 1, isCall = 1 in
389 def DIAG : SideEffectTernaryRS<"diag", 0x83, GR32, GR32>;
392 let hasSideEffects = 1, mayLoad = 1 in {
393 def TRACE : SideEffectTernaryRS<"trace", 0x99, GR32, GR32>;
394 def TRACG : SideEffectTernaryRSY<"tracg", 0xEB0F, GR64, GR64>;
398 let hasSideEffects = 1 in {
399 def TRAP2 : SideEffectInherentE<"trap2", 0x01FF>;
400 def TRAP4 : SideEffectAddressS<"trap4", 0xB2FF, null_frag>;
404 let hasSideEffects = 1, Defs = [CC] in
405 def SIGP : SideEffectTernaryRS<"sigp", 0xAE, GR64, GR64>;
408 let hasSideEffects = 1, Uses = [R0D, R1D, R2D, R3D], Defs = [CC] in
409 def SIGA : SideEffectAddressS<"siga", 0xB274, null_frag>;
411 // Start interpretive execution.
412 let hasSideEffects = 1, Defs = [CC] in
413 def SIE : SideEffectUnaryS<"sie", 0xB214, null_frag, 0>;
415 //===----------------------------------------------------------------------===//
416 // CPU-Measurement Facility Instructions (SA23-2260).
417 //===----------------------------------------------------------------------===//
419 // Load program parameter
420 let hasSideEffects = 1 in
421 def LPP : SideEffectUnaryS<"lpp", 0xB280, null_frag, 8>;
423 // Extract coprocessor-group address.
424 let hasSideEffects = 1, Defs = [CC] in
425 def ECPGA : UnaryRRE<"ecpga", 0xB2ED, null_frag, GR32, GR64>;
427 // Extract CPU counter.
428 let hasSideEffects = 1, Defs = [CC] in
429 def ECCTR : UnaryRRE<"ecctr", 0xB2E4, null_frag, GR64, GR64>;
431 // Extract peripheral counter.
432 let hasSideEffects = 1, Defs = [CC] in
433 def EPCTR : UnaryRRE<"epctr", 0xB2E5, null_frag, GR64, GR64>;
435 // Load CPU-counter-set controls.
436 let hasSideEffects = 1, Defs = [CC] in
437 def LCCTL : SideEffectUnaryS<"lcctl", 0xB284, null_frag, 8>;
439 // Load peripheral-counter-set controls.
440 let hasSideEffects = 1, Defs = [CC] in
441 def LPCTL : SideEffectUnaryS<"lpctl", 0xB285, null_frag, 8>;
443 // Load sampling controls.
444 let hasSideEffects = 1, Defs = [CC] in
445 def LSCTL : SideEffectUnaryS<"lsctl", 0xB287, null_frag, 0>;
447 // Query sampling information.
448 let hasSideEffects = 1 in
449 def QSI : StoreInherentS<"qsi", 0xB286, null_frag, 0>;
451 // Query counter information.
452 let hasSideEffects = 1 in
453 def QCTRI : StoreInherentS<"qctri", 0xB28E, null_frag, 0>;
456 let hasSideEffects = 1, Defs = [CC] in
457 def SCCTR : SideEffectBinaryRRE<"scctr", 0xB2E0, GR64, GR64>;
459 // Set peripheral counter.
460 let hasSideEffects = 1, Defs = [CC] in
461 def SPCTR : SideEffectBinaryRRE<"spctr", 0xB2E1, GR64, GR64>;
463 //===----------------------------------------------------------------------===//
464 // I/O Instructions (Principles of Operation, Chapter 14).
465 //===----------------------------------------------------------------------===//
468 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
469 def CSCH : SideEffectInherentS<"csch", 0xB230, null_frag>;
472 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
473 def HSCH : SideEffectInherentS<"hsch", 0xB231, null_frag>;
475 // Modify subchannel.
476 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
477 def MSCH : SideEffectUnaryS<"msch", 0xB232, null_frag, 0>;
479 // Resume subchannel.
480 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
481 def RSCH : SideEffectInherentS<"rsch", 0xB238, null_frag>;
484 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
485 def SSCH : SideEffectUnaryS<"ssch", 0xB233, null_frag, 0>;
488 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
489 def STSCH : StoreInherentS<"stsch", 0xB234, null_frag, 0>;
492 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
493 def TSCH : StoreInherentS<"tsch", 0xB235, null_frag, 0>;
495 // Cancel subchannel.
496 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
497 def XSCH : SideEffectInherentS<"xsch", 0xB276, null_frag>;
499 // Reset channel path.
500 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
501 def RCHP : SideEffectInherentS<"rchp", 0xB23B, null_frag>;
503 // Set channel monitor.
504 let hasSideEffects = 1, mayLoad = 1, Uses = [R1L, R2D] in
505 def SCHM : SideEffectInherentS<"schm", 0xB23C, null_frag>;
507 // Store channel path status.
508 let hasSideEffects = 1 in
509 def STCPS : StoreInherentS<"stcps", 0xB23A, null_frag, 0>;
511 // Store channel report word.
512 let hasSideEffects = 1, Defs = [CC] in
513 def STCRW : StoreInherentS<"stcrw", 0xB239, null_frag, 0>;
515 // Test pending interruption.
516 let hasSideEffects = 1, Defs = [CC] in
517 def TPI : StoreInherentS<"tpi", 0xB236, null_frag, 0>;
519 // Set address limit.
520 let hasSideEffects = 1, Uses = [R1L] in
521 def SAL : SideEffectInherentS<"sal", 0xB237, null_frag>;