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