SystemZInstrSystem.td 17.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522
//==- SystemZInstrSystem.td - SystemZ system instructions -*- tblgen-*-----==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// The instructions in this file implement SystemZ system-level instructions.
// Most of these instructions are privileged or semi-privileged.  They are
// not used for code generation, but are provided for use with the assembler
// and disassembler only.
//
//===----------------------------------------------------------------------===//

//===----------------------------------------------------------------------===//
// Program-Status Word Instructions.
//===----------------------------------------------------------------------===//

// Extract PSW.
let hasSideEffects = 1, Uses = [CC] in
  def EPSW : InherentDualRRE<"epsw", 0xB98D, GR32>;

// Load PSW (extended).
let hasSideEffects = 1, Defs = [CC] in {
  def LPSW : SideEffectUnaryS<"lpsw", 0x8200, null_frag, 8>;
  def LPSWE : SideEffectUnaryS<"lpswe", 0xB2B2, null_frag, 16>;
}

// Insert PSW key.
let Uses = [R2L], Defs = [R2L] in
  def IPK : SideEffectInherentS<"ipk", 0xB20B, null_frag>;

// Set PSW key from address.
let hasSideEffects = 1 in
  def SPKA : SideEffectAddressS<"spka", 0xB20A, null_frag>;

// Set system mask.
let hasSideEffects = 1 in
  def SSM : SideEffectUnaryS<"ssm", 0x8000, null_frag, 1>;

// Store then AND/OR system mask.
let hasSideEffects = 1 in {
  def STNSM : StoreSI<"stnsm", 0xAC, null_frag, imm32zx8>;
  def STOSM : StoreSI<"stosm", 0xAD, null_frag, imm32zx8>;
}

// Insert address space control.
let hasSideEffects = 1 in
  def IAC : InherentRRE<"iac", 0xB224, GR32, null_frag>;

// Set address space control (fast).
let hasSideEffects = 1 in {
  def SAC : SideEffectAddressS<"sac", 0xB219, null_frag>;
  def SACF : SideEffectAddressS<"sacf", 0xB279, null_frag>;
}

//===----------------------------------------------------------------------===//
// Control Register Instructions.
//===----------------------------------------------------------------------===//

let hasSideEffects = 1 in {
  // Load control.
  def LCTL : LoadMultipleRS<"lctl", 0xB7, CR64>;
  def LCTLG : LoadMultipleRSY<"lctlg", 0xEB2F, CR64>;

  // Store control.
  def STCTL : StoreMultipleRS<"stctl", 0xB6, CR64>;
  def STCTG : StoreMultipleRSY<"stctg", 0xEB25, CR64>;
}

// Extract primary ASN (and instance).
let hasSideEffects = 1 in {
  def EPAR : InherentRRE<"epar", 0xB226, GR32, null_frag>;
  def EPAIR : InherentRRE<"epair", 0xB99A, GR64, null_frag>;
}

// Extract secondary ASN (and instance).
let hasSideEffects = 1 in {
  def ESAR : InherentRRE<"esar", 0xB227, GR32, null_frag>;
  def ESAIR : InherentRRE<"esair", 0xB99B, GR64, null_frag>;
}

// Set secondary ASN (and instance).
let hasSideEffects = 1 in {
  def SSAR : SideEffectUnaryRRE<"ssar", 0xB225, GR32, null_frag>;
  def SSAIR : SideEffectUnaryRRE<"ssair", 0xB99F, GR64, null_frag>;
}

// Extract and set extended authority.
let hasSideEffects = 1 in
  def ESEA : UnaryTiedRRE<"esea", 0xB99D, GR32>;

//===----------------------------------------------------------------------===//
// Prefix-Register Instructions.
//===----------------------------------------------------------------------===//

// Set prefix.
let hasSideEffects = 1 in
  def SPX : SideEffectUnaryS<"spx", 0xB210, null_frag, 4>;

// Store prefix.
let hasSideEffects = 1 in
  def STPX : StoreInherentS<"stpx", 0xB211, null_frag, 4>;

//===----------------------------------------------------------------------===//
// Storage-Key and Real Memory Instructions.
//===----------------------------------------------------------------------===//

// Insert storage key extended.
let hasSideEffects = 1 in
  def ISKE : BinaryRRE<"iske", 0xB229, null_frag, GR32, GR64>;

// Insert virtual storage key.
let hasSideEffects = 1 in
  def IVSK : BinaryRRE<"ivsk", 0xB223, null_frag, GR32, GR64>;

// Set storage key extended.
let hasSideEffects = 1, Defs = [CC] in
  defm SSKE : SideEffectTernaryRRFcOpt<"sske", 0xB22B, GR32, GR64>;

// Reset reference bit extended.
let hasSideEffects = 1, Defs = [CC] in
  def RRBE : SideEffectBinaryRRE<"rrbe", 0xB22A, GR32, GR64>;

// Reset reference bits multiple.
let Predicates = [FeatureResetReferenceBitsMultiple], hasSideEffects = 1 in
  def RRBM : UnaryRRE<"rrbm", 0xB9AE, null_frag, GR64, GR64>;

// Insert reference bits multiple.
let Predicates = [FeatureInsertReferenceBitsMultiple], hasSideEffects = 1 in
  def IRBM : UnaryRRE<"irbm", 0xB9AC, null_frag, GR64, GR64>;

// Perform frame management function.
let hasSideEffects = 1 in
  def PFMF : SideEffectBinaryMemRRE<"pfmf", 0xB9AF, GR32, GR64>;

// Test block.
let hasSideEffects = 1, mayStore = 1, Uses = [R0D], Defs = [R0D, CC] in
  def TB : SideEffectBinaryRRE<"tb", 0xB22C, GR64, GR64>;

// Page in / out.
let mayLoad = 1, mayStore = 1, Defs = [CC] in {
  def PGIN : SideEffectBinaryRRE<"pgin", 0xB22E, GR64, GR64>;
  def PGOUT : SideEffectBinaryRRE<"pgout", 0xB22F, GR64, GR64>;
}

//===----------------------------------------------------------------------===//
// Dynamic-Address-Translation Instructions.
//===----------------------------------------------------------------------===//

// Invalidate page table entry.
let hasSideEffects = 1 in
  defm IPTE : SideEffectQuaternaryRRFaOptOpt<"ipte", 0xB221, GR64, GR32, GR32>;

// Invalidate DAT table entry.
let hasSideEffects = 1 in
  defm IDTE : SideEffectQuaternaryRRFbOpt<"idte", 0xB98E, GR64, GR64, GR64>;

// Compare and replace DAT table entry.
let Predicates = [FeatureEnhancedDAT2], hasSideEffects = 1, Defs = [CC] in
  defm CRDTE : SideEffectQuaternaryRRFbOpt<"crdte", 0xB98F, GR128, GR128, GR64>;

// Purge TLB.
let hasSideEffects = 1 in
  def PTLB : SideEffectInherentS<"ptlb", 0xB20D, null_frag>;

// Compare and swap and purge.
let hasSideEffects = 1, Defs = [CC] in {
  def CSP : CmpSwapRRE<"csp", 0xB250, GR128, GR64>;
  def CSPG : CmpSwapRRE<"cspg", 0xB98A, GR128, GR64>;
}

// Load page-table-entry address.
let hasSideEffects = 1, Defs = [CC] in
  def LPTEA : TernaryRRFb<"lptea", 0xB9AA, GR64, GR64, GR64>;

// Load real address.
let hasSideEffects = 1, Defs = [CC] in {
  defm LRA : LoadAddressRXPair<"lra", 0xB1, 0xE313, null_frag>;
  def LRAG : LoadAddressRXY<"lrag", 0xE303, null_frag, laaddr20pair>;
}

// Store real address.
def STRAG : StoreSSE<"strag", 0xE502>;

// Load using real address.
let mayLoad = 1 in {
 def LURA : UnaryRRE<"lura", 0xB24B, null_frag, GR32, GR64>;
 def LURAG : UnaryRRE<"lurag", 0xB905, null_frag, GR64, GR64>;
}

// Store using real address.
let mayStore = 1 in {
 def STURA : SideEffectBinaryRRE<"stura", 0xB246, GR32, GR64>;
 def STURG : SideEffectBinaryRRE<"sturg", 0xB925, GR64, GR64>;
}

// Test protection.
let hasSideEffects = 1, Defs = [CC] in
  def TPROT : SideEffectBinarySSE<"tprot", 0xE501>;

//===----------------------------------------------------------------------===//
// Memory-move Instructions.
//===----------------------------------------------------------------------===//

// Move with key.
let mayLoad = 1, mayStore = 1, Defs = [CC] in
  def MVCK : MemoryBinarySSd<"mvck", 0xD9, GR64>;

// Move to primary / secondary.
let mayLoad = 1, mayStore = 1, Defs = [CC] in {
  def MVCP : MemoryBinarySSd<"mvcp", 0xDA, GR64>;
  def MVCS : MemoryBinarySSd<"mvcs", 0xDB, GR64>;
}

// Move with source / destination key.
let mayLoad = 1, mayStore = 1, Uses = [R0L, R1L] in {
  def MVCSK : SideEffectBinarySSE<"mvcsk", 0xE50E>;
  def MVCDK : SideEffectBinarySSE<"mvcdk", 0xE50F>;
}

// Move with optional specifications.
let mayLoad = 1, mayStore = 1, Uses = [R0L] in
  def MVCOS : SideEffectTernarySSF<"mvcos", 0xC80, GR64>;

// Move page.
let mayLoad = 1, mayStore = 1, Uses = [R0L], Defs = [CC] in
  def MVPG : SideEffectBinaryRRE<"mvpg", 0xB254, GR64, GR64>;

//===----------------------------------------------------------------------===//
// Address-Space Instructions.
//===----------------------------------------------------------------------===//

// Load address space parameters.
let hasSideEffects = 1, Defs = [CC] in
  def LASP : SideEffectBinarySSE<"lasp", 0xE500>;

// Purge ALB.
let hasSideEffects = 1 in
  def PALB : SideEffectInherentRRE<"palb", 0xB248>;

// Program call.
let hasSideEffects = 1 in
  def PC : SideEffectAddressS<"pc", 0xB218, null_frag>;

// Program return.
let hasSideEffects = 1, Defs = [CC] in
  def PR : SideEffectInherentE<"pr", 0x0101>;

// Program transfer (with instance).
let hasSideEffects = 1 in {
  def PT : SideEffectBinaryRRE<"pt", 0xB228, GR32, GR64>;
  def PTI : SideEffectBinaryRRE<"pti", 0xB99E, GR64, GR64>;
}

// Resume program.
let hasSideEffects = 1, Defs = [CC] in
  def RP : SideEffectAddressS<"rp", 0xB277, null_frag>;

// Branch in subspace group.
let hasSideEffects = 1 in
  def BSG : UnaryRRE<"bsg", 0xB258, null_frag, GR64, GR64>;

// Branch and set authority.
let hasSideEffects = 1 in
  def BSA : UnaryRRE<"bsa", 0xB25A, null_frag, GR64, GR64>;

// Test access.
let Defs = [CC] in
  def TAR : SideEffectBinaryRRE<"tar", 0xB24C, AR32, GR32>;

//===----------------------------------------------------------------------===//
// Linkage-Stack Instructions.
//===----------------------------------------------------------------------===//

// Branch and stack.
let hasSideEffects = 1 in
  def BAKR : SideEffectBinaryRRE<"bakr", 0xB240, GR64, GR64>;

// Extract stacked registers.
let hasSideEffects = 1 in {
  def EREG : SideEffectBinaryRRE<"ereg", 0xB249, GR32, GR32>;
  def EREGG : SideEffectBinaryRRE<"eregg", 0xB90E, GR64, GR64>;
}

// Extract stacked state.
let hasSideEffects = 1, Defs = [CC] in
  def ESTA : UnaryRRE<"esta", 0xB24A, null_frag, GR128, GR32>;

// Modify stacked state.
let hasSideEffects = 1 in
  def MSTA : SideEffectUnaryRRE<"msta", 0xB247, GR128, null_frag>;

//===----------------------------------------------------------------------===//
// Time-Related Instructions.
//===----------------------------------------------------------------------===//

// Perform timing facility function.
let hasSideEffects = 1, mayLoad = 1, Uses = [R0L, R1D], Defs = [CC] in
  def PTFF : SideEffectInherentE<"ptff", 0x0104>;

// Set clock.
let hasSideEffects = 1, Defs = [CC] in
  def SCK : SideEffectUnaryS<"sck", 0xB204, null_frag, 8>;

// Set clock programmable field.
let hasSideEffects = 1, Uses = [R0L] in
  def SCKPF : SideEffectInherentE<"sckpf", 0x0107>;

// Set clock comparator.
let hasSideEffects = 1 in
  def SCKC : SideEffectUnaryS<"sckc", 0xB206, null_frag, 8>;

// Set CPU timer.
let hasSideEffects = 1 in
  def SPT : SideEffectUnaryS<"spt", 0xB208, null_frag, 8>;

// Store clock (fast / extended).
let hasSideEffects = 1, Defs = [CC] in {
  def STCK  : StoreInherentS<"stck",  0xB205, null_frag, 8>;
  def STCKF : StoreInherentS<"stckf", 0xB27C, null_frag, 8>;
  def STCKE : StoreInherentS<"stcke", 0xB278, null_frag, 16>;
}

// Store clock comparator.
let hasSideEffects = 1 in
  def STCKC : StoreInherentS<"stckc", 0xB207, null_frag, 8>;

// Store CPU timer.
let hasSideEffects = 1 in
  def STPT : StoreInherentS<"stpt", 0xB209, null_frag, 8>;

//===----------------------------------------------------------------------===//
// CPU-Related Instructions.
//===----------------------------------------------------------------------===//

// Store CPU address.
let hasSideEffects = 1 in
  def STAP : StoreInherentS<"stap", 0xB212, null_frag, 2>;

// Store CPU ID.
let hasSideEffects = 1 in
  def STIDP : StoreInherentS<"stidp", 0xB202, null_frag, 8>;

// Store system information.
let hasSideEffects = 1, Uses = [R0L, R1L], Defs = [R0L, CC] in
  def STSI : StoreInherentS<"stsi", 0xB27D, null_frag, 0>;

// Store facility list.
let hasSideEffects = 1 in
  def STFL : StoreInherentS<"stfl", 0xB2B1, null_frag, 4>;

// Store facility list extended.
let hasSideEffects = 1, Uses = [R0D], Defs = [R0D, CC] in
  def STFLE : StoreInherentS<"stfle", 0xB2B0, null_frag, 0>;

// Extract CPU attribute.
let hasSideEffects = 1 in
  def ECAG : BinaryRSY<"ecag", 0xEB4C, null_frag, GR64>;

// Extract CPU time.
let hasSideEffects = 1, mayLoad = 1, Defs = [R0D, R1D] in
  def ECTG : SideEffectTernarySSF<"ectg", 0xC81, GR64>;

// Perform topology function.
let hasSideEffects = 1 in
  def PTF : UnaryTiedRRE<"ptf", 0xB9A2, GR64>;

// Perform cryptographic key management operation.
let Predicates = [FeatureMessageSecurityAssist3],
    hasSideEffects = 1, Uses = [R0L, R1D] in
  def PCKMO : SideEffectInherentRRE<"pckmo", 0xB928>;

//===----------------------------------------------------------------------===//
// Miscellaneous Instructions.
//===----------------------------------------------------------------------===//

// Supervisor call.
let hasSideEffects = 1, isCall = 1, Defs = [CC] in
  def SVC : SideEffectUnaryI<"svc", 0x0A, imm32zx8>;

// Monitor call.
let hasSideEffects = 1, isCall = 1 in
  def MC : SideEffectBinarySI<"mc", 0xAF, imm32zx8>;

// Diagnose.
let hasSideEffects = 1, isCall = 1 in
  def DIAG : SideEffectTernaryRS<"diag", 0x83, GR32, GR32>;

// Trace.
let hasSideEffects = 1, mayLoad = 1 in {
  def TRACE : SideEffectTernaryRS<"trace", 0x99, GR32, GR32>;
  def TRACG : SideEffectTernaryRSY<"tracg", 0xEB0F, GR64, GR64>;
}

// Trap.
let hasSideEffects = 1 in {
  def TRAP2 : SideEffectInherentE<"trap2", 0x01FF>;
  def TRAP4 : SideEffectAddressS<"trap4", 0xB2FF, null_frag>;
}

// Signal processor.
let hasSideEffects = 1, Defs = [CC] in
  def SIGP : SideEffectTernaryRS<"sigp", 0xAE, GR64, GR64>;

// Signal adapter.
let hasSideEffects = 1, Uses = [R0D, R1D, R2D, R3D], Defs = [CC] in
  def SIGA : SideEffectAddressS<"siga", 0xB274, null_frag>;

// Start interpretive execution.
let hasSideEffects = 1, Defs = [CC] in
  def SIE : SideEffectUnaryS<"sie", 0xB214, null_frag, 0>;

//===----------------------------------------------------------------------===//
// CPU-Measurement Facility Instructions (SA23-2260).
//===----------------------------------------------------------------------===//

// Load program parameter
let hasSideEffects = 1 in
  def LPP : SideEffectUnaryS<"lpp", 0xB280, null_frag, 8>;

// Extract coprocessor-group address.
let hasSideEffects = 1, Defs = [CC] in
  def ECPGA : UnaryRRE<"ecpga", 0xB2ED, null_frag, GR32, GR64>;

// Extract CPU counter.
let hasSideEffects = 1, Defs = [CC] in
  def ECCTR : UnaryRRE<"ecctr", 0xB2E4, null_frag, GR64, GR64>;

// Extract peripheral counter.
let hasSideEffects = 1, Defs = [CC] in
  def EPCTR : UnaryRRE<"epctr", 0xB2E5, null_frag, GR64, GR64>;

// Load CPU-counter-set controls.
let hasSideEffects = 1, Defs = [CC] in
  def LCCTL : SideEffectUnaryS<"lcctl", 0xB284, null_frag, 8>;

// Load peripheral-counter-set controls.
let hasSideEffects = 1, Defs = [CC] in
  def LPCTL : SideEffectUnaryS<"lpctl", 0xB285, null_frag, 8>;

// Load sampling controls.
let hasSideEffects = 1, Defs = [CC] in
  def LSCTL : SideEffectUnaryS<"lsctl", 0xB287, null_frag, 0>;

// Query sampling information.
let hasSideEffects = 1 in
  def QSI : StoreInherentS<"qsi", 0xB286, null_frag, 0>;

// Query counter information.
let hasSideEffects = 1 in
  def QCTRI : StoreInherentS<"qctri", 0xB28E, null_frag, 0>;

// Set CPU counter.
let hasSideEffects = 1, Defs = [CC] in
  def SCCTR : SideEffectBinaryRRE<"scctr", 0xB2E0, GR64, GR64>;

// Set peripheral counter.
let hasSideEffects = 1, Defs = [CC] in
  def SPCTR : SideEffectBinaryRRE<"spctr", 0xB2E1, GR64, GR64>;

//===----------------------------------------------------------------------===//
// I/O Instructions (Principles of Operation, Chapter 14).
//===----------------------------------------------------------------------===//

// Clear subchannel.
let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
  def CSCH : SideEffectInherentS<"csch", 0xB230, null_frag>;

// Halt subchannel.
let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
  def HSCH : SideEffectInherentS<"hsch", 0xB231, null_frag>;

// Modify subchannel.
let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
  def MSCH : SideEffectUnaryS<"msch", 0xB232, null_frag, 0>;

// Resume subchannel.
let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
  def RSCH : SideEffectInherentS<"rsch", 0xB238, null_frag>;

// Start subchannel.
let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
  def SSCH : SideEffectUnaryS<"ssch", 0xB233, null_frag, 0>;

// Store subchannel.
let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
  def STSCH : StoreInherentS<"stsch", 0xB234, null_frag, 0>;

// Test subchannel.
let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
  def TSCH : StoreInherentS<"tsch", 0xB235, null_frag, 0>;

// Cancel subchannel.
let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
  def XSCH : SideEffectInherentS<"xsch", 0xB276, null_frag>;

// Reset channel path.
let hasSideEffects = 1, Uses = [R1L], Defs = [CC] in
  def RCHP : SideEffectInherentS<"rchp", 0xB23B, null_frag>;

// Set channel monitor.
let hasSideEffects = 1, mayLoad = 1, Uses = [R1L, R2D] in
  def SCHM : SideEffectInherentS<"schm", 0xB23C, null_frag>;

// Store channel path status.
let hasSideEffects = 1 in
  def STCPS : StoreInherentS<"stcps", 0xB23A, null_frag, 0>;

// Store channel report word.
let hasSideEffects = 1, Defs = [CC] in
  def STCRW : StoreInherentS<"stcrw", 0xB239, null_frag, 0>;

// Test pending interruption.
let hasSideEffects = 1, Defs = [CC] in
  def TPI : StoreInherentS<"tpi", 0xB236, null_frag, 0>;

// Set address limit.
let hasSideEffects = 1, Uses = [R1L] in
  def SAL : SideEffectInherentS<"sal", 0xB237, null_frag>;