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>;
29 let Predicates = [FeatureBEAREnhancement], hasSideEffects = 1, Defs = [CC] in
30 def LPSWEY : SideEffectUnarySIY<"lpswey", 0xEB71, 16>;
33 let Uses = [R2L], Defs = [R2L] in
34 def IPK : SideEffectInherentS<"ipk", 0xB20B, null_frag>;
36 // Set PSW key from address.
37 let hasSideEffects = 1 in
38 def SPKA : SideEffectAddressS<"spka", 0xB20A, null_frag>;
41 let hasSideEffects = 1 in
42 def SSM : SideEffectUnaryS<"ssm", 0x8000, null_frag, 1>;
44 // Store then AND/OR system mask.
45 let hasSideEffects = 1 in {
46 def STNSM : StoreSI<"stnsm", 0xAC, null_frag, imm32zx8>;
47 def STOSM : StoreSI<"stosm", 0xAD, null_frag, imm32zx8>;
50 // Insert address space control.
51 let hasSideEffects = 1 in
52 def IAC : InherentRRE<"iac", 0xB224, GR32, null_frag>;
54 // Set address space control (fast).
55 let hasSideEffects = 1 in {
56 def SAC : SideEffectAddressS<"sac", 0xB219, null_frag>;
57 def SACF : SideEffectAddressS<"sacf", 0xB279, null_frag>;
60 //===----------------------------------------------------------------------===//
61 // Control Register Instructions.
62 //===----------------------------------------------------------------------===//
64 let hasSideEffects = 1 in {
66 def LCTL : LoadMultipleRS<"lctl", 0xB7, CR64>;
67 def LCTLG : LoadMultipleRSY<"lctlg", 0xEB2F, CR64>;
70 def STCTL : StoreMultipleRS<"stctl", 0xB6, CR64>;
71 def STCTG : StoreMultipleRSY<"stctg", 0xEB25, CR64>;
74 // Extract primary ASN (and instance).
75 let hasSideEffects = 1 in {
76 def EPAR : InherentRRE<"epar", 0xB226, GR32, null_frag>;
77 def EPAIR : InherentRRE<"epair", 0xB99A, GR64, null_frag>;
80 // Extract secondary ASN (and instance).
81 let hasSideEffects = 1 in {
82 def ESAR : InherentRRE<"esar", 0xB227, GR32, null_frag>;
83 def ESAIR : InherentRRE<"esair", 0xB99B, GR64, null_frag>;
86 // Set secondary ASN (and instance).
87 let hasSideEffects = 1 in {
88 def SSAR : SideEffectUnaryRRE<"ssar", 0xB225, GR32, null_frag>;
89 def SSAIR : SideEffectUnaryRRE<"ssair", 0xB99F, GR64, null_frag>;
92 // Extract and set extended authority.
93 let hasSideEffects = 1 in
94 def ESEA : UnaryTiedRRE<"esea", 0xB99D, GR32>;
96 //===----------------------------------------------------------------------===//
97 // Prefix-Register Instructions.
98 //===----------------------------------------------------------------------===//
101 let hasSideEffects = 1 in
102 def SPX : SideEffectUnaryS<"spx", 0xB210, null_frag, 4>;
105 let hasSideEffects = 1 in
106 def STPX : StoreInherentS<"stpx", 0xB211, null_frag, 4>;
108 //===----------------------------------------------------------------------===//
109 // Breaking-Event-Address-Register Instructions.
110 //===----------------------------------------------------------------------===//
112 let Predicates = [FeatureBEAREnhancement] in {
114 let hasSideEffects = 1 in
115 def LBEAR : SideEffectUnaryS<"lbear", 0xB200, null_frag, 8>;
118 let hasSideEffects = 1 in
119 def STBEAR : StoreInherentS<"stbear", 0xB201, null_frag, 8>;
122 //===----------------------------------------------------------------------===//
123 // Storage-Key and Real Memory Instructions.
124 //===----------------------------------------------------------------------===//
126 // Insert storage key extended.
127 let hasSideEffects = 1 in
128 def ISKE : BinaryRRE<"iske", 0xB229, null_frag, GR32, GR64>;
130 // Insert virtual storage key.
131 let hasSideEffects = 1 in
132 def IVSK : BinaryRRE<"ivsk", 0xB223, null_frag, GR32, GR64>;
134 // Set storage key extended.
135 let hasSideEffects = 1, Defs = [CC] in
136 defm SSKE : SideEffectTernaryRRFcOpt<"sske", 0xB22B, GR32, GR64>;
138 // Reset reference bit extended.
139 let hasSideEffects = 1, Defs = [CC] in
140 def RRBE : SideEffectBinaryRRE<"rrbe", 0xB22A, GR32, GR64>;
142 // Reset reference bits multiple.
143 let Predicates = [FeatureResetReferenceBitsMultiple], hasSideEffects = 1 in
144 def RRBM : UnaryRRE<"rrbm", 0xB9AE, null_frag, GR64, GR64>;
146 // Insert reference bits multiple.
147 let Predicates = [FeatureInsertReferenceBitsMultiple], hasSideEffects = 1 in
148 def IRBM : UnaryRRE<"irbm", 0xB9AC, null_frag, GR64, GR64>;
150 // Perform frame management function.
151 let hasSideEffects = 1 in
152 def PFMF : SideEffectBinaryMemRRE<"pfmf", 0xB9AF, GR32, GR64>;
155 let hasSideEffects = 1, mayStore = 1, Uses = [R0D], Defs = [R0D, CC] in
156 def TB : SideEffectBinaryRRE<"tb", 0xB22C, GR64, GR64>;
159 let mayLoad = 1, mayStore = 1, Defs = [CC] in {
160 def PGIN : SideEffectBinaryRRE<"pgin", 0xB22E, GR64, GR64>;
161 def PGOUT : SideEffectBinaryRRE<"pgout", 0xB22F, GR64, GR64>;
164 //===----------------------------------------------------------------------===//
165 // Dynamic-Address-Translation Instructions.
166 //===----------------------------------------------------------------------===//
168 // Invalidate page table entry.
169 let hasSideEffects = 1 in
170 defm IPTE : SideEffectQuaternaryRRFaOptOpt<"ipte", 0xB221, GR64, GR32, GR32>;
172 // Invalidate DAT table entry.
173 let hasSideEffects = 1 in
174 defm IDTE : SideEffectQuaternaryRRFbOpt<"idte", 0xB98E, GR64, GR64, GR64>;
176 // Reset DAT protection.
177 let Predicates = [FeatureResetDATProtection], hasSideEffects = 1 in
178 defm RDP : SideEffectQuaternaryRRFbOpt<"rdp", 0xB98B, GR64, GR64, GR64>;
180 // Compare and replace DAT table entry.
181 let Predicates = [FeatureEnhancedDAT2], hasSideEffects = 1, Defs = [CC] in
182 defm CRDTE : SideEffectQuaternaryRRFbOpt<"crdte", 0xB98F, GR128, GR128, GR64>;
185 let hasSideEffects = 1 in
186 def PTLB : SideEffectInherentS<"ptlb", 0xB20D, null_frag>;
188 // Compare and swap and purge.
189 let hasSideEffects = 1, Defs = [CC] in {
190 def CSP : CmpSwapRRE<"csp", 0xB250, GR128, GR64>;
191 def CSPG : CmpSwapRRE<"cspg", 0xB98A, GR128, GR64>;
194 // Load page-table-entry address.
195 let hasSideEffects = 1, Defs = [CC] in
196 def LPTEA : TernaryRRFb<"lptea", 0xB9AA, GR64, GR64, GR64>;
198 // Load real address.
199 let hasSideEffects = 1, Defs = [CC] in {
200 defm LRA : LoadAddressRXPair<"lra", 0xB1, 0xE313, null_frag>;
201 def LRAG : LoadAddressRXY<"lrag", 0xE303, null_frag, laaddr20pair>;
204 // Store real address.
205 def STRAG : StoreSSE<"strag", 0xE502>;
207 // Load using real address.
209 def LURA : UnaryRRE<"lura", 0xB24B, null_frag, GR32, GR64>;
210 def LURAG : UnaryRRE<"lurag", 0xB905, null_frag, GR64, GR64>;
213 // Store using real address.
214 let mayStore = 1 in {
215 def STURA : SideEffectBinaryRRE<"stura", 0xB246, GR32, GR64>;
216 def STURG : SideEffectBinaryRRE<"sturg", 0xB925, GR64, GR64>;
220 let hasSideEffects = 1, Defs = [CC] in
221 def TPROT : SideEffectBinarySSE<"tprot", 0xE501>;
223 //===----------------------------------------------------------------------===//
224 // Memory-move Instructions.
225 //===----------------------------------------------------------------------===//
228 let mayLoad = 1, mayStore = 1, Defs = [CC] in
229 def MVCK : MemoryBinarySSd<"mvck", 0xD9, GR64>;
231 // Move to primary / secondary.
232 let mayLoad = 1, mayStore = 1, Defs = [CC] in {
233 def MVCP : MemoryBinarySSd<"mvcp", 0xDA, GR64>;
234 def MVCS : MemoryBinarySSd<"mvcs", 0xDB, GR64>;
237 // Move with source / destination key.
238 let mayLoad = 1, mayStore = 1, Uses = [R0L, R1L] in {
239 def MVCSK : SideEffectBinarySSE<"mvcsk", 0xE50E>;
240 def MVCDK : SideEffectBinarySSE<"mvcdk", 0xE50F>;
243 // Move with optional specifications.
244 let mayLoad = 1, mayStore = 1, Uses = [R0L] in
245 def MVCOS : SideEffectTernarySSF<"mvcos", 0xC80, GR64>;
248 let mayLoad = 1, mayStore = 1, Uses = [R0L], Defs = [CC] in
249 def MVPG : SideEffectBinaryRRE<"mvpg", 0xB254, GR64, GR64>;
251 //===----------------------------------------------------------------------===//
252 // Address-Space Instructions.
253 //===----------------------------------------------------------------------===//
255 // Load address space parameters.
256 let hasSideEffects = 1, Defs = [CC] in
257 def LASP : SideEffectBinarySSE<"lasp", 0xE500>;
260 let hasSideEffects = 1 in
261 def PALB : SideEffectInherentRRE<"palb", 0xB248>;
264 let hasSideEffects = 1 in
265 def PC : SideEffectAddressS<"pc", 0xB218, null_frag>;
268 let hasSideEffects = 1, Defs = [CC] in
269 def PR : SideEffectInherentE<"pr", 0x0101>;
271 // Program transfer (with instance).
272 let hasSideEffects = 1 in {
273 def PT : SideEffectBinaryRRE<"pt", 0xB228, GR32, GR64>;
274 def PTI : SideEffectBinaryRRE<"pti", 0xB99E, GR64, GR64>;
278 let hasSideEffects = 1, Defs = [CC] in
279 def RP : SideEffectAddressS<"rp", 0xB277, null_frag>;
281 // Branch in subspace group.
282 let hasSideEffects = 1 in
283 def BSG : UnaryRRE<"bsg", 0xB258, null_frag, GR64, GR64>;
285 // Branch and set authority.
286 let hasSideEffects = 1 in
287 def BSA : UnaryRRE<"bsa", 0xB25A, null_frag, GR64, GR64>;
291 def TAR : SideEffectBinaryRRE<"tar", 0xB24C, AR32, GR32>;
293 //===----------------------------------------------------------------------===//
294 // Linkage-Stack Instructions.
295 //===----------------------------------------------------------------------===//
298 let hasSideEffects = 1 in
299 def BAKR : SideEffectBinaryRRE<"bakr", 0xB240, GR64, GR64>;
301 // Extract stacked registers.
302 let hasSideEffects = 1 in {
303 def EREG : SideEffectBinaryRRE<"ereg", 0xB249, GR32, GR32>;
304 def EREGG : SideEffectBinaryRRE<"eregg", 0xB90E, GR64, GR64>;
307 // Extract stacked state.
308 let hasSideEffects = 1, Defs = [CC] in
309 def ESTA : UnaryRRE<"esta", 0xB24A, null_frag, GR128, GR32>;
311 // Modify stacked state.
312 let hasSideEffects = 1 in
313 def MSTA : SideEffectUnaryRRE<"msta", 0xB247, GR128, null_frag>;
315 //===----------------------------------------------------------------------===//
316 // Time-Related Instructions.
317 //===----------------------------------------------------------------------===//
319 // Perform timing facility function.
320 let hasSideEffects = 1, mayLoad = 1, Uses = [R0L, R1D], Defs = [CC] in
321 def PTFF : SideEffectInherentE<"ptff", 0x0104>;
324 let hasSideEffects = 1, Defs = [CC] in
325 def SCK : SideEffectUnaryS<"sck", 0xB204, null_frag, 8>;
327 // Set clock programmable field.
328 let hasSideEffects = 1, Uses = [R0L] in
329 def SCKPF : SideEffectInherentE<"sckpf", 0x0107>;
331 // Set clock comparator.
332 let hasSideEffects = 1 in
333 def SCKC : SideEffectUnaryS<"sckc", 0xB206, null_frag, 8>;
336 let hasSideEffects = 1 in
337 def SPT : SideEffectUnaryS<"spt", 0xB208, null_frag, 8>;
339 // Store clock (fast / extended).
340 let hasSideEffects = 1, Defs = [CC] in {
341 def STCK : StoreInherentS<"stck", 0xB205, null_frag, 8>;
342 def STCKF : StoreInherentS<"stckf", 0xB27C, z_stckf, 8>;
343 def STCKE : StoreInherentS<"stcke", 0xB278, null_frag, 16>;
346 // Store clock comparator.
347 let hasSideEffects = 1 in
348 def STCKC : StoreInherentS<"stckc", 0xB207, null_frag, 8>;
351 let hasSideEffects = 1 in
352 def STPT : StoreInherentS<"stpt", 0xB209, null_frag, 8>;
354 //===----------------------------------------------------------------------===//
355 // CPU-Related Instructions.
356 //===----------------------------------------------------------------------===//
358 // Store CPU address.
359 let hasSideEffects = 1 in
360 def STAP : StoreInherentS<"stap", 0xB212, null_frag, 2>;
363 let hasSideEffects = 1 in
364 def STIDP : StoreInherentS<"stidp", 0xB202, null_frag, 8>;
366 // Store system information.
367 let hasSideEffects = 1, Uses = [R0L, R1L], Defs = [R0L, CC] in
368 def STSI : StoreInherentS<"stsi", 0xB27D, null_frag, 0>;
370 // Store facility list.
371 let hasSideEffects = 1 in
372 def STFL : StoreInherentS<"stfl", 0xB2B1, null_frag, 4>;
374 // Store facility list extended.
375 let hasSideEffects = 1, Uses = [R0D], Defs = [R0D, CC] in
376 def STFLE : StoreInherentS<"stfle", 0xB2B0, null_frag, 0>;
378 // Extract CPU attribute.
379 let hasSideEffects = 1 in
380 def ECAG : BinaryRSY<"ecag", 0xEB4C, null_frag, GR64>;
383 let hasSideEffects = 1, mayLoad = 1, Defs = [R0D, R1D] in
384 def ECTG : SideEffectTernarySSF<"ectg", 0xC81, GR64>;
386 // Perform topology function.
387 let hasSideEffects = 1 in
388 def PTF : UnaryTiedRRE<"ptf", 0xB9A2, GR64>;
390 // Perform cryptographic key management operation.
391 let Predicates = [FeatureMessageSecurityAssist3],
392 hasSideEffects = 1, Uses = [R0L, R1D] in
393 def PCKMO : SideEffectInherentRRE<"pckmo", 0xB928>;
395 // Query processor activity counter information.
396 let Predicates = [FeatureProcessorActivityInstrumentation],
397 hasSideEffects = 1, Uses = [R0D], Defs = [R0D, CC] in
398 def QPACI : StoreInherentS<"qpaci", 0xB28F, null_frag, 0>;
400 //===----------------------------------------------------------------------===//
401 // Miscellaneous Instructions.
402 //===----------------------------------------------------------------------===//
405 let hasSideEffects = 1, isCall = 1, Defs = [CC] in
406 def SVC : SideEffectUnaryI<"svc", 0x0A, imm32zx8>;
409 let hasSideEffects = 1, isCall = 1 in
410 def MC : SideEffectBinarySI<"mc", 0xAF, imm32zx8>;
413 let hasSideEffects = 1, isCall = 1 in
414 def DIAG : SideEffectTernaryRS<"diag", 0x83, GR32, GR32>;
417 let hasSideEffects = 1, mayLoad = 1 in {
418 def TRACE : SideEffectTernaryRS<"trace", 0x99, GR32, GR32>;
419 def TRACG : SideEffectTernaryRSY<"tracg", 0xEB0F, GR64, GR64>;
423 let hasSideEffects = 1 in {
424 def TRAP2 : SideEffectInherentE<"trap2", 0x01FF>;
425 def TRAP4 : SideEffectAddressS<"trap4", 0xB2FF, null_frag>;
429 let hasSideEffects = 1, Defs = [CC] in
430 def SIGP : SideEffectTernaryRS<"sigp", 0xAE, GR64, GR64>;
433 let hasSideEffects = 1, Uses = [R0D, R1D, R2D, R3D], Defs = [CC] in
434 def SIGA : SideEffectAddressS<"siga", 0xB274, null_frag>;
436 // Start interpretive execution.
437 let hasSideEffects = 1, Defs = [CC] in
438 def SIE : SideEffectUnaryS<"sie", 0xB214, null_frag, 0>;
440 //===----------------------------------------------------------------------===//
441 // CPU-Measurement Facility Instructions (SA23-2260).
442 //===----------------------------------------------------------------------===//
444 // Load program parameter
445 let hasSideEffects = 1 in
446 def LPP : SideEffectUnaryS<"lpp", 0xB280, null_frag, 8>;
448 // Extract coprocessor-group address.
449 let hasSideEffects = 1, Defs = [CC] in
450 def ECPGA : UnaryRRE<"ecpga", 0xB2ED, null_frag, GR32, GR64>;
452 // Extract CPU counter.
453 let hasSideEffects = 1, Defs = [CC] in
454 def ECCTR : UnaryRRE<"ecctr", 0xB2E4, null_frag, GR64, GR64>;
456 // Extract peripheral counter.
457 let hasSideEffects = 1, Defs = [CC] in
458 def EPCTR : UnaryRRE<"epctr", 0xB2E5, null_frag, GR64, GR64>;
460 // Load CPU-counter-set controls.
461 let hasSideEffects = 1, Defs = [CC] in
462 def LCCTL : SideEffectUnaryS<"lcctl", 0xB284, null_frag, 8>;
464 // Load peripheral-counter-set controls.
465 let hasSideEffects = 1, Defs = [CC] in
466 def LPCTL : SideEffectUnaryS<"lpctl", 0xB285, null_frag, 8>;
468 // Load sampling controls.
469 let hasSideEffects = 1, Defs = [CC] in
470 def LSCTL : SideEffectUnaryS<"lsctl", 0xB287, null_frag, 0>;
472 // Query sampling information.
473 let hasSideEffects = 1 in
474 def QSI : StoreInherentS<"qsi", 0xB286, null_frag, 0>;
476 // Query counter information.
477 let hasSideEffects = 1 in
478 def QCTRI : StoreInherentS<"qctri", 0xB28E, null_frag, 0>;
481 let hasSideEffects = 1, Defs = [CC] in
482 def SCCTR : SideEffectBinaryRRE<"scctr", 0xB2E0, GR64, GR64>;
484 // Set peripheral counter.
485 let hasSideEffects = 1, Defs = [CC] in
486 def SPCTR : SideEffectBinaryRRE<"spctr", 0xB2E1, GR64, GR64>;
488 //===----------------------------------------------------------------------===//
489 // I/O Instructions (Principles of Operation, Chapter 14).
490 //===----------------------------------------------------------------------===//
493 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
494 def CSCH : SideEffectInherentS<"csch", 0xB230, null_frag>;
497 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
498 def HSCH : SideEffectInherentS<"hsch", 0xB231, null_frag>;
500 // Modify subchannel.
501 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
502 def MSCH : SideEffectUnaryS<"msch", 0xB232, null_frag, 0>;
504 // Resume subchannel.
505 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
506 def RSCH : SideEffectInherentS<"rsch", 0xB238, null_frag>;
509 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
510 def SSCH : SideEffectUnaryS<"ssch", 0xB233, null_frag, 0>;
513 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
514 def STSCH : StoreInherentS<"stsch", 0xB234, null_frag, 0>;
517 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
518 def TSCH : StoreInherentS<"tsch", 0xB235, null_frag, 0>;
520 // Cancel subchannel.
521 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
522 def XSCH : SideEffectInherentS<"xsch", 0xB276, null_frag>;
524 // Reset channel path.
525 let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
526 def RCHP : SideEffectInherentS<"rchp", 0xB23B, null_frag>;
528 // Set channel monitor.
529 let hasSideEffects = 1, mayLoad = 1, Uses = [R1L, R2D] in
530 def SCHM : SideEffectInherentS<"schm", 0xB23C, null_frag>;
532 // Store channel path status.
533 let hasSideEffects = 1 in
534 def STCPS : StoreInherentS<"stcps", 0xB23A, null_frag, 0>;
536 // Store channel report word.
537 let hasSideEffects = 1, Defs = [CC] in
538 def STCRW : StoreInherentS<"stcrw", 0xB239, null_frag, 0>;
540 // Test pending interruption.
541 let hasSideEffects = 1, Defs = [CC] in
542 def TPI : StoreInherentS<"tpi", 0xB236, null_frag, 0>;
544 // Test pending external interruption.
545 let hasSideEffects = 1, Defs = [CC], Predicates = [FeatureTestPendingExternalInterruption] in
546 def TPEI : UnaryRRE<"tpei", 0xB9A1, null_frag, GR64, GR64>;
548 // Set address limit.
549 let hasSideEffects = 1, Uses = [R1L] in
550 def SAL : SideEffectInherentS<"sal", 0xB237, null_frag>;