1//==- SystemZInstrFormats.td - SystemZ Instruction Formats --*- tablegen -*-==// 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//===----------------------------------------------------------------------===// 11// Basic SystemZ instruction definition 12//===----------------------------------------------------------------------===// 13 14class InstSystemZ<int size, dag outs, dag ins, string asmstr, 15 list<dag> pattern> : Instruction { 16 let Namespace = "SystemZ"; 17 18 dag OutOperandList = outs; 19 dag InOperandList = ins; 20 let Size = size; 21 let Pattern = pattern; 22 let AsmString = asmstr; 23 24 // Some instructions come in pairs, one having a 12-bit displacement 25 // and the other having a 20-bit displacement. Both instructions in 26 // the pair have the same DispKey and their DispSizes are "12" and "20" 27 // respectively. 28 string DispKey = ""; 29 string DispSize = "none"; 30 31 // Many register-based <INSN>R instructions have a memory-based <INSN> 32 // counterpart. OpKey uniquely identifies <INSN>, while OpType is 33 // "reg" for <INSN>R and "mem" for <INSN>. 34 string OpKey = ""; 35 string OpType = "none"; 36 37 // Many distinct-operands instructions have older 2-operand equivalents. 38 // NumOpsKey uniquely identifies one of these 2-operand and 3-operand pairs, 39 // with NumOpsValue being "2" or "3" as appropriate. 40 string NumOpsKey = ""; 41 string NumOpsValue = "none"; 42 43 // True if this instruction is a simple D(X,B) load of a register 44 // (with no sign or zero extension). 45 bit SimpleBDXLoad = 0; 46 47 // True if this instruction is a simple D(X,B) store of a register 48 // (with no truncation). 49 bit SimpleBDXStore = 0; 50 51 // True if this instruction has a 20-bit displacement field. 52 bit Has20BitOffset = 0; 53 54 // True if addresses in this instruction have an index register. 55 bit HasIndex = 0; 56 57 // True if this is a 128-bit pseudo instruction that combines two 64-bit 58 // operations. 59 bit Is128Bit = 0; 60 61 // The access size of all memory operands in bytes, or 0 if not known. 62 bits<5> AccessBytes = 0; 63 64 // If the instruction sets CC to a useful value, this gives the mask 65 // of all possible CC results. The mask has the same form as 66 // SystemZ::CCMASK_*. 67 bits<4> CCValues = 0; 68 69 // The subset of CCValues that have the same meaning as they would after 70 // a comparison of the first operand against zero. 71 bits<4> CompareZeroCCMask = 0; 72 73 // True if the instruction is conditional and if the CC mask operand 74 // comes first (as for BRC, etc.). 75 bit CCMaskFirst = 0; 76 77 // Similar, but true if the CC mask operand comes last (as for LOC, etc.). 78 bit CCMaskLast = 0; 79 80 // True if the instruction is the "logical" rather than "arithmetic" form, 81 // in cases where a distinction exists. 82 bit IsLogical = 0; 83 84 let TSFlags{0} = SimpleBDXLoad; 85 let TSFlags{1} = SimpleBDXStore; 86 let TSFlags{2} = Has20BitOffset; 87 let TSFlags{3} = HasIndex; 88 let TSFlags{4} = Is128Bit; 89 let TSFlags{9-5} = AccessBytes; 90 let TSFlags{13-10} = CCValues; 91 let TSFlags{17-14} = CompareZeroCCMask; 92 let TSFlags{18} = CCMaskFirst; 93 let TSFlags{19} = CCMaskLast; 94 let TSFlags{20} = IsLogical; 95} 96 97//===----------------------------------------------------------------------===// 98// Mappings between instructions 99//===----------------------------------------------------------------------===// 100 101// Return the version of an instruction that has an unsigned 12-bit 102// displacement. 103def getDisp12Opcode : InstrMapping { 104 let FilterClass = "InstSystemZ"; 105 let RowFields = ["DispKey"]; 106 let ColFields = ["DispSize"]; 107 let KeyCol = ["20"]; 108 let ValueCols = [["12"]]; 109} 110 111// Return the version of an instruction that has a signed 20-bit displacement. 112def getDisp20Opcode : InstrMapping { 113 let FilterClass = "InstSystemZ"; 114 let RowFields = ["DispKey"]; 115 let ColFields = ["DispSize"]; 116 let KeyCol = ["12"]; 117 let ValueCols = [["20"]]; 118} 119 120// Return the memory form of a register instruction. 121def getMemOpcode : InstrMapping { 122 let FilterClass = "InstSystemZ"; 123 let RowFields = ["OpKey"]; 124 let ColFields = ["OpType"]; 125 let KeyCol = ["reg"]; 126 let ValueCols = [["mem"]]; 127} 128 129// Return the 3-operand form of a 2-operand instruction. 130def getThreeOperandOpcode : InstrMapping { 131 let FilterClass = "InstSystemZ"; 132 let RowFields = ["NumOpsKey"]; 133 let ColFields = ["NumOpsValue"]; 134 let KeyCol = ["2"]; 135 let ValueCols = [["3"]]; 136} 137 138//===----------------------------------------------------------------------===// 139// Instruction formats 140//===----------------------------------------------------------------------===// 141// 142// Formats are specified using operand field declarations of the form: 143// 144// bits<4> Rn : register input or output for operand n 145// bits<5> Vn : vector register input or output for operand n 146// bits<m> In : immediate value of width m for operand n 147// bits<4> BDn : address operand n, which has a base and a displacement 148// bits<m> XBDn : address operand n, which has an index, a base and a 149// displacement 150// bits<m> VBDn : address operand n, which has a vector index, a base and a 151// displacement 152// bits<4> Xn : index register for address operand n 153// bits<4> Mn : mode value for operand n 154// 155// The operand numbers ("n" in the list above) follow the architecture manual. 156// Assembly operands sometimes have a different order; in particular, R3 often 157// is often written between operands 1 and 2. 158// 159//===----------------------------------------------------------------------===// 160 161class InstI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 162 : InstSystemZ<2, outs, ins, asmstr, pattern> { 163 field bits<16> Inst; 164 field bits<16> SoftFail = 0; 165 166 bits<8> I1; 167 168 let Inst{15-8} = op; 169 let Inst{7-0} = I1; 170} 171 172class InstRI<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern> 173 : InstSystemZ<4, outs, ins, asmstr, pattern> { 174 field bits<32> Inst; 175 field bits<32> SoftFail = 0; 176 177 bits<4> R1; 178 bits<16> I2; 179 180 let Inst{31-24} = op{11-4}; 181 let Inst{23-20} = R1; 182 let Inst{19-16} = op{3-0}; 183 let Inst{15-0} = I2; 184} 185 186class InstRIEa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 187 : InstSystemZ<6, outs, ins, asmstr, pattern> { 188 field bits<48> Inst; 189 field bits<48> SoftFail = 0; 190 191 bits<4> R1; 192 bits<16> I2; 193 bits<4> M3; 194 195 let Inst{47-40} = op{15-8}; 196 let Inst{39-36} = R1; 197 let Inst{35-32} = 0; 198 let Inst{31-16} = I2; 199 let Inst{15-12} = M3; 200 let Inst{11-8} = 0; 201 let Inst{7-0} = op{7-0}; 202} 203 204class InstRIEb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 205 : InstSystemZ<6, outs, ins, asmstr, pattern> { 206 field bits<48> Inst; 207 field bits<48> SoftFail = 0; 208 209 bits<4> R1; 210 bits<4> R2; 211 bits<4> M3; 212 bits<16> RI4; 213 214 let Inst{47-40} = op{15-8}; 215 let Inst{39-36} = R1; 216 let Inst{35-32} = R2; 217 let Inst{31-16} = RI4; 218 let Inst{15-12} = M3; 219 let Inst{11-8} = 0; 220 let Inst{7-0} = op{7-0}; 221} 222 223class InstRIEc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 224 : InstSystemZ<6, outs, ins, asmstr, pattern> { 225 field bits<48> Inst; 226 field bits<48> SoftFail = 0; 227 228 bits<4> R1; 229 bits<8> I2; 230 bits<4> M3; 231 bits<16> RI4; 232 233 let Inst{47-40} = op{15-8}; 234 let Inst{39-36} = R1; 235 let Inst{35-32} = M3; 236 let Inst{31-16} = RI4; 237 let Inst{15-8} = I2; 238 let Inst{7-0} = op{7-0}; 239} 240 241class InstRIEd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 242 : InstSystemZ<6, outs, ins, asmstr, pattern> { 243 field bits<48> Inst; 244 field bits<48> SoftFail = 0; 245 246 bits<4> R1; 247 bits<4> R3; 248 bits<16> I2; 249 250 let Inst{47-40} = op{15-8}; 251 let Inst{39-36} = R1; 252 let Inst{35-32} = R3; 253 let Inst{31-16} = I2; 254 let Inst{15-8} = 0; 255 let Inst{7-0} = op{7-0}; 256} 257 258class InstRIEf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 259 : InstSystemZ<6, outs, ins, asmstr, pattern> { 260 field bits<48> Inst; 261 field bits<48> SoftFail = 0; 262 263 bits<4> R1; 264 bits<4> R2; 265 bits<8> I3; 266 bits<8> I4; 267 bits<8> I5; 268 269 let Inst{47-40} = op{15-8}; 270 let Inst{39-36} = R1; 271 let Inst{35-32} = R2; 272 let Inst{31-24} = I3; 273 let Inst{23-16} = I4; 274 let Inst{15-8} = I5; 275 let Inst{7-0} = op{7-0}; 276} 277 278class InstRIL<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern> 279 : InstSystemZ<6, outs, ins, asmstr, pattern> { 280 field bits<48> Inst; 281 field bits<48> SoftFail = 0; 282 283 bits<4> R1; 284 bits<32> I2; 285 286 let Inst{47-40} = op{11-4}; 287 let Inst{39-36} = R1; 288 let Inst{35-32} = op{3-0}; 289 let Inst{31-0} = I2; 290} 291 292class InstRIS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 293 : InstSystemZ<6, outs, ins, asmstr, pattern> { 294 field bits<48> Inst; 295 field bits<48> SoftFail = 0; 296 297 bits<4> R1; 298 bits<8> I2; 299 bits<4> M3; 300 bits<16> BD4; 301 302 let Inst{47-40} = op{15-8}; 303 let Inst{39-36} = R1; 304 let Inst{35-32} = M3; 305 let Inst{31-16} = BD4; 306 let Inst{15-8} = I2; 307 let Inst{7-0} = op{7-0}; 308} 309 310class InstRR<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 311 : InstSystemZ<2, outs, ins, asmstr, pattern> { 312 field bits<16> Inst; 313 field bits<16> SoftFail = 0; 314 315 bits<4> R1; 316 bits<4> R2; 317 318 let Inst{15-8} = op; 319 let Inst{7-4} = R1; 320 let Inst{3-0} = R2; 321} 322 323class InstRRD<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 324 : InstSystemZ<4, outs, ins, asmstr, pattern> { 325 field bits<32> Inst; 326 field bits<32> SoftFail = 0; 327 328 bits<4> R1; 329 bits<4> R3; 330 bits<4> R2; 331 332 let Inst{31-16} = op; 333 let Inst{15-12} = R1; 334 let Inst{11-8} = 0; 335 let Inst{7-4} = R3; 336 let Inst{3-0} = R2; 337} 338 339class InstRRE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 340 : InstSystemZ<4, outs, ins, asmstr, pattern> { 341 field bits<32> Inst; 342 field bits<32> SoftFail = 0; 343 344 bits<4> R1; 345 bits<4> R2; 346 347 let Inst{31-16} = op; 348 let Inst{15-8} = 0; 349 let Inst{7-4} = R1; 350 let Inst{3-0} = R2; 351} 352 353class InstRRF<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 354 : InstSystemZ<4, outs, ins, asmstr, pattern> { 355 field bits<32> Inst; 356 field bits<32> SoftFail = 0; 357 358 bits<4> R1; 359 bits<4> R2; 360 bits<4> R3; 361 bits<4> R4; 362 363 let Inst{31-16} = op; 364 let Inst{15-12} = R3; 365 let Inst{11-8} = R4; 366 let Inst{7-4} = R1; 367 let Inst{3-0} = R2; 368} 369 370class InstRRFc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 371 : InstSystemZ<4, outs, ins, asmstr, pattern> { 372 field bits<32> Inst; 373 field bits<32> SoftFail = 0; 374 375 bits<4> R1; 376 bits<4> R2; 377 bits<4> M3; 378 379 let Inst{31-16} = op; 380 let Inst{15-12} = M3; 381 let Inst{11-8} = 0; 382 let Inst{7-4} = R1; 383 let Inst{3-0} = R2; 384} 385 386class InstRRS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 387 : InstSystemZ<6, outs, ins, asmstr, pattern> { 388 field bits<48> Inst; 389 field bits<48> SoftFail = 0; 390 391 bits<4> R1; 392 bits<4> R2; 393 bits<4> M3; 394 bits<16> BD4; 395 396 let Inst{47-40} = op{15-8}; 397 let Inst{39-36} = R1; 398 let Inst{35-32} = R2; 399 let Inst{31-16} = BD4; 400 let Inst{15-12} = M3; 401 let Inst{11-8} = 0; 402 let Inst{7-0} = op{7-0}; 403} 404 405class InstRX<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 406 : InstSystemZ<4, outs, ins, asmstr, pattern> { 407 field bits<32> Inst; 408 field bits<32> SoftFail = 0; 409 410 bits<4> R1; 411 bits<20> XBD2; 412 413 let Inst{31-24} = op; 414 let Inst{23-20} = R1; 415 let Inst{19-0} = XBD2; 416 417 let HasIndex = 1; 418} 419 420class InstRXE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 421 : InstSystemZ<6, outs, ins, asmstr, pattern> { 422 field bits<48> Inst; 423 field bits<48> SoftFail = 0; 424 425 bits<4> R1; 426 bits<20> XBD2; 427 bits<4> M3; 428 429 let Inst{47-40} = op{15-8}; 430 let Inst{39-36} = R1; 431 let Inst{35-16} = XBD2; 432 let Inst{15-12} = M3; 433 let Inst{11-8} = 0; 434 let Inst{7-0} = op{7-0}; 435 436 let HasIndex = 1; 437} 438 439class InstRXF<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 440 : InstSystemZ<6, outs, ins, asmstr, pattern> { 441 field bits<48> Inst; 442 field bits<48> SoftFail = 0; 443 444 bits<4> R1; 445 bits<4> R3; 446 bits<20> XBD2; 447 448 let Inst{47-40} = op{15-8}; 449 let Inst{39-36} = R3; 450 let Inst{35-16} = XBD2; 451 let Inst{15-12} = R1; 452 let Inst{11-8} = 0; 453 let Inst{7-0} = op{7-0}; 454 455 let HasIndex = 1; 456} 457 458class InstRXY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 459 : InstSystemZ<6, outs, ins, asmstr, pattern> { 460 field bits<48> Inst; 461 field bits<48> SoftFail = 0; 462 463 bits<4> R1; 464 bits<28> XBD2; 465 466 let Inst{47-40} = op{15-8}; 467 let Inst{39-36} = R1; 468 let Inst{35-8} = XBD2; 469 let Inst{7-0} = op{7-0}; 470 471 let Has20BitOffset = 1; 472 let HasIndex = 1; 473} 474 475class InstRS<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 476 : InstSystemZ<4, outs, ins, asmstr, pattern> { 477 field bits<32> Inst; 478 field bits<32> SoftFail = 0; 479 480 bits<4> R1; 481 bits<4> R3; 482 bits<16> BD2; 483 484 let Inst{31-24} = op; 485 let Inst{23-20} = R1; 486 let Inst{19-16} = R3; 487 let Inst{15-0} = BD2; 488} 489 490class InstRSY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 491 : InstSystemZ<6, outs, ins, asmstr, pattern> { 492 field bits<48> Inst; 493 field bits<48> SoftFail = 0; 494 495 bits<4> R1; 496 bits<4> R3; 497 bits<24> BD2; 498 499 let Inst{47-40} = op{15-8}; 500 let Inst{39-36} = R1; 501 let Inst{35-32} = R3; 502 let Inst{31-8} = BD2; 503 let Inst{7-0} = op{7-0}; 504 505 let Has20BitOffset = 1; 506} 507 508class InstSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 509 : InstSystemZ<4, outs, ins, asmstr, pattern> { 510 field bits<32> Inst; 511 field bits<32> SoftFail = 0; 512 513 bits<16> BD1; 514 bits<8> I2; 515 516 let Inst{31-24} = op; 517 let Inst{23-16} = I2; 518 let Inst{15-0} = BD1; 519} 520 521class InstSIL<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 522 : InstSystemZ<6, outs, ins, asmstr, pattern> { 523 field bits<48> Inst; 524 field bits<48> SoftFail = 0; 525 526 bits<16> BD1; 527 bits<16> I2; 528 529 let Inst{47-32} = op; 530 let Inst{31-16} = BD1; 531 let Inst{15-0} = I2; 532} 533 534class InstSIY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 535 : InstSystemZ<6, outs, ins, asmstr, pattern> { 536 field bits<48> Inst; 537 field bits<48> SoftFail = 0; 538 539 bits<24> BD1; 540 bits<8> I2; 541 542 let Inst{47-40} = op{15-8}; 543 let Inst{39-32} = I2; 544 let Inst{31-8} = BD1; 545 let Inst{7-0} = op{7-0}; 546 547 let Has20BitOffset = 1; 548} 549 550class InstSS<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 551 : InstSystemZ<6, outs, ins, asmstr, pattern> { 552 field bits<48> Inst; 553 field bits<48> SoftFail = 0; 554 555 bits<24> BDL1; 556 bits<16> BD2; 557 558 let Inst{47-40} = op; 559 let Inst{39-16} = BDL1; 560 let Inst{15-0} = BD2; 561} 562 563class InstS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 564 : InstSystemZ<4, outs, ins, asmstr, pattern> { 565 field bits<32> Inst; 566 field bits<32> SoftFail = 0; 567 568 bits<16> BD2; 569 570 let Inst{31-16} = op; 571 let Inst{15-0} = BD2; 572} 573 574class InstVRIa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 575 : InstSystemZ<6, outs, ins, asmstr, pattern> { 576 field bits<48> Inst; 577 field bits<48> SoftFail = 0; 578 579 bits<5> V1; 580 bits<16> I2; 581 bits<4> M3; 582 583 let Inst{47-40} = op{15-8}; 584 let Inst{39-36} = V1{3-0}; 585 let Inst{35-32} = 0; 586 let Inst{31-16} = I2; 587 let Inst{15-12} = M3; 588 let Inst{11} = V1{4}; 589 let Inst{10-8} = 0; 590 let Inst{7-0} = op{7-0}; 591} 592 593class InstVRIb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 594 : InstSystemZ<6, outs, ins, asmstr, pattern> { 595 field bits<48> Inst; 596 field bits<48> SoftFail = 0; 597 598 bits<5> V1; 599 bits<8> I2; 600 bits<8> I3; 601 bits<4> M4; 602 603 let Inst{47-40} = op{15-8}; 604 let Inst{39-36} = V1{3-0}; 605 let Inst{35-32} = 0; 606 let Inst{31-24} = I2; 607 let Inst{23-16} = I3; 608 let Inst{15-12} = M4; 609 let Inst{11} = V1{4}; 610 let Inst{10-8} = 0; 611 let Inst{7-0} = op{7-0}; 612} 613 614class InstVRIc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 615 : InstSystemZ<6, outs, ins, asmstr, pattern> { 616 field bits<48> Inst; 617 field bits<48> SoftFail = 0; 618 619 bits<5> V1; 620 bits<5> V3; 621 bits<16> I2; 622 bits<4> M4; 623 624 let Inst{47-40} = op{15-8}; 625 let Inst{39-36} = V1{3-0}; 626 let Inst{35-32} = V3{3-0}; 627 let Inst{31-16} = I2; 628 let Inst{15-12} = M4; 629 let Inst{11} = V1{4}; 630 let Inst{10} = V3{4}; 631 let Inst{9-8} = 0; 632 let Inst{7-0} = op{7-0}; 633} 634 635class InstVRId<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 636 : InstSystemZ<6, outs, ins, asmstr, pattern> { 637 field bits<48> Inst; 638 field bits<48> SoftFail = 0; 639 640 bits<5> V1; 641 bits<5> V2; 642 bits<5> V3; 643 bits<8> I4; 644 bits<4> M5; 645 646 let Inst{47-40} = op{15-8}; 647 let Inst{39-36} = V1{3-0}; 648 let Inst{35-32} = V2{3-0}; 649 let Inst{31-28} = V3{3-0}; 650 let Inst{27-24} = 0; 651 let Inst{23-16} = I4; 652 let Inst{15-12} = M5; 653 let Inst{11} = V1{4}; 654 let Inst{10} = V2{4}; 655 let Inst{9} = V3{4}; 656 let Inst{8} = 0; 657 let Inst{7-0} = op{7-0}; 658} 659 660class InstVRIe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 661 : InstSystemZ<6, outs, ins, asmstr, pattern> { 662 field bits<48> Inst; 663 field bits<48> SoftFail = 0; 664 665 bits<5> V1; 666 bits<5> V2; 667 bits<12> I3; 668 bits<4> M4; 669 bits<4> M5; 670 671 let Inst{47-40} = op{15-8}; 672 let Inst{39-36} = V1{3-0}; 673 let Inst{35-32} = V2{3-0}; 674 let Inst{31-20} = I3; 675 let Inst{19-16} = M5; 676 let Inst{15-12} = M4; 677 let Inst{11} = V1{4}; 678 let Inst{10} = V2{4}; 679 let Inst{9-8} = 0; 680 let Inst{7-0} = op{7-0}; 681} 682 683// Depending on the instruction mnemonic, certain bits may be or-ed into 684// the M4 value provided as explicit operand. These are passed as m4or. 685class InstVRRa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern, 686 bits<4> m4or = 0> 687 : InstSystemZ<6, outs, ins, asmstr, pattern> { 688 field bits<48> Inst; 689 field bits<48> SoftFail = 0; 690 691 bits<5> V1; 692 bits<5> V2; 693 bits<4> M3; 694 bits<4> M4; 695 bits<4> M5; 696 697 let Inst{47-40} = op{15-8}; 698 let Inst{39-36} = V1{3-0}; 699 let Inst{35-32} = V2{3-0}; 700 let Inst{31-24} = 0; 701 let Inst{23-20} = M5; 702 let Inst{19} = !if (!eq (m4or{3}, 1), 1, M4{3}); 703 let Inst{18} = !if (!eq (m4or{2}, 1), 1, M4{2}); 704 let Inst{17} = !if (!eq (m4or{1}, 1), 1, M4{1}); 705 let Inst{16} = !if (!eq (m4or{0}, 1), 1, M4{0}); 706 let Inst{15-12} = M3; 707 let Inst{11} = V1{4}; 708 let Inst{10} = V2{4}; 709 let Inst{9-8} = 0; 710 let Inst{7-0} = op{7-0}; 711} 712 713// Depending on the instruction mnemonic, certain bits may be or-ed into 714// the M5 value provided as explicit operand. These are passed as m5or. 715class InstVRRb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern, 716 bits<4> m5or = 0> 717 : InstSystemZ<6, outs, ins, asmstr, pattern> { 718 field bits<48> Inst; 719 field bits<48> SoftFail = 0; 720 721 bits<5> V1; 722 bits<5> V2; 723 bits<5> V3; 724 bits<4> M4; 725 bits<4> M5; 726 727 let Inst{47-40} = op{15-8}; 728 let Inst{39-36} = V1{3-0}; 729 let Inst{35-32} = V2{3-0}; 730 let Inst{31-28} = V3{3-0}; 731 let Inst{27-24} = 0; 732 let Inst{23} = !if (!eq (m5or{3}, 1), 1, M5{3}); 733 let Inst{22} = !if (!eq (m5or{2}, 1), 1, M5{2}); 734 let Inst{21} = !if (!eq (m5or{1}, 1), 1, M5{1}); 735 let Inst{20} = !if (!eq (m5or{0}, 1), 1, M5{0}); 736 let Inst{19-16} = 0; 737 let Inst{15-12} = M4; 738 let Inst{11} = V1{4}; 739 let Inst{10} = V2{4}; 740 let Inst{9} = V3{4}; 741 let Inst{8} = 0; 742 let Inst{7-0} = op{7-0}; 743} 744 745class InstVRRc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 746 : InstSystemZ<6, outs, ins, asmstr, pattern> { 747 field bits<48> Inst; 748 field bits<48> SoftFail = 0; 749 750 bits<5> V1; 751 bits<5> V2; 752 bits<5> V3; 753 bits<4> M4; 754 bits<4> M5; 755 bits<4> M6; 756 757 let Inst{47-40} = op{15-8}; 758 let Inst{39-36} = V1{3-0}; 759 let Inst{35-32} = V2{3-0}; 760 let Inst{31-28} = V3{3-0}; 761 let Inst{27-24} = 0; 762 let Inst{23-20} = M6; 763 let Inst{19-16} = M5; 764 let Inst{15-12} = M4; 765 let Inst{11} = V1{4}; 766 let Inst{10} = V2{4}; 767 let Inst{9} = V3{4}; 768 let Inst{8} = 0; 769 let Inst{7-0} = op{7-0}; 770} 771 772// Depending on the instruction mnemonic, certain bits may be or-ed into 773// the M6 value provided as explicit operand. These are passed as m6or. 774class InstVRRd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern, 775 bits<4> m6or = 0> 776 : InstSystemZ<6, outs, ins, asmstr, pattern> { 777 field bits<48> Inst; 778 field bits<48> SoftFail = 0; 779 780 bits<5> V1; 781 bits<5> V2; 782 bits<5> V3; 783 bits<5> V4; 784 bits<4> M5; 785 bits<4> M6; 786 787 let Inst{47-40} = op{15-8}; 788 let Inst{39-36} = V1{3-0}; 789 let Inst{35-32} = V2{3-0}; 790 let Inst{31-28} = V3{3-0}; 791 let Inst{27-24} = M5; 792 let Inst{23} = !if (!eq (m6or{3}, 1), 1, M6{3}); 793 let Inst{22} = !if (!eq (m6or{2}, 1), 1, M6{2}); 794 let Inst{21} = !if (!eq (m6or{1}, 1), 1, M6{1}); 795 let Inst{20} = !if (!eq (m6or{0}, 1), 1, M6{0}); 796 let Inst{19-16} = 0; 797 let Inst{15-12} = V4{3-0}; 798 let Inst{11} = V1{4}; 799 let Inst{10} = V2{4}; 800 let Inst{9} = V3{4}; 801 let Inst{8} = V4{4}; 802 let Inst{7-0} = op{7-0}; 803} 804 805class InstVRRe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 806 : InstSystemZ<6, outs, ins, asmstr, pattern> { 807 field bits<48> Inst; 808 field bits<48> SoftFail = 0; 809 810 bits<5> V1; 811 bits<5> V2; 812 bits<5> V3; 813 bits<5> V4; 814 bits<4> M5; 815 bits<4> M6; 816 817 let Inst{47-40} = op{15-8}; 818 let Inst{39-36} = V1{3-0}; 819 let Inst{35-32} = V2{3-0}; 820 let Inst{31-28} = V3{3-0}; 821 let Inst{27-24} = M6; 822 let Inst{23-20} = 0; 823 let Inst{19-16} = M5; 824 let Inst{15-12} = V4{3-0}; 825 let Inst{11} = V1{4}; 826 let Inst{10} = V2{4}; 827 let Inst{9} = V3{4}; 828 let Inst{8} = V4{4}; 829 let Inst{7-0} = op{7-0}; 830} 831 832class InstVRRf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 833 : InstSystemZ<6, outs, ins, asmstr, pattern> { 834 field bits<48> Inst; 835 field bits<48> SoftFail = 0; 836 837 bits<5> V1; 838 bits<4> R2; 839 bits<4> R3; 840 841 let Inst{47-40} = op{15-8}; 842 let Inst{39-36} = V1{3-0}; 843 let Inst{35-32} = R2; 844 let Inst{31-28} = R3; 845 let Inst{27-12} = 0; 846 let Inst{11} = V1{4}; 847 let Inst{10-8} = 0; 848 let Inst{7-0} = op{7-0}; 849} 850 851class InstVRSa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 852 : InstSystemZ<6, outs, ins, asmstr, pattern> { 853 field bits<48> Inst; 854 field bits<48> SoftFail = 0; 855 856 bits<5> V1; 857 bits<16> BD2; 858 bits<5> V3; 859 bits<4> M4; 860 861 let Inst{47-40} = op{15-8}; 862 let Inst{39-36} = V1{3-0}; 863 let Inst{35-32} = V3{3-0}; 864 let Inst{31-16} = BD2; 865 let Inst{15-12} = M4; 866 let Inst{11} = V1{4}; 867 let Inst{10} = V3{4}; 868 let Inst{9-8} = 0; 869 let Inst{7-0} = op{7-0}; 870} 871 872class InstVRSb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 873 : InstSystemZ<6, outs, ins, asmstr, pattern> { 874 field bits<48> Inst; 875 field bits<48> SoftFail = 0; 876 877 bits<5> V1; 878 bits<16> BD2; 879 bits<4> R3; 880 bits<4> M4; 881 882 let Inst{47-40} = op{15-8}; 883 let Inst{39-36} = V1{3-0}; 884 let Inst{35-32} = R3; 885 let Inst{31-16} = BD2; 886 let Inst{15-12} = M4; 887 let Inst{11} = V1{4}; 888 let Inst{10-8} = 0; 889 let Inst{7-0} = op{7-0}; 890} 891 892class InstVRSc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 893 : InstSystemZ<6, outs, ins, asmstr, pattern> { 894 field bits<48> Inst; 895 field bits<48> SoftFail = 0; 896 897 bits<4> R1; 898 bits<16> BD2; 899 bits<5> V3; 900 bits<4> M4; 901 902 let Inst{47-40} = op{15-8}; 903 let Inst{39-36} = R1; 904 let Inst{35-32} = V3{3-0}; 905 let Inst{31-16} = BD2; 906 let Inst{15-12} = M4; 907 let Inst{11} = 0; 908 let Inst{10} = V3{4}; 909 let Inst{9-8} = 0; 910 let Inst{7-0} = op{7-0}; 911} 912 913class InstVRV<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 914 : InstSystemZ<6, outs, ins, asmstr, pattern> { 915 field bits<48> Inst; 916 field bits<48> SoftFail = 0; 917 918 bits<5> V1; 919 bits<21> VBD2; 920 bits<4> M3; 921 922 let Inst{47-40} = op{15-8}; 923 let Inst{39-36} = V1{3-0}; 924 let Inst{35-16} = VBD2{19-0}; 925 let Inst{15-12} = M3; 926 let Inst{11} = V1{4}; 927 let Inst{10} = VBD2{20}; 928 let Inst{9-8} = 0; 929 let Inst{7-0} = op{7-0}; 930} 931 932class InstVRX<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 933 : InstSystemZ<6, outs, ins, asmstr, pattern> { 934 field bits<48> Inst; 935 field bits<48> SoftFail = 0; 936 937 bits<5> V1; 938 bits<20> XBD2; 939 bits<4> M3; 940 941 let Inst{47-40} = op{15-8}; 942 let Inst{39-36} = V1{3-0}; 943 let Inst{35-16} = XBD2; 944 let Inst{15-12} = M3; 945 let Inst{11} = V1{4}; 946 let Inst{10-8} = 0; 947 let Inst{7-0} = op{7-0}; 948} 949 950//===----------------------------------------------------------------------===// 951// Instruction definitions with semantics 952//===----------------------------------------------------------------------===// 953// 954// These classes have the form [Cond]<Category><Format>, where <Format> is one 955// of the formats defined above and where <Category> describes the inputs 956// and outputs. "Cond" is used if the instruction is conditional, 957// in which case the 4-bit condition-code mask is added as a final operand. 958// <Category> can be one of: 959// 960// Inherent: 961// One register output operand and no input operands. 962// 963// BranchUnary: 964// One register output operand, one register input operand and 965// one branch displacement. The instructions stores a modified 966// form of the source register in the destination register and 967// branches on the result. 968// 969// LoadMultiple: 970// One address input operand and two explicit output operands. 971// The instruction loads a range of registers from the address, 972// with the explicit operands giving the first and last register 973// to load. Other loaded registers are added as implicit definitions. 974// 975// StoreMultiple: 976// Two explicit input register operands and an address operand. 977// The instruction stores a range of registers to the address, 978// with the explicit operands giving the first and last register 979// to store. Other stored registers are added as implicit uses. 980// 981// StoreLength: 982// One value operand, one length operand and one address operand. 983// The instruction stores the value operand to the address but 984// doesn't write more than the number of bytes specified by the 985// length operand. 986// 987// Unary: 988// One register output operand and one input operand. 989// 990// Store: 991// One address operand and one other input operand. The instruction 992// stores to the address. 993// 994// Binary: 995// One register output operand and two input operands. 996// 997// StoreBinary: 998// One address operand and two other input operands. The instruction 999// stores to the address. 1000// 1001// Compare: 1002// Two input operands and an implicit CC output operand. 1003// 1004// Test: 1005// Two input operands and an implicit CC output operand. The second 1006// input operand is an "address" operand used as a test class mask. 1007// 1008// Ternary: 1009// One register output operand and three input operands. 1010// 1011// Quaternary: 1012// One register output operand and four input operands. 1013// 1014// LoadAndOp: 1015// One output operand and two input operands, one of which is an address. 1016// The instruction both reads from and writes to the address. 1017// 1018// CmpSwap: 1019// One output operand and three input operands, one of which is an address. 1020// The instruction both reads from and writes to the address. 1021// 1022// RotateSelect: 1023// One output operand and five input operands. The first two operands 1024// are registers and the other three are immediates. 1025// 1026// Prefetch: 1027// One 4-bit immediate operand and one address operand. The immediate 1028// operand is 1 for a load prefetch and 2 for a store prefetch. 1029// 1030// The format determines which input operands are tied to output operands, 1031// and also determines the shape of any address operand. 1032// 1033// Multiclasses of the form <Category><Format>Pair define two instructions, 1034// one with <Category><Format> and one with <Category><Format>Y. The name 1035// of the first instruction has no suffix, the name of the second has 1036// an extra "y". 1037// 1038//===----------------------------------------------------------------------===// 1039 1040class InherentRRE<string mnemonic, bits<16> opcode, RegisterOperand cls, 1041 dag src> 1042 : InstRRE<opcode, (outs cls:$R1), (ins), 1043 mnemonic#"\t$R1", 1044 [(set cls:$R1, src)]> { 1045 let R2 = 0; 1046} 1047 1048class InherentVRIa<string mnemonic, bits<16> opcode, bits<16> value> 1049 : InstVRIa<opcode, (outs VR128:$V1), (ins), mnemonic#"\t$V1", []> { 1050 let I2 = value; 1051 let M3 = 0; 1052} 1053 1054class BranchUnaryRI<string mnemonic, bits<12> opcode, RegisterOperand cls> 1055 : InstRI<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget16:$I2), 1056 mnemonic##"\t$R1, $I2", []> { 1057 let isBranch = 1; 1058 let isTerminator = 1; 1059 let Constraints = "$R1 = $R1src"; 1060 let DisableEncoding = "$R1src"; 1061} 1062 1063class LoadMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls> 1064 : InstRSY<opcode, (outs cls:$R1, cls:$R3), (ins bdaddr20only:$BD2), 1065 mnemonic#"\t$R1, $R3, $BD2", []> { 1066 let mayLoad = 1; 1067} 1068 1069class LoadMultipleVRSa<string mnemonic, bits<16> opcode> 1070 : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3), (ins bdaddr12only:$BD2), 1071 mnemonic#"\t$V1, $V3, $BD2", []> { 1072 let M4 = 0; 1073 let mayLoad = 1; 1074} 1075 1076class StoreRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator, 1077 RegisterOperand cls> 1078 : InstRIL<opcode, (outs), (ins cls:$R1, pcrel32:$I2), 1079 mnemonic#"\t$R1, $I2", 1080 [(operator cls:$R1, pcrel32:$I2)]> { 1081 let mayStore = 1; 1082 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 1083 // However, BDXs have two extra operands and are therefore 6 units more 1084 // complex. 1085 let AddedComplexity = 7; 1086} 1087 1088class StoreRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1089 RegisterOperand cls, bits<5> bytes, 1090 AddressingMode mode = bdxaddr12only> 1091 : InstRX<opcode, (outs), (ins cls:$R1, mode:$XBD2), 1092 mnemonic#"\t$R1, $XBD2", 1093 [(operator cls:$R1, mode:$XBD2)]> { 1094 let OpKey = mnemonic ## cls; 1095 let OpType = "mem"; 1096 let mayStore = 1; 1097 let AccessBytes = bytes; 1098} 1099 1100class StoreRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1101 RegisterOperand cls, bits<5> bytes, 1102 AddressingMode mode = bdxaddr20only> 1103 : InstRXY<opcode, (outs), (ins cls:$R1, mode:$XBD2), 1104 mnemonic#"\t$R1, $XBD2", 1105 [(operator cls:$R1, mode:$XBD2)]> { 1106 let OpKey = mnemonic ## cls; 1107 let OpType = "mem"; 1108 let mayStore = 1; 1109 let AccessBytes = bytes; 1110} 1111 1112multiclass StoreRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 1113 SDPatternOperator operator, RegisterOperand cls, 1114 bits<5> bytes> { 1115 let DispKey = mnemonic ## #cls in { 1116 let DispSize = "12" in 1117 def "" : StoreRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>; 1118 let DispSize = "20" in 1119 def Y : StoreRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes, 1120 bdxaddr20pair>; 1121 } 1122} 1123 1124class StoreVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1125 TypedReg tr, bits<5> bytes, bits<4> type = 0> 1126 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2), 1127 mnemonic#"\t$V1, $XBD2", 1128 [(set tr.op:$V1, (tr.vt (operator bdxaddr12only:$XBD2)))]> { 1129 let M3 = type; 1130 let mayStore = 1; 1131 let AccessBytes = bytes; 1132} 1133 1134class StoreLengthVRSb<string mnemonic, bits<16> opcode, 1135 SDPatternOperator operator, bits<5> bytes> 1136 : InstVRSb<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2), 1137 mnemonic#"\t$V1, $R3, $BD2", 1138 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> { 1139 let M4 = 0; 1140 let mayStore = 1; 1141 let AccessBytes = bytes; 1142} 1143 1144class StoreMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls> 1145 : InstRSY<opcode, (outs), (ins cls:$R1, cls:$R3, bdaddr20only:$BD2), 1146 mnemonic#"\t$R1, $R3, $BD2", []> { 1147 let mayStore = 1; 1148} 1149 1150class StoreMultipleVRSa<string mnemonic, bits<16> opcode> 1151 : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3, bdaddr12only:$BD2), 1152 mnemonic#"\t$V1, $V3, $BD2", []> { 1153 let M4 = 0; 1154 let mayStore = 1; 1155} 1156 1157// StoreSI* instructions are used to store an integer to memory, but the 1158// addresses are more restricted than for normal stores. If we are in the 1159// situation of having to force either the address into a register or the 1160// constant into a register, it's usually better to do the latter. 1161// We therefore match the address in the same way as a normal store and 1162// only use the StoreSI* instruction if the matched address is suitable. 1163class StoreSI<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1164 Immediate imm> 1165 : InstSI<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2), 1166 mnemonic#"\t$BD1, $I2", 1167 [(operator imm:$I2, mviaddr12pair:$BD1)]> { 1168 let mayStore = 1; 1169} 1170 1171class StoreSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1172 Immediate imm> 1173 : InstSIY<opcode, (outs), (ins mviaddr20pair:$BD1, imm:$I2), 1174 mnemonic#"\t$BD1, $I2", 1175 [(operator imm:$I2, mviaddr20pair:$BD1)]> { 1176 let mayStore = 1; 1177} 1178 1179class StoreSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1180 Immediate imm> 1181 : InstSIL<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2), 1182 mnemonic#"\t$BD1, $I2", 1183 [(operator imm:$I2, mviaddr12pair:$BD1)]> { 1184 let mayStore = 1; 1185} 1186 1187multiclass StoreSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode, 1188 SDPatternOperator operator, Immediate imm> { 1189 let DispKey = mnemonic in { 1190 let DispSize = "12" in 1191 def "" : StoreSI<mnemonic, siOpcode, operator, imm>; 1192 let DispSize = "20" in 1193 def Y : StoreSIY<mnemonic#"y", siyOpcode, operator, imm>; 1194 } 1195} 1196 1197class CondStoreRSY<string mnemonic, bits<16> opcode, 1198 RegisterOperand cls, bits<5> bytes, 1199 AddressingMode mode = bdaddr20only> 1200 : InstRSY<opcode, (outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$R3), 1201 mnemonic#"$R3\t$R1, $BD2", []>, 1202 Requires<[FeatureLoadStoreOnCond]> { 1203 let mayStore = 1; 1204 let AccessBytes = bytes; 1205 let CCMaskLast = 1; 1206} 1207 1208// Like CondStoreRSY, but used for the raw assembly form. The condition-code 1209// mask is the third operand rather than being part of the mnemonic. 1210class AsmCondStoreRSY<string mnemonic, bits<16> opcode, 1211 RegisterOperand cls, bits<5> bytes, 1212 AddressingMode mode = bdaddr20only> 1213 : InstRSY<opcode, (outs), (ins cls:$R1, mode:$BD2, imm32zx4:$R3), 1214 mnemonic#"\t$R1, $BD2, $R3", []>, 1215 Requires<[FeatureLoadStoreOnCond]> { 1216 let mayStore = 1; 1217 let AccessBytes = bytes; 1218} 1219 1220// Like CondStoreRSY, but with a fixed CC mask. 1221class FixedCondStoreRSY<string mnemonic, bits<16> opcode, 1222 RegisterOperand cls, bits<4> ccmask, bits<5> bytes, 1223 AddressingMode mode = bdaddr20only> 1224 : InstRSY<opcode, (outs), (ins cls:$R1, mode:$BD2), 1225 mnemonic#"\t$R1, $BD2", []>, 1226 Requires<[FeatureLoadStoreOnCond]> { 1227 let mayStore = 1; 1228 let AccessBytes = bytes; 1229 let R3 = ccmask; 1230} 1231 1232class UnaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1233 RegisterOperand cls1, RegisterOperand cls2> 1234 : InstRR<opcode, (outs cls1:$R1), (ins cls2:$R2), 1235 mnemonic#"r\t$R1, $R2", 1236 [(set cls1:$R1, (operator cls2:$R2))]> { 1237 let OpKey = mnemonic ## cls1; 1238 let OpType = "reg"; 1239} 1240 1241class UnaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1242 RegisterOperand cls1, RegisterOperand cls2> 1243 : InstRRE<opcode, (outs cls1:$R1), (ins cls2:$R2), 1244 mnemonic#"r\t$R1, $R2", 1245 [(set cls1:$R1, (operator cls2:$R2))]> { 1246 let OpKey = mnemonic ## cls1; 1247 let OpType = "reg"; 1248} 1249 1250class UnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 1251 RegisterOperand cls2> 1252 : InstRRF<opcode, (outs cls1:$R1), (ins imm32zx4:$R3, cls2:$R2), 1253 mnemonic#"r\t$R1, $R3, $R2", []> { 1254 let OpKey = mnemonic ## cls1; 1255 let OpType = "reg"; 1256 let R4 = 0; 1257} 1258 1259class UnaryRRF4<string mnemonic, bits<16> opcode, RegisterOperand cls1, 1260 RegisterOperand cls2> 1261 : InstRRF<opcode, (outs cls1:$R1), (ins imm32zx4:$R3, cls2:$R2, imm32zx4:$R4), 1262 mnemonic#"\t$R1, $R3, $R2, $R4", []>; 1263 1264// These instructions are generated by if conversion. The old value of R1 1265// is added as an implicit use. 1266class CondUnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 1267 RegisterOperand cls2> 1268 : InstRRF<opcode, (outs cls1:$R1), (ins cls2:$R2, cond4:$valid, cond4:$R3), 1269 mnemonic#"r$R3\t$R1, $R2", []>, 1270 Requires<[FeatureLoadStoreOnCond]> { 1271 let CCMaskLast = 1; 1272 let R4 = 0; 1273} 1274 1275// Like CondUnaryRRF, but used for the raw assembly form. The condition-code 1276// mask is the third operand rather than being part of the mnemonic. 1277class AsmCondUnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 1278 RegisterOperand cls2> 1279 : InstRRF<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2, imm32zx4:$R3), 1280 mnemonic#"r\t$R1, $R2, $R3", []>, 1281 Requires<[FeatureLoadStoreOnCond]> { 1282 let Constraints = "$R1 = $R1src"; 1283 let DisableEncoding = "$R1src"; 1284 let R4 = 0; 1285} 1286 1287// Like CondUnaryRRF, but with a fixed CC mask. 1288class FixedCondUnaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 1289 RegisterOperand cls2, bits<4> ccmask> 1290 : InstRRF<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2), 1291 mnemonic#"\t$R1, $R2", []>, 1292 Requires<[FeatureLoadStoreOnCond]> { 1293 let Constraints = "$R1 = $R1src"; 1294 let DisableEncoding = "$R1src"; 1295 let R3 = ccmask; 1296 let R4 = 0; 1297} 1298 1299class UnaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator, 1300 RegisterOperand cls, Immediate imm> 1301 : InstRI<opcode, (outs cls:$R1), (ins imm:$I2), 1302 mnemonic#"\t$R1, $I2", 1303 [(set cls:$R1, (operator imm:$I2))]>; 1304 1305class UnaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator, 1306 RegisterOperand cls, Immediate imm> 1307 : InstRIL<opcode, (outs cls:$R1), (ins imm:$I2), 1308 mnemonic#"\t$R1, $I2", 1309 [(set cls:$R1, (operator imm:$I2))]>; 1310 1311class UnaryRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator, 1312 RegisterOperand cls> 1313 : InstRIL<opcode, (outs cls:$R1), (ins pcrel32:$I2), 1314 mnemonic#"\t$R1, $I2", 1315 [(set cls:$R1, (operator pcrel32:$I2))]> { 1316 let mayLoad = 1; 1317 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 1318 // However, BDXs have two extra operands and are therefore 6 units more 1319 // complex. 1320 let AddedComplexity = 7; 1321} 1322 1323class CondUnaryRSY<string mnemonic, bits<16> opcode, 1324 SDPatternOperator operator, RegisterOperand cls, 1325 bits<5> bytes, AddressingMode mode = bdaddr20only> 1326 : InstRSY<opcode, (outs cls:$R1), 1327 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$R3), 1328 mnemonic#"$R3\t$R1, $BD2", 1329 [(set cls:$R1, 1330 (z_select_ccmask (load bdaddr20only:$BD2), cls:$R1src, 1331 cond4:$valid, cond4:$R3))]>, 1332 Requires<[FeatureLoadStoreOnCond]> { 1333 let Constraints = "$R1 = $R1src"; 1334 let DisableEncoding = "$R1src"; 1335 let mayLoad = 1; 1336 let AccessBytes = bytes; 1337 let CCMaskLast = 1; 1338} 1339 1340// Like CondUnaryRSY, but used for the raw assembly form. The condition-code 1341// mask is the third operand rather than being part of the mnemonic. 1342class AsmCondUnaryRSY<string mnemonic, bits<16> opcode, 1343 RegisterOperand cls, bits<5> bytes, 1344 AddressingMode mode = bdaddr20only> 1345 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2, imm32zx4:$R3), 1346 mnemonic#"\t$R1, $BD2, $R3", []>, 1347 Requires<[FeatureLoadStoreOnCond]> { 1348 let mayLoad = 1; 1349 let AccessBytes = bytes; 1350 let Constraints = "$R1 = $R1src"; 1351 let DisableEncoding = "$R1src"; 1352} 1353 1354// Like CondUnaryRSY, but with a fixed CC mask. 1355class FixedCondUnaryRSY<string mnemonic, bits<16> opcode, 1356 RegisterOperand cls, bits<4> ccmask, bits<5> bytes, 1357 AddressingMode mode = bdaddr20only> 1358 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2), 1359 mnemonic#"\t$R1, $BD2", []>, 1360 Requires<[FeatureLoadStoreOnCond]> { 1361 let Constraints = "$R1 = $R1src"; 1362 let DisableEncoding = "$R1src"; 1363 let R3 = ccmask; 1364 let mayLoad = 1; 1365 let AccessBytes = bytes; 1366} 1367 1368class UnaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1369 RegisterOperand cls, bits<5> bytes, 1370 AddressingMode mode = bdxaddr12only> 1371 : InstRX<opcode, (outs cls:$R1), (ins mode:$XBD2), 1372 mnemonic#"\t$R1, $XBD2", 1373 [(set cls:$R1, (operator mode:$XBD2))]> { 1374 let OpKey = mnemonic ## cls; 1375 let OpType = "mem"; 1376 let mayLoad = 1; 1377 let AccessBytes = bytes; 1378} 1379 1380class UnaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1381 RegisterOperand cls, bits<5> bytes> 1382 : InstRXE<opcode, (outs cls:$R1), (ins bdxaddr12only:$XBD2), 1383 mnemonic#"\t$R1, $XBD2", 1384 [(set cls:$R1, (operator bdxaddr12only:$XBD2))]> { 1385 let OpKey = mnemonic ## cls; 1386 let OpType = "mem"; 1387 let mayLoad = 1; 1388 let AccessBytes = bytes; 1389 let M3 = 0; 1390} 1391 1392class UnaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1393 RegisterOperand cls, bits<5> bytes, 1394 AddressingMode mode = bdxaddr20only> 1395 : InstRXY<opcode, (outs cls:$R1), (ins mode:$XBD2), 1396 mnemonic#"\t$R1, $XBD2", 1397 [(set cls:$R1, (operator mode:$XBD2))]> { 1398 let OpKey = mnemonic ## cls; 1399 let OpType = "mem"; 1400 let mayLoad = 1; 1401 let AccessBytes = bytes; 1402} 1403 1404multiclass UnaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 1405 SDPatternOperator operator, RegisterOperand cls, 1406 bits<5> bytes> { 1407 let DispKey = mnemonic ## #cls in { 1408 let DispSize = "12" in 1409 def "" : UnaryRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>; 1410 let DispSize = "20" in 1411 def Y : UnaryRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes, 1412 bdxaddr20pair>; 1413 } 1414} 1415 1416class UnaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1417 TypedReg tr, Immediate imm, bits<4> type = 0> 1418 : InstVRIa<opcode, (outs tr.op:$V1), (ins imm:$I2), 1419 mnemonic#"\t$V1, $I2", 1420 [(set tr.op:$V1, (tr.vt (operator imm:$I2)))]> { 1421 let M3 = type; 1422} 1423 1424class UnaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1425 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0, 1426 bits<4> m5 = 0> 1427 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2), 1428 mnemonic#"\t$V1, $V2", 1429 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2))))]> { 1430 let M3 = type; 1431 let M4 = m4; 1432 let M5 = m5; 1433} 1434 1435multiclass UnaryVRRaSPair<string mnemonic, bits<16> opcode, 1436 SDPatternOperator operator, 1437 SDPatternOperator operator_cc, TypedReg tr1, 1438 TypedReg tr2, bits<4> type, bits<4> modifier = 0, 1439 bits<4> modifier_cc = 1> { 1440 def "" : UnaryVRRa<mnemonic, opcode, operator, tr1, tr2, type, 0, modifier>; 1441 let Defs = [CC] in 1442 def S : UnaryVRRa<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 0, 1443 modifier_cc>; 1444} 1445 1446class UnaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1447 TypedReg tr, bits<5> bytes, bits<4> type = 0> 1448 : InstVRX<opcode, (outs tr.op:$V1), (ins bdxaddr12only:$XBD2), 1449 mnemonic#"\t$V1, $XBD2", 1450 [(set tr.op:$V1, (tr.vt (operator bdxaddr12only:$XBD2)))]> { 1451 let M3 = type; 1452 let mayLoad = 1; 1453 let AccessBytes = bytes; 1454} 1455 1456class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1457 RegisterOperand cls1, RegisterOperand cls2> 1458 : InstRR<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2), 1459 mnemonic#"r\t$R1, $R2", 1460 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> { 1461 let OpKey = mnemonic ## cls1; 1462 let OpType = "reg"; 1463 let Constraints = "$R1 = $R1src"; 1464 let DisableEncoding = "$R1src"; 1465} 1466 1467class BinaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1468 RegisterOperand cls1, RegisterOperand cls2> 1469 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2), 1470 mnemonic#"r\t$R1, $R2", 1471 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> { 1472 let OpKey = mnemonic ## cls1; 1473 let OpType = "reg"; 1474 let Constraints = "$R1 = $R1src"; 1475 let DisableEncoding = "$R1src"; 1476} 1477 1478class BinaryRRF<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1479 RegisterOperand cls1, RegisterOperand cls2> 1480 : InstRRF<opcode, (outs cls1:$R1), (ins cls1:$R2, cls2:$R3), 1481 mnemonic#"r\t$R1, $R3, $R2", 1482 [(set cls1:$R1, (operator cls1:$R2, cls2:$R3))]> { 1483 let OpKey = mnemonic ## cls1; 1484 let OpType = "reg"; 1485 let R4 = 0; 1486} 1487 1488class BinaryRRFK<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1489 RegisterOperand cls1, RegisterOperand cls2> 1490 : InstRRF<opcode, (outs cls1:$R1), (ins cls1:$R2, cls2:$R3), 1491 mnemonic#"rk\t$R1, $R2, $R3", 1492 [(set cls1:$R1, (operator cls1:$R2, cls2:$R3))]> { 1493 let R4 = 0; 1494} 1495 1496multiclass BinaryRRAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2, 1497 SDPatternOperator operator, RegisterOperand cls1, 1498 RegisterOperand cls2> { 1499 let NumOpsKey = mnemonic in { 1500 let NumOpsValue = "3" in 1501 def K : BinaryRRFK<mnemonic, opcode2, null_frag, cls1, cls2>, 1502 Requires<[FeatureDistinctOps]>; 1503 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in 1504 def "" : BinaryRR<mnemonic, opcode1, operator, cls1, cls2>; 1505 } 1506} 1507 1508multiclass BinaryRREAndK<string mnemonic, bits<16> opcode1, bits<16> opcode2, 1509 SDPatternOperator operator, RegisterOperand cls1, 1510 RegisterOperand cls2> { 1511 let NumOpsKey = mnemonic in { 1512 let NumOpsValue = "3" in 1513 def K : BinaryRRFK<mnemonic, opcode2, null_frag, cls1, cls2>, 1514 Requires<[FeatureDistinctOps]>; 1515 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in 1516 def "" : BinaryRRE<mnemonic, opcode1, operator, cls1, cls2>; 1517 } 1518} 1519 1520class BinaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator, 1521 RegisterOperand cls, Immediate imm> 1522 : InstRI<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 1523 mnemonic#"\t$R1, $I2", 1524 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 1525 let Constraints = "$R1 = $R1src"; 1526 let DisableEncoding = "$R1src"; 1527} 1528 1529class BinaryRIE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1530 RegisterOperand cls, Immediate imm> 1531 : InstRIEd<opcode, (outs cls:$R1), (ins cls:$R3, imm:$I2), 1532 mnemonic#"\t$R1, $R3, $I2", 1533 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>; 1534 1535multiclass BinaryRIAndK<string mnemonic, bits<12> opcode1, bits<16> opcode2, 1536 SDPatternOperator operator, RegisterOperand cls, 1537 Immediate imm> { 1538 let NumOpsKey = mnemonic in { 1539 let NumOpsValue = "3" in 1540 def K : BinaryRIE<mnemonic##"k", opcode2, null_frag, cls, imm>, 1541 Requires<[FeatureDistinctOps]>; 1542 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in 1543 def "" : BinaryRI<mnemonic, opcode1, operator, cls, imm>; 1544 } 1545} 1546 1547class BinaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator, 1548 RegisterOperand cls, Immediate imm> 1549 : InstRIL<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 1550 mnemonic#"\t$R1, $I2", 1551 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 1552 let Constraints = "$R1 = $R1src"; 1553 let DisableEncoding = "$R1src"; 1554} 1555 1556class BinaryRS<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1557 RegisterOperand cls> 1558 : InstRS<opcode, (outs cls:$R1), (ins cls:$R1src, shift12only:$BD2), 1559 mnemonic#"\t$R1, $BD2", 1560 [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> { 1561 let R3 = 0; 1562 let Constraints = "$R1 = $R1src"; 1563 let DisableEncoding = "$R1src"; 1564} 1565 1566class BinaryRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1567 RegisterOperand cls> 1568 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R3, shift20only:$BD2), 1569 mnemonic#"\t$R1, $R3, $BD2", 1570 [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>; 1571 1572multiclass BinaryRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2, 1573 SDPatternOperator operator, RegisterOperand cls> { 1574 let NumOpsKey = mnemonic in { 1575 let NumOpsValue = "3" in 1576 def K : BinaryRSY<mnemonic##"k", opcode2, null_frag, cls>, 1577 Requires<[FeatureDistinctOps]>; 1578 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in 1579 def "" : BinaryRS<mnemonic, opcode1, operator, cls>; 1580 } 1581} 1582 1583class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1584 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 1585 AddressingMode mode = bdxaddr12only> 1586 : InstRX<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2), 1587 mnemonic#"\t$R1, $XBD2", 1588 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> { 1589 let OpKey = mnemonic ## cls; 1590 let OpType = "mem"; 1591 let Constraints = "$R1 = $R1src"; 1592 let DisableEncoding = "$R1src"; 1593 let mayLoad = 1; 1594 let AccessBytes = bytes; 1595} 1596 1597class BinaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1598 RegisterOperand cls, SDPatternOperator load, bits<5> bytes> 1599 : InstRXE<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2), 1600 mnemonic#"\t$R1, $XBD2", 1601 [(set cls:$R1, (operator cls:$R1src, 1602 (load bdxaddr12only:$XBD2)))]> { 1603 let OpKey = mnemonic ## cls; 1604 let OpType = "mem"; 1605 let Constraints = "$R1 = $R1src"; 1606 let DisableEncoding = "$R1src"; 1607 let mayLoad = 1; 1608 let AccessBytes = bytes; 1609 let M3 = 0; 1610} 1611 1612class BinaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1613 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 1614 AddressingMode mode = bdxaddr20only> 1615 : InstRXY<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2), 1616 mnemonic#"\t$R1, $XBD2", 1617 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> { 1618 let OpKey = mnemonic ## cls; 1619 let OpType = "mem"; 1620 let Constraints = "$R1 = $R1src"; 1621 let DisableEncoding = "$R1src"; 1622 let mayLoad = 1; 1623 let AccessBytes = bytes; 1624} 1625 1626multiclass BinaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 1627 SDPatternOperator operator, RegisterOperand cls, 1628 SDPatternOperator load, bits<5> bytes> { 1629 let DispKey = mnemonic ## #cls in { 1630 let DispSize = "12" in 1631 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes, 1632 bdxaddr12pair>; 1633 let DispSize = "20" in 1634 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load, bytes, 1635 bdxaddr20pair>; 1636 } 1637} 1638 1639class BinarySI<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1640 Operand imm, AddressingMode mode = bdaddr12only> 1641 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2), 1642 mnemonic#"\t$BD1, $I2", 1643 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> { 1644 let mayLoad = 1; 1645 let mayStore = 1; 1646} 1647 1648class BinarySIY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1649 Operand imm, AddressingMode mode = bdaddr20only> 1650 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2), 1651 mnemonic#"\t$BD1, $I2", 1652 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> { 1653 let mayLoad = 1; 1654 let mayStore = 1; 1655} 1656 1657multiclass BinarySIPair<string mnemonic, bits<8> siOpcode, 1658 bits<16> siyOpcode, SDPatternOperator operator, 1659 Operand imm> { 1660 let DispKey = mnemonic ## #cls in { 1661 let DispSize = "12" in 1662 def "" : BinarySI<mnemonic, siOpcode, operator, imm, bdaddr12pair>; 1663 let DispSize = "20" in 1664 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>; 1665 } 1666} 1667 1668class BinaryVRIb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1669 TypedReg tr, bits<4> type> 1670 : InstVRIb<opcode, (outs tr.op:$V1), (ins imm32zx8:$I2, imm32zx8:$I3), 1671 mnemonic#"\t$V1, $I2, $I3", 1672 [(set tr.op:$V1, (tr.vt (operator imm32zx8:$I2, imm32zx8:$I3)))]> { 1673 let M4 = type; 1674} 1675 1676class BinaryVRIc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1677 TypedReg tr1, TypedReg tr2, bits<4> type> 1678 : InstVRIc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, imm32zx16:$I2), 1679 mnemonic#"\t$V1, $V3, $I2", 1680 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V3), 1681 imm32zx16:$I2)))]> { 1682 let M4 = type; 1683} 1684 1685class BinaryVRIe<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1686 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5> 1687 : InstVRIe<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx12:$I3), 1688 mnemonic#"\t$V1, $V2, $I3", 1689 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 1690 imm32zx12:$I3)))]> { 1691 let M4 = type; 1692 let M5 = m5; 1693} 1694 1695class BinaryVRRa<string mnemonic, bits<16> opcode> 1696 : InstVRRa<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3), 1697 mnemonic#"\t$V1, $V2, $M3", []> { 1698 let M4 = 0; 1699 let M5 = 0; 1700} 1701 1702class BinaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1703 TypedReg tr1, TypedReg tr2, bits<4> type = 0, 1704 bits<4> modifier = 0> 1705 : InstVRRb<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3), 1706 mnemonic#"\t$V1, $V2, $V3", 1707 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 1708 (tr2.vt tr2.op:$V3))))]> { 1709 let M4 = type; 1710 let M5 = modifier; 1711} 1712 1713// Declare a pair of instructions, one which sets CC and one which doesn't. 1714// The CC-setting form ends with "S" and sets the low bit of M5. 1715multiclass BinaryVRRbSPair<string mnemonic, bits<16> opcode, 1716 SDPatternOperator operator, 1717 SDPatternOperator operator_cc, TypedReg tr1, 1718 TypedReg tr2, bits<4> type, 1719 bits<4> modifier = 0, bits<4> modifier_cc = 1> { 1720 def "" : BinaryVRRb<mnemonic, opcode, operator, tr1, tr2, type, modifier>; 1721 let Defs = [CC] in 1722 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 1723 modifier_cc>; 1724} 1725 1726class BinaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1727 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0, 1728 bits<4> m6 = 0> 1729 : InstVRRc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3), 1730 mnemonic#"\t$V1, $V2, $V3", 1731 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 1732 (tr2.vt tr2.op:$V3))))]> { 1733 let M4 = type; 1734 let M5 = m5; 1735 let M6 = m6; 1736} 1737 1738multiclass BinaryVRRcSPair<string mnemonic, bits<16> opcode, 1739 SDPatternOperator operator, 1740 SDPatternOperator operator_cc, TypedReg tr1, 1741 TypedReg tr2, bits<4> type, bits<4> m5, 1742 bits<4> modifier = 0, bits<4> modifier_cc = 1> { 1743 def "" : BinaryVRRc<mnemonic, opcode, operator, tr1, tr2, type, m5, modifier>; 1744 let Defs = [CC] in 1745 def S : BinaryVRRc<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 1746 m5, modifier_cc>; 1747} 1748 1749class BinaryVRRf<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1750 TypedReg tr> 1751 : InstVRRf<opcode, (outs tr.op:$V1), (ins GR64:$R2, GR64:$R3), 1752 mnemonic#"\t$V1, $R2, $R3", 1753 [(set tr.op:$V1, (tr.vt (operator GR64:$R2, GR64:$R3)))]>; 1754 1755class BinaryVRSa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1756 TypedReg tr1, TypedReg tr2, bits<4> type> 1757 : InstVRSa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, shift12only:$BD2), 1758 mnemonic#"\t$V1, $V3, $BD2", 1759 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V3), 1760 shift12only:$BD2)))]> { 1761 let M4 = type; 1762} 1763 1764class BinaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1765 bits<5> bytes> 1766 : InstVRSb<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2), 1767 mnemonic#"\t$V1, $R3, $BD2", 1768 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> { 1769 let M4 = 0; 1770 let mayLoad = 1; 1771 let AccessBytes = bytes; 1772} 1773 1774class BinaryVRSc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1775 TypedReg tr, bits<4> type> 1776 : InstVRSc<opcode, (outs GR64:$R1), (ins tr.op:$V3, shift12only:$BD2), 1777 mnemonic#"\t$R1, $V3, $BD2", 1778 [(set GR64:$R1, (operator (tr.vt tr.op:$V3), shift12only:$BD2))]> { 1779 let M4 = type; 1780} 1781 1782class BinaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1783 TypedReg tr, bits<5> bytes> 1784 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3), 1785 mnemonic#"\t$V1, $XBD2, $M3", 1786 [(set tr.op:$V1, (tr.vt (operator bdxaddr12only:$XBD2, 1787 imm32zx4:$M3)))]> { 1788 let mayLoad = 1; 1789 let AccessBytes = bytes; 1790} 1791 1792class StoreBinaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes, 1793 Immediate index> 1794 : InstVRV<opcode, (outs), (ins VR128:$V1, bdvaddr12only:$VBD2, index:$M3), 1795 mnemonic#"\t$V1, $VBD2, $M3", []> { 1796 let mayStore = 1; 1797 let AccessBytes = bytes; 1798} 1799 1800class StoreBinaryVRX<string mnemonic, bits<16> opcode, 1801 SDPatternOperator operator, TypedReg tr, bits<5> bytes, 1802 Immediate index> 1803 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2, index:$M3), 1804 mnemonic#"\t$V1, $XBD2, $M3", 1805 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2, index:$M3)]> { 1806 let mayStore = 1; 1807 let AccessBytes = bytes; 1808} 1809 1810class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1811 RegisterOperand cls1, RegisterOperand cls2> 1812 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2), 1813 mnemonic#"r\t$R1, $R2", 1814 [(operator cls1:$R1, cls2:$R2)]> { 1815 let OpKey = mnemonic ## cls1; 1816 let OpType = "reg"; 1817 let isCompare = 1; 1818} 1819 1820class CompareRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1821 RegisterOperand cls1, RegisterOperand cls2> 1822 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2), 1823 mnemonic#"r\t$R1, $R2", 1824 [(operator cls1:$R1, cls2:$R2)]> { 1825 let OpKey = mnemonic ## cls1; 1826 let OpType = "reg"; 1827 let isCompare = 1; 1828} 1829 1830class CompareRI<string mnemonic, bits<12> opcode, SDPatternOperator operator, 1831 RegisterOperand cls, Immediate imm> 1832 : InstRI<opcode, (outs), (ins cls:$R1, imm:$I2), 1833 mnemonic#"\t$R1, $I2", 1834 [(operator cls:$R1, imm:$I2)]> { 1835 let isCompare = 1; 1836} 1837 1838class CompareRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator, 1839 RegisterOperand cls, Immediate imm> 1840 : InstRIL<opcode, (outs), (ins cls:$R1, imm:$I2), 1841 mnemonic#"\t$R1, $I2", 1842 [(operator cls:$R1, imm:$I2)]> { 1843 let isCompare = 1; 1844} 1845 1846class CompareRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator, 1847 RegisterOperand cls, SDPatternOperator load> 1848 : InstRIL<opcode, (outs), (ins cls:$R1, pcrel32:$I2), 1849 mnemonic#"\t$R1, $I2", 1850 [(operator cls:$R1, (load pcrel32:$I2))]> { 1851 let isCompare = 1; 1852 let mayLoad = 1; 1853 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 1854 // However, BDXs have two extra operands and are therefore 6 units more 1855 // complex. 1856 let AddedComplexity = 7; 1857} 1858 1859class CompareRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1860 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 1861 AddressingMode mode = bdxaddr12only> 1862 : InstRX<opcode, (outs), (ins cls:$R1, mode:$XBD2), 1863 mnemonic#"\t$R1, $XBD2", 1864 [(operator cls:$R1, (load mode:$XBD2))]> { 1865 let OpKey = mnemonic ## cls; 1866 let OpType = "mem"; 1867 let isCompare = 1; 1868 let mayLoad = 1; 1869 let AccessBytes = bytes; 1870} 1871 1872class CompareRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1873 RegisterOperand cls, SDPatternOperator load, bits<5> bytes> 1874 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2), 1875 mnemonic#"\t$R1, $XBD2", 1876 [(operator cls:$R1, (load bdxaddr12only:$XBD2))]> { 1877 let OpKey = mnemonic ## cls; 1878 let OpType = "mem"; 1879 let isCompare = 1; 1880 let mayLoad = 1; 1881 let AccessBytes = bytes; 1882 let M3 = 0; 1883} 1884 1885class CompareRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1886 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 1887 AddressingMode mode = bdxaddr20only> 1888 : InstRXY<opcode, (outs), (ins cls:$R1, mode:$XBD2), 1889 mnemonic#"\t$R1, $XBD2", 1890 [(operator cls:$R1, (load mode:$XBD2))]> { 1891 let OpKey = mnemonic ## cls; 1892 let OpType = "mem"; 1893 let isCompare = 1; 1894 let mayLoad = 1; 1895 let AccessBytes = bytes; 1896} 1897 1898multiclass CompareRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 1899 SDPatternOperator operator, RegisterOperand cls, 1900 SDPatternOperator load, bits<5> bytes> { 1901 let DispKey = mnemonic ## #cls in { 1902 let DispSize = "12" in 1903 def "" : CompareRX<mnemonic, rxOpcode, operator, cls, 1904 load, bytes, bdxaddr12pair>; 1905 let DispSize = "20" in 1906 def Y : CompareRXY<mnemonic#"y", rxyOpcode, operator, cls, 1907 load, bytes, bdxaddr20pair>; 1908 } 1909} 1910 1911class CompareSI<string mnemonic, bits<8> opcode, SDPatternOperator operator, 1912 SDPatternOperator load, Immediate imm, 1913 AddressingMode mode = bdaddr12only> 1914 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2), 1915 mnemonic#"\t$BD1, $I2", 1916 [(operator (load mode:$BD1), imm:$I2)]> { 1917 let isCompare = 1; 1918 let mayLoad = 1; 1919} 1920 1921class CompareSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1922 SDPatternOperator load, Immediate imm> 1923 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2), 1924 mnemonic#"\t$BD1, $I2", 1925 [(operator (load bdaddr12only:$BD1), imm:$I2)]> { 1926 let isCompare = 1; 1927 let mayLoad = 1; 1928} 1929 1930class CompareSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1931 SDPatternOperator load, Immediate imm, 1932 AddressingMode mode = bdaddr20only> 1933 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2), 1934 mnemonic#"\t$BD1, $I2", 1935 [(operator (load mode:$BD1), imm:$I2)]> { 1936 let isCompare = 1; 1937 let mayLoad = 1; 1938} 1939 1940multiclass CompareSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode, 1941 SDPatternOperator operator, SDPatternOperator load, 1942 Immediate imm> { 1943 let DispKey = mnemonic in { 1944 let DispSize = "12" in 1945 def "" : CompareSI<mnemonic, siOpcode, operator, load, imm, bdaddr12pair>; 1946 let DispSize = "20" in 1947 def Y : CompareSIY<mnemonic#"y", siyOpcode, operator, load, imm, 1948 bdaddr20pair>; 1949 } 1950} 1951 1952class CompareVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1953 TypedReg tr, bits<4> type> 1954 : InstVRRa<opcode, (outs), (ins tr.op:$V1, tr.op:$V2), 1955 mnemonic#"\t$V1, $V2", 1956 [(operator (tr.vt tr.op:$V1), (tr.vt tr.op:$V2))]> { 1957 let isCompare = 1; 1958 let M3 = type; 1959 let M4 = 0; 1960 let M5 = 0; 1961} 1962 1963class TestRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1964 RegisterOperand cls> 1965 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2), 1966 mnemonic#"\t$R1, $XBD2", 1967 [(operator cls:$R1, bdxaddr12only:$XBD2)]> { 1968 let M3 = 0; 1969} 1970 1971class TernaryRRD<string mnemonic, bits<16> opcode, 1972 SDPatternOperator operator, RegisterOperand cls> 1973 : InstRRD<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, cls:$R2), 1974 mnemonic#"r\t$R1, $R3, $R2", 1975 [(set cls:$R1, (operator cls:$R1src, cls:$R3, cls:$R2))]> { 1976 let OpKey = mnemonic ## cls; 1977 let OpType = "reg"; 1978 let Constraints = "$R1 = $R1src"; 1979 let DisableEncoding = "$R1src"; 1980} 1981 1982class TernaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1983 RegisterOperand cls, SDPatternOperator load, bits<5> bytes> 1984 : InstRXF<opcode, (outs cls:$R1), 1985 (ins cls:$R1src, cls:$R3, bdxaddr12only:$XBD2), 1986 mnemonic#"\t$R1, $R3, $XBD2", 1987 [(set cls:$R1, (operator cls:$R1src, cls:$R3, 1988 (load bdxaddr12only:$XBD2)))]> { 1989 let OpKey = mnemonic ## cls; 1990 let OpType = "mem"; 1991 let Constraints = "$R1 = $R1src"; 1992 let DisableEncoding = "$R1src"; 1993 let mayLoad = 1; 1994 let AccessBytes = bytes; 1995} 1996 1997class TernaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 1998 TypedReg tr1, TypedReg tr2, Immediate imm, Immediate index> 1999 : InstVRIa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V1src, imm:$I2, index:$M3), 2000 mnemonic#"\t$V1, $I2, $M3", 2001 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src), 2002 imm:$I2, index:$M3)))]> { 2003 let Constraints = "$V1 = $V1src"; 2004 let DisableEncoding = "$V1src"; 2005} 2006 2007class TernaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2008 TypedReg tr1, TypedReg tr2, bits<4> type> 2009 : InstVRId<opcode, (outs tr1.op:$V1), 2010 (ins tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4), 2011 mnemonic#"\t$V1, $V2, $V3, $I4", 2012 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 2013 (tr2.vt tr2.op:$V3), 2014 imm32zx8:$I4)))]> { 2015 let M5 = type; 2016} 2017 2018class TernaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2019 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m4or> 2020 : InstVRRa<opcode, (outs tr1.op:$V1), 2021 (ins tr2.op:$V2, imm32zx4:$M4, imm32zx4:$M5), 2022 mnemonic#"\t$V1, $V2, $M4, $M5", 2023 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 2024 imm32zx4:$M4, 2025 imm32zx4:$M5)))], 2026 m4or> { 2027 let M3 = type; 2028} 2029 2030class TernaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2031 TypedReg tr1, TypedReg tr2, bits<4> type, 2032 SDPatternOperator m5mask, bits<4> m5or> 2033 : InstVRRb<opcode, (outs tr1.op:$V1), 2034 (ins tr2.op:$V2, tr2.op:$V3, m5mask:$M5), 2035 mnemonic#"\t$V1, $V2, $V3, $M5", 2036 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 2037 (tr2.vt tr2.op:$V3), 2038 m5mask:$M5)))], 2039 m5or> { 2040 let M4 = type; 2041} 2042 2043multiclass TernaryVRRbSPair<string mnemonic, bits<16> opcode, 2044 SDPatternOperator operator, 2045 SDPatternOperator operator_cc, TypedReg tr1, 2046 TypedReg tr2, bits<4> type, bits<4> m5or> { 2047 def "" : TernaryVRRb<mnemonic, opcode, operator, tr1, tr2, type, 2048 imm32zx4even, !and (m5or, 14)>; 2049 def : InstAlias<mnemonic#"\t$V1, $V2, $V3", 2050 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 2051 tr2.op:$V3, 0)>; 2052 let Defs = [CC] in 2053 def S : TernaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 2054 imm32zx4even, !add(!and (m5or, 14), 1)>; 2055 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3", 2056 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2, 2057 tr2.op:$V3, 0)>; 2058} 2059 2060class TernaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2061 TypedReg tr1, TypedReg tr2> 2062 : InstVRRc<opcode, (outs tr1.op:$V1), 2063 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M4), 2064 mnemonic#"\t$V1, $V2, $V3, $M4", 2065 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 2066 (tr2.vt tr2.op:$V3), 2067 imm32zx4:$M4)))]> { 2068 let M5 = 0; 2069 let M6 = 0; 2070} 2071 2072class TernaryVRRd<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2073 TypedReg tr1, TypedReg tr2, bits<4> type = 0> 2074 : InstVRRd<opcode, (outs tr1.op:$V1), 2075 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4), 2076 mnemonic#"\t$V1, $V2, $V3, $V4", 2077 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 2078 (tr2.vt tr2.op:$V3), 2079 (tr1.vt tr1.op:$V4))))]> { 2080 let M5 = type; 2081 let M6 = 0; 2082} 2083 2084class TernaryVRRe<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2085 TypedReg tr1, TypedReg tr2, bits<4> m5 = 0, bits<4> type = 0> 2086 : InstVRRe<opcode, (outs tr1.op:$V1), 2087 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4), 2088 mnemonic#"\t$V1, $V2, $V3, $V4", 2089 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 2090 (tr2.vt tr2.op:$V3), 2091 (tr1.vt tr1.op:$V4))))]> { 2092 let M5 = m5; 2093 let M6 = type; 2094} 2095 2096class TernaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2097 TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type> 2098 : InstVRSb<opcode, (outs tr1.op:$V1), 2099 (ins tr2.op:$V1src, cls:$R3, shift12only:$BD2), 2100 mnemonic#"\t$V1, $R3, $BD2", 2101 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src), 2102 cls:$R3, 2103 shift12only:$BD2)))]> { 2104 let Constraints = "$V1 = $V1src"; 2105 let DisableEncoding = "$V1src"; 2106 let M4 = type; 2107} 2108 2109class TernaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes, 2110 Immediate index> 2111 : InstVRV<opcode, (outs VR128:$V1), 2112 (ins VR128:$V1src, bdvaddr12only:$VBD2, index:$M3), 2113 mnemonic#"\t$V1, $VBD2, $M3", []> { 2114 let Constraints = "$V1 = $V1src"; 2115 let DisableEncoding = "$V1src"; 2116 let mayLoad = 1; 2117 let AccessBytes = bytes; 2118} 2119 2120class TernaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2121 TypedReg tr1, TypedReg tr2, bits<5> bytes, Immediate index> 2122 : InstVRX<opcode, (outs tr1.op:$V1), 2123 (ins tr2.op:$V1src, bdxaddr12only:$XBD2, index:$M3), 2124 mnemonic#"\t$V1, $XBD2, $M3", 2125 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src), 2126 bdxaddr12only:$XBD2, 2127 index:$M3)))]> { 2128 let Constraints = "$V1 = $V1src"; 2129 let DisableEncoding = "$V1src"; 2130 let mayLoad = 1; 2131 let AccessBytes = bytes; 2132} 2133 2134class QuaternaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2135 TypedReg tr1, TypedReg tr2, bits<4> type> 2136 : InstVRId<opcode, (outs tr1.op:$V1), 2137 (ins tr2.op:$V1src, tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4), 2138 mnemonic#"\t$V1, $V2, $V3, $I4", 2139 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src), 2140 (tr2.vt tr2.op:$V2), 2141 (tr2.vt tr2.op:$V3), 2142 imm32zx8:$I4)))]> { 2143 let Constraints = "$V1 = $V1src"; 2144 let DisableEncoding = "$V1src"; 2145 let M5 = type; 2146} 2147 2148class QuaternaryVRRd<string mnemonic, bits<16> opcode, 2149 SDPatternOperator operator, TypedReg tr1, TypedReg tr2, 2150 bits<4> type, SDPatternOperator m6mask, bits<4> m6or> 2151 : InstVRRd<opcode, (outs tr1.op:$V1), 2152 (ins tr2.op:$V2, tr2.op:$V3, tr2.op:$V4, m6mask:$M6), 2153 mnemonic#"\t$V1, $V2, $V3, $V4, $M6", 2154 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 2155 (tr2.vt tr2.op:$V3), 2156 (tr2.vt tr2.op:$V4), 2157 m6mask:$M6)))], 2158 m6or> { 2159 let M5 = type; 2160} 2161 2162multiclass QuaternaryVRRdSPair<string mnemonic, bits<16> opcode, 2163 SDPatternOperator operator, 2164 SDPatternOperator operator_cc, TypedReg tr1, 2165 TypedReg tr2, bits<4> type, bits<4> m6or> { 2166 def "" : QuaternaryVRRd<mnemonic, opcode, operator, tr1, tr2, type, 2167 imm32zx4even, !and (m6or, 14)>; 2168 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4", 2169 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 2170 tr2.op:$V3, tr2.op:$V4, 0)>; 2171 let Defs = [CC] in 2172 def S : QuaternaryVRRd<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 2173 imm32zx4even, !add (!and (m6or, 14), 1)>; 2174 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3, $V4", 2175 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2, 2176 tr2.op:$V3, tr2.op:$V4, 0)>; 2177} 2178 2179class LoadAndOpRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2180 RegisterOperand cls, AddressingMode mode = bdaddr20only> 2181 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R3, mode:$BD2), 2182 mnemonic#"\t$R1, $R3, $BD2", 2183 [(set cls:$R1, (operator mode:$BD2, cls:$R3))]> { 2184 let mayLoad = 1; 2185 let mayStore = 1; 2186} 2187 2188class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2189 RegisterOperand cls, AddressingMode mode = bdaddr12only> 2190 : InstRS<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2), 2191 mnemonic#"\t$R1, $R3, $BD2", 2192 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> { 2193 let Constraints = "$R1 = $R1src"; 2194 let DisableEncoding = "$R1src"; 2195 let mayLoad = 1; 2196 let mayStore = 1; 2197} 2198 2199class CmpSwapRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2200 RegisterOperand cls, AddressingMode mode = bdaddr20only> 2201 : InstRSY<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2), 2202 mnemonic#"\t$R1, $R3, $BD2", 2203 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> { 2204 let Constraints = "$R1 = $R1src"; 2205 let DisableEncoding = "$R1src"; 2206 let mayLoad = 1; 2207 let mayStore = 1; 2208} 2209 2210multiclass CmpSwapRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode, 2211 SDPatternOperator operator, RegisterOperand cls> { 2212 let DispKey = mnemonic ## #cls in { 2213 let DispSize = "12" in 2214 def "" : CmpSwapRS<mnemonic, rsOpcode, operator, cls, bdaddr12pair>; 2215 let DispSize = "20" in 2216 def Y : CmpSwapRSY<mnemonic#"y", rsyOpcode, operator, cls, bdaddr20pair>; 2217 } 2218} 2219 2220class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1, 2221 RegisterOperand cls2> 2222 : InstRIEf<opcode, (outs cls1:$R1), 2223 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, 2224 imm32zx6:$I5), 2225 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> { 2226 let Constraints = "$R1 = $R1src"; 2227 let DisableEncoding = "$R1src"; 2228} 2229 2230class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator> 2231 : InstRXY<opcode, (outs), (ins imm32zx4:$R1, bdxaddr20only:$XBD2), 2232 mnemonic##"\t$R1, $XBD2", 2233 [(operator imm32zx4:$R1, bdxaddr20only:$XBD2)]>; 2234 2235class PrefetchRILPC<string mnemonic, bits<12> opcode, 2236 SDPatternOperator operator> 2237 : InstRIL<opcode, (outs), (ins imm32zx4:$R1, pcrel32:$I2), 2238 mnemonic##"\t$R1, $I2", 2239 [(operator imm32zx4:$R1, pcrel32:$I2)]> { 2240 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 2241 // However, BDXs have two extra operands and are therefore 6 units more 2242 // complex. 2243 let AddedComplexity = 7; 2244} 2245 2246// A floating-point load-and test operation. Create both a normal unary 2247// operation and one that acts as a comparison against zero. 2248// Note that the comparison against zero operation is not available if we 2249// have vector support, since load-and-test instructions will partially 2250// clobber the target (vector) register. 2251multiclass LoadAndTestRRE<string mnemonic, bits<16> opcode, 2252 RegisterOperand cls> { 2253 def "" : UnaryRRE<mnemonic, opcode, null_frag, cls, cls>; 2254 let isCodeGenOnly = 1, Predicates = [FeatureNoVector] in 2255 def Compare : CompareRRE<mnemonic, opcode, null_frag, cls, cls>; 2256} 2257 2258//===----------------------------------------------------------------------===// 2259// Pseudo instructions 2260//===----------------------------------------------------------------------===// 2261// 2262// Convenience instructions that get lowered to real instructions 2263// by either SystemZTargetLowering::EmitInstrWithCustomInserter() 2264// or SystemZInstrInfo::expandPostRAPseudo(). 2265// 2266//===----------------------------------------------------------------------===// 2267 2268class Pseudo<dag outs, dag ins, list<dag> pattern> 2269 : InstSystemZ<0, outs, ins, "", pattern> { 2270 let isPseudo = 1; 2271 let isCodeGenOnly = 1; 2272} 2273 2274// Like UnaryRI, but expanded after RA depending on the choice of register. 2275class UnaryRIPseudo<SDPatternOperator operator, RegisterOperand cls, 2276 Immediate imm> 2277 : Pseudo<(outs cls:$R1), (ins imm:$I2), 2278 [(set cls:$R1, (operator imm:$I2))]>; 2279 2280// Like UnaryRXY, but expanded after RA depending on the choice of register. 2281class UnaryRXYPseudo<string key, SDPatternOperator operator, 2282 RegisterOperand cls, bits<5> bytes, 2283 AddressingMode mode = bdxaddr20only> 2284 : Pseudo<(outs cls:$R1), (ins mode:$XBD2), 2285 [(set cls:$R1, (operator mode:$XBD2))]> { 2286 let OpKey = key ## cls; 2287 let OpType = "mem"; 2288 let mayLoad = 1; 2289 let Has20BitOffset = 1; 2290 let HasIndex = 1; 2291 let AccessBytes = bytes; 2292} 2293 2294// Like UnaryRR, but expanded after RA depending on the choice of registers. 2295class UnaryRRPseudo<string key, SDPatternOperator operator, 2296 RegisterOperand cls1, RegisterOperand cls2> 2297 : Pseudo<(outs cls1:$R1), (ins cls2:$R2), 2298 [(set cls1:$R1, (operator cls2:$R2))]> { 2299 let OpKey = key ## cls1; 2300 let OpType = "reg"; 2301} 2302 2303// Like BinaryRI, but expanded after RA depending on the choice of register. 2304class BinaryRIPseudo<SDPatternOperator operator, RegisterOperand cls, 2305 Immediate imm> 2306 : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2), 2307 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 2308 let Constraints = "$R1 = $R1src"; 2309} 2310 2311// Like BinaryRIE, but expanded after RA depending on the choice of register. 2312class BinaryRIEPseudo<SDPatternOperator operator, RegisterOperand cls, 2313 Immediate imm> 2314 : Pseudo<(outs cls:$R1), (ins cls:$R3, imm:$I2), 2315 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>; 2316 2317// Like BinaryRIAndK, but expanded after RA depending on the choice of register. 2318multiclass BinaryRIAndKPseudo<string key, SDPatternOperator operator, 2319 RegisterOperand cls, Immediate imm> { 2320 let NumOpsKey = key in { 2321 let NumOpsValue = "3" in 2322 def K : BinaryRIEPseudo<null_frag, cls, imm>, 2323 Requires<[FeatureHighWord, FeatureDistinctOps]>; 2324 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in 2325 def "" : BinaryRIPseudo<operator, cls, imm>, 2326 Requires<[FeatureHighWord]>; 2327 } 2328} 2329 2330// Like CompareRI, but expanded after RA depending on the choice of register. 2331class CompareRIPseudo<SDPatternOperator operator, RegisterOperand cls, 2332 Immediate imm> 2333 : Pseudo<(outs), (ins cls:$R1, imm:$I2), [(operator cls:$R1, imm:$I2)]>; 2334 2335// Like CompareRXY, but expanded after RA depending on the choice of register. 2336class CompareRXYPseudo<SDPatternOperator operator, RegisterOperand cls, 2337 SDPatternOperator load, bits<5> bytes, 2338 AddressingMode mode = bdxaddr20only> 2339 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2), 2340 [(operator cls:$R1, (load mode:$XBD2))]> { 2341 let mayLoad = 1; 2342 let Has20BitOffset = 1; 2343 let HasIndex = 1; 2344 let AccessBytes = bytes; 2345} 2346 2347// Like StoreRXY, but expanded after RA depending on the choice of register. 2348class StoreRXYPseudo<SDPatternOperator operator, RegisterOperand cls, 2349 bits<5> bytes, AddressingMode mode = bdxaddr20only> 2350 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2), 2351 [(operator cls:$R1, mode:$XBD2)]> { 2352 let mayStore = 1; 2353 let Has20BitOffset = 1; 2354 let HasIndex = 1; 2355 let AccessBytes = bytes; 2356} 2357 2358// Like RotateSelectRIEf, but expanded after RA depending on the choice 2359// of registers. 2360class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2> 2361 : Pseudo<(outs cls1:$R1), 2362 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, 2363 imm32zx6:$I5), 2364 []> { 2365 let Constraints = "$R1 = $R1src"; 2366 let DisableEncoding = "$R1src"; 2367} 2368 2369// Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is 2370// the value of the PSW's 2-bit condition code field. 2371class SelectWrapper<RegisterOperand cls> 2372 : Pseudo<(outs cls:$dst), 2373 (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc), 2374 [(set cls:$dst, (z_select_ccmask cls:$src1, cls:$src2, 2375 imm32zx4:$valid, imm32zx4:$cc))]> { 2376 let usesCustomInserter = 1; 2377 // Although the instructions used by these nodes do not in themselves 2378 // change CC, the insertion requires new blocks, and CC cannot be live 2379 // across them. 2380 let Defs = [CC]; 2381 let Uses = [CC]; 2382} 2383 2384// Stores $new to $addr if $cc is true ("" case) or false (Inv case). 2385multiclass CondStores<RegisterOperand cls, SDPatternOperator store, 2386 SDPatternOperator load, AddressingMode mode> { 2387 let Defs = [CC], Uses = [CC], usesCustomInserter = 1 in { 2388 def "" : Pseudo<(outs), 2389 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc), 2390 [(store (z_select_ccmask cls:$new, (load mode:$addr), 2391 imm32zx4:$valid, imm32zx4:$cc), 2392 mode:$addr)]>; 2393 def Inv : Pseudo<(outs), 2394 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc), 2395 [(store (z_select_ccmask (load mode:$addr), cls:$new, 2396 imm32zx4:$valid, imm32zx4:$cc), 2397 mode:$addr)]>; 2398 } 2399} 2400 2401// OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation. PAT and OPERAND 2402// describe the second (non-memory) operand. 2403class AtomicLoadBinary<SDPatternOperator operator, RegisterOperand cls, 2404 dag pat, DAGOperand operand> 2405 : Pseudo<(outs cls:$dst), (ins bdaddr20only:$ptr, operand:$src2), 2406 [(set cls:$dst, (operator bdaddr20only:$ptr, pat))]> { 2407 let Defs = [CC]; 2408 let Has20BitOffset = 1; 2409 let mayLoad = 1; 2410 let mayStore = 1; 2411 let usesCustomInserter = 1; 2412} 2413 2414// Specializations of AtomicLoadWBinary. 2415class AtomicLoadBinaryReg32<SDPatternOperator operator> 2416 : AtomicLoadBinary<operator, GR32, (i32 GR32:$src2), GR32>; 2417class AtomicLoadBinaryImm32<SDPatternOperator operator, Immediate imm> 2418 : AtomicLoadBinary<operator, GR32, (i32 imm:$src2), imm>; 2419class AtomicLoadBinaryReg64<SDPatternOperator operator> 2420 : AtomicLoadBinary<operator, GR64, (i64 GR64:$src2), GR64>; 2421class AtomicLoadBinaryImm64<SDPatternOperator operator, Immediate imm> 2422 : AtomicLoadBinary<operator, GR64, (i64 imm:$src2), imm>; 2423 2424// OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation. PAT and OPERAND 2425// describe the second (non-memory) operand. 2426class AtomicLoadWBinary<SDPatternOperator operator, dag pat, 2427 DAGOperand operand> 2428 : Pseudo<(outs GR32:$dst), 2429 (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift, 2430 ADDR32:$negbitshift, uimm32:$bitsize), 2431 [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift, 2432 ADDR32:$negbitshift, uimm32:$bitsize))]> { 2433 let Defs = [CC]; 2434 let Has20BitOffset = 1; 2435 let mayLoad = 1; 2436 let mayStore = 1; 2437 let usesCustomInserter = 1; 2438} 2439 2440// Specializations of AtomicLoadWBinary. 2441class AtomicLoadWBinaryReg<SDPatternOperator operator> 2442 : AtomicLoadWBinary<operator, (i32 GR32:$src2), GR32>; 2443class AtomicLoadWBinaryImm<SDPatternOperator operator, Immediate imm> 2444 : AtomicLoadWBinary<operator, (i32 imm:$src2), imm>; 2445 2446// Define an instruction that operates on two fixed-length blocks of memory, 2447// and associated pseudo instructions for operating on blocks of any size. 2448// The Sequence form uses a straight-line sequence of instructions and 2449// the Loop form uses a loop of length-256 instructions followed by 2450// another instruction to handle the excess. 2451multiclass MemorySS<string mnemonic, bits<8> opcode, 2452 SDPatternOperator sequence, SDPatternOperator loop> { 2453 def "" : InstSS<opcode, (outs), (ins bdladdr12onlylen8:$BDL1, 2454 bdaddr12only:$BD2), 2455 mnemonic##"\t$BDL1, $BD2", []>; 2456 let usesCustomInserter = 1 in { 2457 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, 2458 imm64:$length), 2459 [(sequence bdaddr12only:$dest, bdaddr12only:$src, 2460 imm64:$length)]>; 2461 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, 2462 imm64:$length, GR64:$count256), 2463 [(loop bdaddr12only:$dest, bdaddr12only:$src, 2464 imm64:$length, GR64:$count256)]>; 2465 } 2466} 2467 2468// Define an instruction that operates on two strings, both terminated 2469// by the character in R0. The instruction processes a CPU-determinated 2470// number of bytes at a time and sets CC to 3 if the instruction needs 2471// to be repeated. Also define a pseudo instruction that represents 2472// the full loop (the main instruction plus the branch on CC==3). 2473multiclass StringRRE<string mnemonic, bits<16> opcode, 2474 SDPatternOperator operator> { 2475 def "" : InstRRE<opcode, (outs GR64:$R1, GR64:$R2), 2476 (ins GR64:$R1src, GR64:$R2src), 2477 mnemonic#"\t$R1, $R2", []> { 2478 let Uses = [R0L]; 2479 let Constraints = "$R1 = $R1src, $R2 = $R2src"; 2480 let DisableEncoding = "$R1src, $R2src"; 2481 } 2482 let usesCustomInserter = 1 in 2483 def Loop : Pseudo<(outs GR64:$end), 2484 (ins GR64:$start1, GR64:$start2, GR32:$char), 2485 [(set GR64:$end, (operator GR64:$start1, GR64:$start2, 2486 GR32:$char))]>; 2487} 2488 2489// A pseudo instruction that is a direct alias of a real instruction. 2490// These aliases are used in cases where a particular register operand is 2491// fixed or where the same instruction is used with different register sizes. 2492// The size parameter is the size in bytes of the associated real instruction. 2493class Alias<int size, dag outs, dag ins, list<dag> pattern> 2494 : InstSystemZ<size, outs, ins, "", pattern> { 2495 let isPseudo = 1; 2496 let isCodeGenOnly = 1; 2497} 2498 2499class UnaryAliasVRS<RegisterOperand cls1, RegisterOperand cls2> 2500 : Alias<6, (outs cls1:$src1), (ins cls2:$src2), []>; 2501 2502// An alias of a UnaryVRR*, but with different register sizes. 2503class UnaryAliasVRR<SDPatternOperator operator, TypedReg tr1, TypedReg tr2> 2504 : Alias<6, (outs tr1.op:$V1), (ins tr2.op:$V2), 2505 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2))))]>; 2506 2507// An alias of a UnaryVRX, but with different register sizes. 2508class UnaryAliasVRX<SDPatternOperator operator, TypedReg tr, 2509 AddressingMode mode = bdxaddr12only> 2510 : Alias<6, (outs tr.op:$V1), (ins mode:$XBD2), 2511 [(set tr.op:$V1, (tr.vt (operator mode:$XBD2)))]>; 2512 2513// An alias of a StoreVRX, but with different register sizes. 2514class StoreAliasVRX<SDPatternOperator operator, TypedReg tr, 2515 AddressingMode mode = bdxaddr12only> 2516 : Alias<6, (outs), (ins tr.op:$V1, mode:$XBD2), 2517 [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>; 2518 2519// An alias of a BinaryRI, but with different register sizes. 2520class BinaryAliasRI<SDPatternOperator operator, RegisterOperand cls, 2521 Immediate imm> 2522 : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 2523 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 2524 let Constraints = "$R1 = $R1src"; 2525} 2526 2527// An alias of a BinaryRIL, but with different register sizes. 2528class BinaryAliasRIL<SDPatternOperator operator, RegisterOperand cls, 2529 Immediate imm> 2530 : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 2531 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 2532 let Constraints = "$R1 = $R1src"; 2533} 2534 2535// An alias of a BinaryVRRf, but with different register sizes. 2536class BinaryAliasVRRf<RegisterOperand cls> 2537 : Alias<6, (outs VR128:$V1), (ins cls:$R2, cls:$R3), []>; 2538 2539// An alias of a CompareRI, but with different register sizes. 2540class CompareAliasRI<SDPatternOperator operator, RegisterOperand cls, 2541 Immediate imm> 2542 : Alias<4, (outs), (ins cls:$R1, imm:$I2), [(operator cls:$R1, imm:$I2)]> { 2543 let isCompare = 1; 2544} 2545 2546// An alias of a RotateSelectRIEf, but with different register sizes. 2547class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2> 2548 : Alias<6, (outs cls1:$R1), 2549 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, 2550 imm32zx6:$I5), []> { 2551 let Constraints = "$R1 = $R1src"; 2552} 2553