1//==- SystemZInstrSystem.td - SystemZ system instructions -*- tblgen-*-----==// 2// 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 6// 7//===----------------------------------------------------------------------===// 8// 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. 13// 14//===----------------------------------------------------------------------===// 15 16//===----------------------------------------------------------------------===// 17// Program-Status Word Instructions. 18//===----------------------------------------------------------------------===// 19 20// Extract PSW. 21let hasSideEffects = 1, Uses = [CC] in 22 def EPSW : InherentDualRRE<"epsw", 0xB98D, GR32>; 23 24// Load PSW (extended). 25let hasSideEffects = 1, Defs = [CC] in { 26 def LPSW : SideEffectUnaryS<"lpsw", 0x8200, null_frag, 8>; 27 def LPSWE : SideEffectUnaryS<"lpswe", 0xB2B2, null_frag, 16>; 28} 29 30// Insert PSW key. 31let Uses = [R2L], Defs = [R2L] in 32 def IPK : SideEffectInherentS<"ipk", 0xB20B, null_frag>; 33 34// Set PSW key from address. 35let hasSideEffects = 1 in 36 def SPKA : SideEffectAddressS<"spka", 0xB20A, null_frag>; 37 38// Set system mask. 39let hasSideEffects = 1 in 40 def SSM : SideEffectUnaryS<"ssm", 0x8000, null_frag, 1>; 41 42// Store then AND/OR system mask. 43let hasSideEffects = 1 in { 44 def STNSM : StoreSI<"stnsm", 0xAC, null_frag, imm32zx8>; 45 def STOSM : StoreSI<"stosm", 0xAD, null_frag, imm32zx8>; 46} 47 48// Insert address space control. 49let hasSideEffects = 1 in 50 def IAC : InherentRRE<"iac", 0xB224, GR32, null_frag>; 51 52// Set address space control (fast). 53let hasSideEffects = 1 in { 54 def SAC : SideEffectAddressS<"sac", 0xB219, null_frag>; 55 def SACF : SideEffectAddressS<"sacf", 0xB279, null_frag>; 56} 57 58//===----------------------------------------------------------------------===// 59// Control Register Instructions. 60//===----------------------------------------------------------------------===// 61 62let hasSideEffects = 1 in { 63 // Load control. 64 def LCTL : LoadMultipleRS<"lctl", 0xB7, CR64>; 65 def LCTLG : LoadMultipleRSY<"lctlg", 0xEB2F, CR64>; 66 67 // Store control. 68 def STCTL : StoreMultipleRS<"stctl", 0xB6, CR64>; 69 def STCTG : StoreMultipleRSY<"stctg", 0xEB25, CR64>; 70} 71 72// Extract primary ASN (and instance). 73let hasSideEffects = 1 in { 74 def EPAR : InherentRRE<"epar", 0xB226, GR32, null_frag>; 75 def EPAIR : InherentRRE<"epair", 0xB99A, GR64, null_frag>; 76} 77 78// Extract secondary ASN (and instance). 79let hasSideEffects = 1 in { 80 def ESAR : InherentRRE<"esar", 0xB227, GR32, null_frag>; 81 def ESAIR : InherentRRE<"esair", 0xB99B, GR64, null_frag>; 82} 83 84// Set secondary ASN (and instance). 85let hasSideEffects = 1 in { 86 def SSAR : SideEffectUnaryRRE<"ssar", 0xB225, GR32, null_frag>; 87 def SSAIR : SideEffectUnaryRRE<"ssair", 0xB99F, GR64, null_frag>; 88} 89 90// Extract and set extended authority. 91let hasSideEffects = 1 in 92 def ESEA : UnaryTiedRRE<"esea", 0xB99D, GR32>; 93 94//===----------------------------------------------------------------------===// 95// Prefix-Register Instructions. 96//===----------------------------------------------------------------------===// 97 98// Set prefix. 99let hasSideEffects = 1 in 100 def SPX : SideEffectUnaryS<"spx", 0xB210, null_frag, 4>; 101 102// Store prefix. 103let hasSideEffects = 1 in 104 def STPX : StoreInherentS<"stpx", 0xB211, null_frag, 4>; 105 106//===----------------------------------------------------------------------===// 107// Storage-Key and Real Memory Instructions. 108//===----------------------------------------------------------------------===// 109 110// Insert storage key extended. 111let hasSideEffects = 1 in 112 def ISKE : BinaryRRE<"iske", 0xB229, null_frag, GR32, GR64>; 113 114// Insert virtual storage key. 115let hasSideEffects = 1 in 116 def IVSK : BinaryRRE<"ivsk", 0xB223, null_frag, GR32, GR64>; 117 118// Set storage key extended. 119let hasSideEffects = 1, Defs = [CC] in 120 defm SSKE : SideEffectTernaryRRFcOpt<"sske", 0xB22B, GR32, GR64>; 121 122// Reset reference bit extended. 123let hasSideEffects = 1, Defs = [CC] in 124 def RRBE : SideEffectBinaryRRE<"rrbe", 0xB22A, GR32, GR64>; 125 126// Reset reference bits multiple. 127let Predicates = [FeatureResetReferenceBitsMultiple], hasSideEffects = 1 in 128 def RRBM : UnaryRRE<"rrbm", 0xB9AE, null_frag, GR64, GR64>; 129 130// Insert reference bits multiple. 131let Predicates = [FeatureInsertReferenceBitsMultiple], hasSideEffects = 1 in 132 def IRBM : UnaryRRE<"irbm", 0xB9AC, null_frag, GR64, GR64>; 133 134// Perform frame management function. 135let hasSideEffects = 1 in 136 def PFMF : SideEffectBinaryMemRRE<"pfmf", 0xB9AF, GR32, GR64>; 137 138// Test block. 139let hasSideEffects = 1, mayStore = 1, Uses = [R0D], Defs = [R0D, CC] in 140 def TB : SideEffectBinaryRRE<"tb", 0xB22C, GR64, GR64>; 141 142// Page in / out. 143let mayLoad = 1, mayStore = 1, Defs = [CC] in { 144 def PGIN : SideEffectBinaryRRE<"pgin", 0xB22E, GR64, GR64>; 145 def PGOUT : SideEffectBinaryRRE<"pgout", 0xB22F, GR64, GR64>; 146} 147 148//===----------------------------------------------------------------------===// 149// Dynamic-Address-Translation Instructions. 150//===----------------------------------------------------------------------===// 151 152// Invalidate page table entry. 153let hasSideEffects = 1 in 154 defm IPTE : SideEffectQuaternaryRRFaOptOpt<"ipte", 0xB221, GR64, GR32, GR32>; 155 156// Invalidate DAT table entry. 157let hasSideEffects = 1 in 158 defm IDTE : SideEffectQuaternaryRRFbOpt<"idte", 0xB98E, GR64, GR64, GR64>; 159 160// Compare and replace DAT table entry. 161let Predicates = [FeatureEnhancedDAT2], hasSideEffects = 1, Defs = [CC] in 162 defm CRDTE : SideEffectQuaternaryRRFbOpt<"crdte", 0xB98F, GR128, GR128, GR64>; 163 164// Purge TLB. 165let hasSideEffects = 1 in 166 def PTLB : SideEffectInherentS<"ptlb", 0xB20D, null_frag>; 167 168// Compare and swap and purge. 169let hasSideEffects = 1, Defs = [CC] in { 170 def CSP : CmpSwapRRE<"csp", 0xB250, GR128, GR64>; 171 def CSPG : CmpSwapRRE<"cspg", 0xB98A, GR128, GR64>; 172} 173 174// Load page-table-entry address. 175let hasSideEffects = 1, Defs = [CC] in 176 def LPTEA : TernaryRRFb<"lptea", 0xB9AA, GR64, GR64, GR64>; 177 178// Load real address. 179let hasSideEffects = 1, Defs = [CC] in { 180 defm LRA : LoadAddressRXPair<"lra", 0xB1, 0xE313, null_frag>; 181 def LRAG : LoadAddressRXY<"lrag", 0xE303, null_frag, laaddr20pair>; 182} 183 184// Store real address. 185def STRAG : StoreSSE<"strag", 0xE502>; 186 187// Load using real address. 188let mayLoad = 1 in { 189 def LURA : UnaryRRE<"lura", 0xB24B, null_frag, GR32, GR64>; 190 def LURAG : UnaryRRE<"lurag", 0xB905, null_frag, GR64, GR64>; 191} 192 193// Store using real address. 194let mayStore = 1 in { 195 def STURA : SideEffectBinaryRRE<"stura", 0xB246, GR32, GR64>; 196 def STURG : SideEffectBinaryRRE<"sturg", 0xB925, GR64, GR64>; 197} 198 199// Test protection. 200let hasSideEffects = 1, Defs = [CC] in 201 def TPROT : SideEffectBinarySSE<"tprot", 0xE501>; 202 203//===----------------------------------------------------------------------===// 204// Memory-move Instructions. 205//===----------------------------------------------------------------------===// 206 207// Move with key. 208let mayLoad = 1, mayStore = 1, Defs = [CC] in 209 def MVCK : MemoryBinarySSd<"mvck", 0xD9, GR64>; 210 211// Move to primary / secondary. 212let mayLoad = 1, mayStore = 1, Defs = [CC] in { 213 def MVCP : MemoryBinarySSd<"mvcp", 0xDA, GR64>; 214 def MVCS : MemoryBinarySSd<"mvcs", 0xDB, GR64>; 215} 216 217// Move with source / destination key. 218let mayLoad = 1, mayStore = 1, Uses = [R0L, R1L] in { 219 def MVCSK : SideEffectBinarySSE<"mvcsk", 0xE50E>; 220 def MVCDK : SideEffectBinarySSE<"mvcdk", 0xE50F>; 221} 222 223// Move with optional specifications. 224let mayLoad = 1, mayStore = 1, Uses = [R0L] in 225 def MVCOS : SideEffectTernarySSF<"mvcos", 0xC80, GR64>; 226 227// Move page. 228let mayLoad = 1, mayStore = 1, Uses = [R0L], Defs = [CC] in 229 def MVPG : SideEffectBinaryRRE<"mvpg", 0xB254, GR64, GR64>; 230 231//===----------------------------------------------------------------------===// 232// Address-Space Instructions. 233//===----------------------------------------------------------------------===// 234 235// Load address space parameters. 236let hasSideEffects = 1, Defs = [CC] in 237 def LASP : SideEffectBinarySSE<"lasp", 0xE500>; 238 239// Purge ALB. 240let hasSideEffects = 1 in 241 def PALB : SideEffectInherentRRE<"palb", 0xB248>; 242 243// Program call. 244let hasSideEffects = 1 in 245 def PC : SideEffectAddressS<"pc", 0xB218, null_frag>; 246 247// Program return. 248let hasSideEffects = 1, Defs = [CC] in 249 def PR : SideEffectInherentE<"pr", 0x0101>; 250 251// Program transfer (with instance). 252let hasSideEffects = 1 in { 253 def PT : SideEffectBinaryRRE<"pt", 0xB228, GR32, GR64>; 254 def PTI : SideEffectBinaryRRE<"pti", 0xB99E, GR64, GR64>; 255} 256 257// Resume program. 258let hasSideEffects = 1, Defs = [CC] in 259 def RP : SideEffectAddressS<"rp", 0xB277, null_frag>; 260 261// Branch in subspace group. 262let hasSideEffects = 1 in 263 def BSG : UnaryRRE<"bsg", 0xB258, null_frag, GR64, GR64>; 264 265// Branch and set authority. 266let hasSideEffects = 1 in 267 def BSA : UnaryRRE<"bsa", 0xB25A, null_frag, GR64, GR64>; 268 269// Test access. 270let Defs = [CC] in 271 def TAR : SideEffectBinaryRRE<"tar", 0xB24C, AR32, GR32>; 272 273//===----------------------------------------------------------------------===// 274// Linkage-Stack Instructions. 275//===----------------------------------------------------------------------===// 276 277// Branch and stack. 278let hasSideEffects = 1 in 279 def BAKR : SideEffectBinaryRRE<"bakr", 0xB240, GR64, GR64>; 280 281// Extract stacked registers. 282let hasSideEffects = 1 in { 283 def EREG : SideEffectBinaryRRE<"ereg", 0xB249, GR32, GR32>; 284 def EREGG : SideEffectBinaryRRE<"eregg", 0xB90E, GR64, GR64>; 285} 286 287// Extract stacked state. 288let hasSideEffects = 1, Defs = [CC] in 289 def ESTA : UnaryRRE<"esta", 0xB24A, null_frag, GR128, GR32>; 290 291// Modify stacked state. 292let hasSideEffects = 1 in 293 def MSTA : SideEffectUnaryRRE<"msta", 0xB247, GR128, null_frag>; 294 295//===----------------------------------------------------------------------===// 296// Time-Related Instructions. 297//===----------------------------------------------------------------------===// 298 299// Perform timing facility function. 300let hasSideEffects = 1, mayLoad = 1, Uses = [R0L, R1D], Defs = [CC] in 301 def PTFF : SideEffectInherentE<"ptff", 0x0104>; 302 303// Set clock. 304let hasSideEffects = 1, Defs = [CC] in 305 def SCK : SideEffectUnaryS<"sck", 0xB204, null_frag, 8>; 306 307// Set clock programmable field. 308let hasSideEffects = 1, Uses = [R0L] in 309 def SCKPF : SideEffectInherentE<"sckpf", 0x0107>; 310 311// Set clock comparator. 312let hasSideEffects = 1 in 313 def SCKC : SideEffectUnaryS<"sckc", 0xB206, null_frag, 8>; 314 315// Set CPU timer. 316let hasSideEffects = 1 in 317 def SPT : SideEffectUnaryS<"spt", 0xB208, null_frag, 8>; 318 319// Store clock (fast / extended). 320let 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>; 324} 325 326// Store clock comparator. 327let hasSideEffects = 1 in 328 def STCKC : StoreInherentS<"stckc", 0xB207, null_frag, 8>; 329 330// Store CPU timer. 331let hasSideEffects = 1 in 332 def STPT : StoreInherentS<"stpt", 0xB209, null_frag, 8>; 333 334//===----------------------------------------------------------------------===// 335// CPU-Related Instructions. 336//===----------------------------------------------------------------------===// 337 338// Store CPU address. 339let hasSideEffects = 1 in 340 def STAP : StoreInherentS<"stap", 0xB212, null_frag, 2>; 341 342// Store CPU ID. 343let hasSideEffects = 1 in 344 def STIDP : StoreInherentS<"stidp", 0xB202, null_frag, 8>; 345 346// Store system information. 347let hasSideEffects = 1, Uses = [R0L, R1L], Defs = [R0L, CC] in 348 def STSI : StoreInherentS<"stsi", 0xB27D, null_frag, 0>; 349 350// Store facility list. 351let hasSideEffects = 1 in 352 def STFL : StoreInherentS<"stfl", 0xB2B1, null_frag, 4>; 353 354// Store facility list extended. 355let hasSideEffects = 1, Uses = [R0D], Defs = [R0D, CC] in 356 def STFLE : StoreInherentS<"stfle", 0xB2B0, null_frag, 0>; 357 358// Extract CPU attribute. 359let hasSideEffects = 1 in 360 def ECAG : BinaryRSY<"ecag", 0xEB4C, null_frag, GR64>; 361 362// Extract CPU time. 363let hasSideEffects = 1, mayLoad = 1, Defs = [R0D, R1D] in 364 def ECTG : SideEffectTernarySSF<"ectg", 0xC81, GR64>; 365 366// Perform topology function. 367let hasSideEffects = 1 in 368 def PTF : UnaryTiedRRE<"ptf", 0xB9A2, GR64>; 369 370// Perform cryptographic key management operation. 371let Predicates = [FeatureMessageSecurityAssist3], 372 hasSideEffects = 1, Uses = [R0L, R1D] in 373 def PCKMO : SideEffectInherentRRE<"pckmo", 0xB928>; 374 375//===----------------------------------------------------------------------===// 376// Miscellaneous Instructions. 377//===----------------------------------------------------------------------===// 378 379// Supervisor call. 380let hasSideEffects = 1, isCall = 1, Defs = [CC] in 381 def SVC : SideEffectUnaryI<"svc", 0x0A, imm32zx8>; 382 383// Monitor call. 384let hasSideEffects = 1, isCall = 1 in 385 def MC : SideEffectBinarySI<"mc", 0xAF, imm32zx8>; 386 387// Diagnose. 388let hasSideEffects = 1, isCall = 1 in 389 def DIAG : SideEffectTernaryRS<"diag", 0x83, GR32, GR32>; 390 391// Trace. 392let hasSideEffects = 1, mayLoad = 1 in { 393 def TRACE : SideEffectTernaryRS<"trace", 0x99, GR32, GR32>; 394 def TRACG : SideEffectTernaryRSY<"tracg", 0xEB0F, GR64, GR64>; 395} 396 397// Trap. 398let hasSideEffects = 1 in { 399 def TRAP2 : SideEffectInherentE<"trap2", 0x01FF>; 400 def TRAP4 : SideEffectAddressS<"trap4", 0xB2FF, null_frag>; 401} 402 403// Signal processor. 404let hasSideEffects = 1, Defs = [CC] in 405 def SIGP : SideEffectTernaryRS<"sigp", 0xAE, GR64, GR64>; 406 407// Signal adapter. 408let hasSideEffects = 1, Uses = [R0D, R1D, R2D, R3D], Defs = [CC] in 409 def SIGA : SideEffectAddressS<"siga", 0xB274, null_frag>; 410 411// Start interpretive execution. 412let hasSideEffects = 1, Defs = [CC] in 413 def SIE : SideEffectUnaryS<"sie", 0xB214, null_frag, 0>; 414 415//===----------------------------------------------------------------------===// 416// CPU-Measurement Facility Instructions (SA23-2260). 417//===----------------------------------------------------------------------===// 418 419// Load program parameter 420let hasSideEffects = 1 in 421 def LPP : SideEffectUnaryS<"lpp", 0xB280, null_frag, 8>; 422 423// Extract coprocessor-group address. 424let hasSideEffects = 1, Defs = [CC] in 425 def ECPGA : UnaryRRE<"ecpga", 0xB2ED, null_frag, GR32, GR64>; 426 427// Extract CPU counter. 428let hasSideEffects = 1, Defs = [CC] in 429 def ECCTR : UnaryRRE<"ecctr", 0xB2E4, null_frag, GR64, GR64>; 430 431// Extract peripheral counter. 432let hasSideEffects = 1, Defs = [CC] in 433 def EPCTR : UnaryRRE<"epctr", 0xB2E5, null_frag, GR64, GR64>; 434 435// Load CPU-counter-set controls. 436let hasSideEffects = 1, Defs = [CC] in 437 def LCCTL : SideEffectUnaryS<"lcctl", 0xB284, null_frag, 8>; 438 439// Load peripheral-counter-set controls. 440let hasSideEffects = 1, Defs = [CC] in 441 def LPCTL : SideEffectUnaryS<"lpctl", 0xB285, null_frag, 8>; 442 443// Load sampling controls. 444let hasSideEffects = 1, Defs = [CC] in 445 def LSCTL : SideEffectUnaryS<"lsctl", 0xB287, null_frag, 0>; 446 447// Query sampling information. 448let hasSideEffects = 1 in 449 def QSI : StoreInherentS<"qsi", 0xB286, null_frag, 0>; 450 451// Query counter information. 452let hasSideEffects = 1 in 453 def QCTRI : StoreInherentS<"qctri", 0xB28E, null_frag, 0>; 454 455// Set CPU counter. 456let hasSideEffects = 1, Defs = [CC] in 457 def SCCTR : SideEffectBinaryRRE<"scctr", 0xB2E0, GR64, GR64>; 458 459// Set peripheral counter. 460let hasSideEffects = 1, Defs = [CC] in 461 def SPCTR : SideEffectBinaryRRE<"spctr", 0xB2E1, GR64, GR64>; 462 463//===----------------------------------------------------------------------===// 464// I/O Instructions (Principles of Operation, Chapter 14). 465//===----------------------------------------------------------------------===// 466 467// Clear subchannel. 468let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in 469 def CSCH : SideEffectInherentS<"csch", 0xB230, null_frag>; 470 471// Halt subchannel. 472let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in 473 def HSCH : SideEffectInherentS<"hsch", 0xB231, null_frag>; 474 475// Modify subchannel. 476let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in 477 def MSCH : SideEffectUnaryS<"msch", 0xB232, null_frag, 0>; 478 479// Resume subchannel. 480let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in 481 def RSCH : SideEffectInherentS<"rsch", 0xB238, null_frag>; 482 483// Start subchannel. 484let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in 485 def SSCH : SideEffectUnaryS<"ssch", 0xB233, null_frag, 0>; 486 487// Store subchannel. 488let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in 489 def STSCH : StoreInherentS<"stsch", 0xB234, null_frag, 0>; 490 491// Test subchannel. 492let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in 493 def TSCH : StoreInherentS<"tsch", 0xB235, null_frag, 0>; 494 495// Cancel subchannel. 496let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in 497 def XSCH : SideEffectInherentS<"xsch", 0xB276, null_frag>; 498 499// Reset channel path. 500let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in 501 def RCHP : SideEffectInherentS<"rchp", 0xB23B, null_frag>; 502 503// Set channel monitor. 504let hasSideEffects = 1, mayLoad = 1, Uses = [R1L, R2D] in 505 def SCHM : SideEffectInherentS<"schm", 0xB23C, null_frag>; 506 507// Store channel path status. 508let hasSideEffects = 1 in 509 def STCPS : StoreInherentS<"stcps", 0xB23A, null_frag, 0>; 510 511// Store channel report word. 512let hasSideEffects = 1, Defs = [CC] in 513 def STCRW : StoreInherentS<"stcrw", 0xB239, null_frag, 0>; 514 515// Test pending interruption. 516let hasSideEffects = 1, Defs = [CC] in 517 def TPI : StoreInherentS<"tpi", 0xB236, null_frag, 0>; 518 519// Set address limit. 520let hasSideEffects = 1, Uses = [R1L] in 521 def SAL : SideEffectInherentS<"sal", 0xB237, null_frag>; 522 523