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>R, 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 InstE<bits<16> 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 let Inst = op; 167} 168 169class InstI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 170 : InstSystemZ<2, outs, ins, asmstr, pattern> { 171 field bits<16> Inst; 172 field bits<16> SoftFail = 0; 173 174 bits<8> I1; 175 176 let Inst{15-8} = op; 177 let Inst{7-0} = I1; 178} 179 180class InstIE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 181 : InstSystemZ<4, outs, ins, asmstr, pattern> { 182 field bits<32> Inst; 183 field bits<32> SoftFail = 0; 184 185 bits<4> I1; 186 bits<4> I2; 187 188 let Inst{31-16} = op; 189 let Inst{15-8} = 0; 190 let Inst{7-4} = I1; 191 let Inst{3-0} = I2; 192} 193 194class InstMII<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 195 : InstSystemZ<6, outs, ins, asmstr, pattern> { 196 field bits<48> Inst; 197 field bits<48> SoftFail = 0; 198 199 bits<4> M1; 200 bits<12> RI2; 201 bits<24> RI3; 202 203 let Inst{47-40} = op; 204 let Inst{39-36} = M1; 205 let Inst{35-24} = RI2; 206 let Inst{23-0} = RI3; 207} 208 209class InstRIa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern> 210 : InstSystemZ<4, outs, ins, asmstr, pattern> { 211 field bits<32> Inst; 212 field bits<32> SoftFail = 0; 213 214 bits<4> R1; 215 bits<16> I2; 216 217 let Inst{31-24} = op{11-4}; 218 let Inst{23-20} = R1; 219 let Inst{19-16} = op{3-0}; 220 let Inst{15-0} = I2; 221} 222 223class InstRIb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern> 224 : InstSystemZ<4, outs, ins, asmstr, pattern> { 225 field bits<32> Inst; 226 field bits<32> SoftFail = 0; 227 228 bits<4> R1; 229 bits<16> RI2; 230 231 let Inst{31-24} = op{11-4}; 232 let Inst{23-20} = R1; 233 let Inst{19-16} = op{3-0}; 234 let Inst{15-0} = RI2; 235} 236 237class InstRIc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern> 238 : InstSystemZ<4, outs, ins, asmstr, pattern> { 239 field bits<32> Inst; 240 field bits<32> SoftFail = 0; 241 242 bits<4> M1; 243 bits<16> RI2; 244 245 let Inst{31-24} = op{11-4}; 246 let Inst{23-20} = M1; 247 let Inst{19-16} = op{3-0}; 248 let Inst{15-0} = RI2; 249} 250 251class InstRIEa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 252 : InstSystemZ<6, outs, ins, asmstr, pattern> { 253 field bits<48> Inst; 254 field bits<48> SoftFail = 0; 255 256 bits<4> R1; 257 bits<16> I2; 258 bits<4> M3; 259 260 let Inst{47-40} = op{15-8}; 261 let Inst{39-36} = R1; 262 let Inst{35-32} = 0; 263 let Inst{31-16} = I2; 264 let Inst{15-12} = M3; 265 let Inst{11-8} = 0; 266 let Inst{7-0} = op{7-0}; 267} 268 269class InstRIEb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 270 : InstSystemZ<6, outs, ins, asmstr, pattern> { 271 field bits<48> Inst; 272 field bits<48> SoftFail = 0; 273 274 bits<4> R1; 275 bits<4> R2; 276 bits<4> M3; 277 bits<16> RI4; 278 279 let Inst{47-40} = op{15-8}; 280 let Inst{39-36} = R1; 281 let Inst{35-32} = R2; 282 let Inst{31-16} = RI4; 283 let Inst{15-12} = M3; 284 let Inst{11-8} = 0; 285 let Inst{7-0} = op{7-0}; 286} 287 288class InstRIEc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 289 : InstSystemZ<6, outs, ins, asmstr, pattern> { 290 field bits<48> Inst; 291 field bits<48> SoftFail = 0; 292 293 bits<4> R1; 294 bits<8> I2; 295 bits<4> M3; 296 bits<16> RI4; 297 298 let Inst{47-40} = op{15-8}; 299 let Inst{39-36} = R1; 300 let Inst{35-32} = M3; 301 let Inst{31-16} = RI4; 302 let Inst{15-8} = I2; 303 let Inst{7-0} = op{7-0}; 304} 305 306class InstRIEd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 307 : InstSystemZ<6, outs, ins, asmstr, pattern> { 308 field bits<48> Inst; 309 field bits<48> SoftFail = 0; 310 311 bits<4> R1; 312 bits<4> R3; 313 bits<16> I2; 314 315 let Inst{47-40} = op{15-8}; 316 let Inst{39-36} = R1; 317 let Inst{35-32} = R3; 318 let Inst{31-16} = I2; 319 let Inst{15-8} = 0; 320 let Inst{7-0} = op{7-0}; 321} 322 323class InstRIEe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 324 : InstSystemZ<6, outs, ins, asmstr, pattern> { 325 field bits<48> Inst; 326 field bits<48> SoftFail = 0; 327 328 bits<4> R1; 329 bits<4> R3; 330 bits<16> RI2; 331 332 let Inst{47-40} = op{15-8}; 333 let Inst{39-36} = R1; 334 let Inst{35-32} = R3; 335 let Inst{31-16} = RI2; 336 let Inst{15-8} = 0; 337 let Inst{7-0} = op{7-0}; 338} 339 340class InstRIEf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 341 : InstSystemZ<6, outs, ins, asmstr, pattern> { 342 field bits<48> Inst; 343 field bits<48> SoftFail = 0; 344 345 bits<4> R1; 346 bits<4> R2; 347 bits<8> I3; 348 bits<8> I4; 349 bits<8> I5; 350 351 let Inst{47-40} = op{15-8}; 352 let Inst{39-36} = R1; 353 let Inst{35-32} = R2; 354 let Inst{31-24} = I3; 355 let Inst{23-16} = I4; 356 let Inst{15-8} = I5; 357 let Inst{7-0} = op{7-0}; 358} 359 360class InstRIEg<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 361 : InstSystemZ<6, outs, ins, asmstr, pattern> { 362 field bits<48> Inst; 363 field bits<48> SoftFail = 0; 364 365 bits<4> R1; 366 bits<4> M3; 367 bits<16> I2; 368 369 let Inst{47-40} = op{15-8}; 370 let Inst{39-36} = R1; 371 let Inst{35-32} = M3; 372 let Inst{31-16} = I2; 373 let Inst{15-8} = 0; 374 let Inst{7-0} = op{7-0}; 375} 376 377class InstRILa<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern> 378 : InstSystemZ<6, outs, ins, asmstr, pattern> { 379 field bits<48> Inst; 380 field bits<48> SoftFail = 0; 381 382 bits<4> R1; 383 bits<32> I2; 384 385 let Inst{47-40} = op{11-4}; 386 let Inst{39-36} = R1; 387 let Inst{35-32} = op{3-0}; 388 let Inst{31-0} = I2; 389} 390 391class InstRILb<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern> 392 : InstSystemZ<6, outs, ins, asmstr, pattern> { 393 field bits<48> Inst; 394 field bits<48> SoftFail = 0; 395 396 bits<4> R1; 397 bits<32> RI2; 398 399 let Inst{47-40} = op{11-4}; 400 let Inst{39-36} = R1; 401 let Inst{35-32} = op{3-0}; 402 let Inst{31-0} = RI2; 403} 404 405class InstRILc<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern> 406 : InstSystemZ<6, outs, ins, asmstr, pattern> { 407 field bits<48> Inst; 408 field bits<48> SoftFail = 0; 409 410 bits<4> M1; 411 bits<32> RI2; 412 413 let Inst{47-40} = op{11-4}; 414 let Inst{39-36} = M1; 415 let Inst{35-32} = op{3-0}; 416 let Inst{31-0} = RI2; 417} 418 419class InstRIS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 420 : InstSystemZ<6, outs, ins, asmstr, pattern> { 421 field bits<48> Inst; 422 field bits<48> SoftFail = 0; 423 424 bits<4> R1; 425 bits<8> I2; 426 bits<4> M3; 427 bits<16> BD4; 428 429 let Inst{47-40} = op{15-8}; 430 let Inst{39-36} = R1; 431 let Inst{35-32} = M3; 432 let Inst{31-16} = BD4; 433 let Inst{15-8} = I2; 434 let Inst{7-0} = op{7-0}; 435} 436 437class InstRR<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 438 : InstSystemZ<2, outs, ins, asmstr, pattern> { 439 field bits<16> Inst; 440 field bits<16> SoftFail = 0; 441 442 bits<4> R1; 443 bits<4> R2; 444 445 let Inst{15-8} = op; 446 let Inst{7-4} = R1; 447 let Inst{3-0} = R2; 448} 449 450class InstRRD<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 451 : InstSystemZ<4, outs, ins, asmstr, pattern> { 452 field bits<32> Inst; 453 field bits<32> SoftFail = 0; 454 455 bits<4> R1; 456 bits<4> R3; 457 bits<4> R2; 458 459 let Inst{31-16} = op; 460 let Inst{15-12} = R1; 461 let Inst{11-8} = 0; 462 let Inst{7-4} = R3; 463 let Inst{3-0} = R2; 464} 465 466class InstRRE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 467 : InstSystemZ<4, outs, ins, asmstr, pattern> { 468 field bits<32> Inst; 469 field bits<32> SoftFail = 0; 470 471 bits<4> R1; 472 bits<4> R2; 473 474 let Inst{31-16} = op; 475 let Inst{15-8} = 0; 476 let Inst{7-4} = R1; 477 let Inst{3-0} = R2; 478} 479 480class InstRRFa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 481 : InstSystemZ<4, outs, ins, asmstr, pattern> { 482 field bits<32> Inst; 483 field bits<32> SoftFail = 0; 484 485 bits<4> R1; 486 bits<4> R2; 487 bits<4> R3; 488 bits<4> M4; 489 490 let Inst{31-16} = op; 491 let Inst{15-12} = R3; 492 let Inst{11-8} = M4; 493 let Inst{7-4} = R1; 494 let Inst{3-0} = R2; 495} 496 497class InstRRFb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 498 : InstSystemZ<4, outs, ins, asmstr, pattern> { 499 field bits<32> Inst; 500 field bits<32> SoftFail = 0; 501 502 bits<4> R1; 503 bits<4> R2; 504 bits<4> R3; 505 bits<4> M4; 506 507 let Inst{31-16} = op; 508 let Inst{15-12} = R3; 509 let Inst{11-8} = M4; 510 let Inst{7-4} = R1; 511 let Inst{3-0} = R2; 512} 513 514class InstRRFc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 515 : InstSystemZ<4, outs, ins, asmstr, pattern> { 516 field bits<32> Inst; 517 field bits<32> SoftFail = 0; 518 519 bits<4> R1; 520 bits<4> R2; 521 bits<4> M3; 522 523 let Inst{31-16} = op; 524 let Inst{15-12} = M3; 525 let Inst{11-8} = 0; 526 let Inst{7-4} = R1; 527 let Inst{3-0} = R2; 528} 529 530class InstRRFd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 531 : InstSystemZ<4, outs, ins, asmstr, pattern> { 532 field bits<32> Inst; 533 field bits<32> SoftFail = 0; 534 535 bits<4> R1; 536 bits<4> R2; 537 bits<4> M4; 538 539 let Inst{31-16} = op; 540 let Inst{15-12} = 0; 541 let Inst{11-8} = M4; 542 let Inst{7-4} = R1; 543 let Inst{3-0} = R2; 544} 545 546class InstRRFe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 547 : InstSystemZ<4, outs, ins, asmstr, pattern> { 548 field bits<32> Inst; 549 field bits<32> SoftFail = 0; 550 551 bits<4> R1; 552 bits<4> R2; 553 bits<4> M3; 554 bits<4> M4; 555 556 let Inst{31-16} = op; 557 let Inst{15-12} = M3; 558 let Inst{11-8} = M4; 559 let Inst{7-4} = R1; 560 let Inst{3-0} = R2; 561} 562 563class InstRRS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 564 : InstSystemZ<6, outs, ins, asmstr, pattern> { 565 field bits<48> Inst; 566 field bits<48> SoftFail = 0; 567 568 bits<4> R1; 569 bits<4> R2; 570 bits<4> M3; 571 bits<16> BD4; 572 573 let Inst{47-40} = op{15-8}; 574 let Inst{39-36} = R1; 575 let Inst{35-32} = R2; 576 let Inst{31-16} = BD4; 577 let Inst{15-12} = M3; 578 let Inst{11-8} = 0; 579 let Inst{7-0} = op{7-0}; 580} 581 582class InstRXa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 583 : InstSystemZ<4, outs, ins, asmstr, pattern> { 584 field bits<32> Inst; 585 field bits<32> SoftFail = 0; 586 587 bits<4> R1; 588 bits<20> XBD2; 589 590 let Inst{31-24} = op; 591 let Inst{23-20} = R1; 592 let Inst{19-0} = XBD2; 593 594 let HasIndex = 1; 595} 596 597class InstRXb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 598 : InstSystemZ<4, outs, ins, asmstr, pattern> { 599 field bits<32> Inst; 600 field bits<32> SoftFail = 0; 601 602 bits<4> M1; 603 bits<20> XBD2; 604 605 let Inst{31-24} = op; 606 let Inst{23-20} = M1; 607 let Inst{19-0} = XBD2; 608 609 let HasIndex = 1; 610} 611 612class InstRXE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 613 : InstSystemZ<6, outs, ins, asmstr, pattern> { 614 field bits<48> Inst; 615 field bits<48> SoftFail = 0; 616 617 bits<4> R1; 618 bits<20> XBD2; 619 bits<4> M3; 620 621 let Inst{47-40} = op{15-8}; 622 let Inst{39-36} = R1; 623 let Inst{35-16} = XBD2; 624 let Inst{15-12} = M3; 625 let Inst{11-8} = 0; 626 let Inst{7-0} = op{7-0}; 627 628 let HasIndex = 1; 629} 630 631class InstRXF<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 632 : InstSystemZ<6, outs, ins, asmstr, pattern> { 633 field bits<48> Inst; 634 field bits<48> SoftFail = 0; 635 636 bits<4> R1; 637 bits<4> R3; 638 bits<20> XBD2; 639 640 let Inst{47-40} = op{15-8}; 641 let Inst{39-36} = R3; 642 let Inst{35-16} = XBD2; 643 let Inst{15-12} = R1; 644 let Inst{11-8} = 0; 645 let Inst{7-0} = op{7-0}; 646 647 let HasIndex = 1; 648} 649 650class InstRXYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 651 : InstSystemZ<6, outs, ins, asmstr, pattern> { 652 field bits<48> Inst; 653 field bits<48> SoftFail = 0; 654 655 bits<4> R1; 656 bits<28> XBD2; 657 658 let Inst{47-40} = op{15-8}; 659 let Inst{39-36} = R1; 660 let Inst{35-8} = XBD2; 661 let Inst{7-0} = op{7-0}; 662 663 let Has20BitOffset = 1; 664 let HasIndex = 1; 665} 666 667class InstRXYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 668 : InstSystemZ<6, outs, ins, asmstr, pattern> { 669 field bits<48> Inst; 670 field bits<48> SoftFail = 0; 671 672 bits<4> M1; 673 bits<28> XBD2; 674 675 let Inst{47-40} = op{15-8}; 676 let Inst{39-36} = M1; 677 let Inst{35-8} = XBD2; 678 let Inst{7-0} = op{7-0}; 679 680 let Has20BitOffset = 1; 681 let HasIndex = 1; 682} 683 684class InstRSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 685 : InstSystemZ<4, outs, ins, asmstr, pattern> { 686 field bits<32> Inst; 687 field bits<32> SoftFail = 0; 688 689 bits<4> R1; 690 bits<4> R3; 691 bits<16> BD2; 692 693 let Inst{31-24} = op; 694 let Inst{23-20} = R1; 695 let Inst{19-16} = R3; 696 let Inst{15-0} = BD2; 697} 698 699class InstRSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 700 : InstSystemZ<4, outs, ins, asmstr, pattern> { 701 field bits<32> Inst; 702 field bits<32> SoftFail = 0; 703 704 bits<4> R1; 705 bits<4> M3; 706 bits<16> BD2; 707 708 let Inst{31-24} = op; 709 let Inst{23-20} = R1; 710 let Inst{19-16} = M3; 711 let Inst{15-0} = BD2; 712} 713 714class InstRSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 715 : InstSystemZ<4, outs, ins, asmstr, pattern> { 716 field bits<32> Inst; 717 field bits<32> SoftFail = 0; 718 719 bits<4> R1; 720 bits<4> R3; 721 bits<16> RI2; 722 723 let Inst{31-24} = op; 724 let Inst{23-20} = R1; 725 let Inst{19-16} = R3; 726 let Inst{15-0} = RI2; 727} 728 729class InstRSLa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 730 : InstSystemZ<6, outs, ins, asmstr, pattern> { 731 field bits<48> Inst; 732 field bits<48> SoftFail = 0; 733 734 bits<20> BDL1; 735 736 let Inst{47-40} = op{15-8}; 737 let Inst{39-36} = BDL1{19-16}; 738 let Inst{35-32} = 0; 739 let Inst{31-16} = BDL1{15-0}; 740 let Inst{15-8} = 0; 741 let Inst{7-0} = op{7-0}; 742} 743 744class InstRSLb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 745 : InstSystemZ<6, outs, ins, asmstr, pattern> { 746 field bits<48> Inst; 747 field bits<48> SoftFail = 0; 748 749 bits<4> R1; 750 bits<24> BDL2; 751 bits<4> M3; 752 753 let Inst{47-40} = op{15-8}; 754 let Inst{39-16} = BDL2; 755 let Inst{15-12} = R1; 756 let Inst{11-8} = M3; 757 let Inst{7-0} = op{7-0}; 758} 759 760class InstRSYa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 761 : InstSystemZ<6, outs, ins, asmstr, pattern> { 762 field bits<48> Inst; 763 field bits<48> SoftFail = 0; 764 765 bits<4> R1; 766 bits<4> R3; 767 bits<24> BD2; 768 769 let Inst{47-40} = op{15-8}; 770 let Inst{39-36} = R1; 771 let Inst{35-32} = R3; 772 let Inst{31-8} = BD2; 773 let Inst{7-0} = op{7-0}; 774 775 let Has20BitOffset = 1; 776} 777 778class InstRSYb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 779 : InstSystemZ<6, outs, ins, asmstr, pattern> { 780 field bits<48> Inst; 781 field bits<48> SoftFail = 0; 782 783 bits<4> R1; 784 bits<4> M3; 785 bits<24> BD2; 786 787 let Inst{47-40} = op{15-8}; 788 let Inst{39-36} = R1; 789 let Inst{35-32} = M3; 790 let Inst{31-8} = BD2; 791 let Inst{7-0} = op{7-0}; 792 793 let Has20BitOffset = 1; 794} 795 796class InstSI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 797 : InstSystemZ<4, outs, ins, asmstr, pattern> { 798 field bits<32> Inst; 799 field bits<32> SoftFail = 0; 800 801 bits<16> BD1; 802 bits<8> I2; 803 804 let Inst{31-24} = op; 805 let Inst{23-16} = I2; 806 let Inst{15-0} = BD1; 807} 808 809class InstSIL<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 810 : InstSystemZ<6, outs, ins, asmstr, pattern> { 811 field bits<48> Inst; 812 field bits<48> SoftFail = 0; 813 814 bits<16> BD1; 815 bits<16> I2; 816 817 let Inst{47-32} = op; 818 let Inst{31-16} = BD1; 819 let Inst{15-0} = I2; 820} 821 822class InstSIY<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 823 : InstSystemZ<6, outs, ins, asmstr, pattern> { 824 field bits<48> Inst; 825 field bits<48> SoftFail = 0; 826 827 bits<24> BD1; 828 bits<8> I2; 829 830 let Inst{47-40} = op{15-8}; 831 let Inst{39-32} = I2; 832 let Inst{31-8} = BD1; 833 let Inst{7-0} = op{7-0}; 834 835 let Has20BitOffset = 1; 836} 837 838class InstSMI<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 839 : InstSystemZ<6, outs, ins, asmstr, pattern> { 840 field bits<48> Inst; 841 field bits<48> SoftFail = 0; 842 843 bits<4> M1; 844 bits<16> RI2; 845 bits<16> BD3; 846 847 let Inst{47-40} = op; 848 let Inst{39-36} = M1; 849 let Inst{35-32} = 0; 850 let Inst{31-16} = BD3; 851 let Inst{15-0} = RI2; 852} 853 854class InstSSa<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 855 : InstSystemZ<6, outs, ins, asmstr, pattern> { 856 field bits<48> Inst; 857 field bits<48> SoftFail = 0; 858 859 bits<24> BDL1; 860 bits<16> BD2; 861 862 let Inst{47-40} = op; 863 let Inst{39-16} = BDL1; 864 let Inst{15-0} = BD2; 865} 866 867class InstSSb<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 868 : InstSystemZ<6, outs, ins, asmstr, pattern> { 869 field bits<48> Inst; 870 field bits<48> SoftFail = 0; 871 872 bits<20> BDL1; 873 bits<20> BDL2; 874 875 let Inst{47-40} = op; 876 let Inst{39-36} = BDL1{19-16}; 877 let Inst{35-32} = BDL2{19-16}; 878 let Inst{31-16} = BDL1{15-0}; 879 let Inst{15-0} = BDL2{15-0}; 880} 881 882class InstSSc<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 883 : InstSystemZ<6, outs, ins, asmstr, pattern> { 884 field bits<48> Inst; 885 field bits<48> SoftFail = 0; 886 887 bits<20> BDL1; 888 bits<16> BD2; 889 bits<4> I3; 890 891 let Inst{47-40} = op; 892 let Inst{39-36} = BDL1{19-16}; 893 let Inst{35-32} = I3; 894 let Inst{31-16} = BDL1{15-0}; 895 let Inst{15-0} = BD2; 896} 897 898class InstSSd<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 899 : InstSystemZ<6, outs, ins, asmstr, pattern> { 900 field bits<48> Inst; 901 field bits<48> SoftFail = 0; 902 903 bits<20> RBD1; 904 bits<16> BD2; 905 bits<4> R3; 906 907 let Inst{47-40} = op; 908 let Inst{39-36} = RBD1{19-16}; 909 let Inst{35-32} = R3; 910 let Inst{31-16} = RBD1{15-0}; 911 let Inst{15-0} = BD2; 912} 913 914class InstSSe<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 915 : InstSystemZ<6, outs, ins, asmstr, pattern> { 916 field bits<48> Inst; 917 field bits<48> SoftFail = 0; 918 919 bits<4> R1; 920 bits<16> BD2; 921 bits<4> R3; 922 bits<16> BD4; 923 924 let Inst{47-40} = op; 925 let Inst{39-36} = R1; 926 let Inst{35-32} = R3; 927 let Inst{31-16} = BD2; 928 let Inst{15-0} = BD4; 929} 930 931class InstSSf<bits<8> op, dag outs, dag ins, string asmstr, list<dag> pattern> 932 : InstSystemZ<6, outs, ins, asmstr, pattern> { 933 field bits<48> Inst; 934 field bits<48> SoftFail = 0; 935 936 bits<16> BD1; 937 bits<24> BDL2; 938 939 let Inst{47-40} = op; 940 let Inst{39-32} = BDL2{23-16}; 941 let Inst{31-16} = BD1; 942 let Inst{15-0} = BDL2{15-0}; 943} 944 945class InstSSE<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 946 : InstSystemZ<6, outs, ins, asmstr, pattern> { 947 field bits<48> Inst; 948 field bits<48> SoftFail = 0; 949 950 bits<16> BD1; 951 bits<16> BD2; 952 953 let Inst{47-32} = op; 954 let Inst{31-16} = BD1; 955 let Inst{15-0} = BD2; 956} 957 958class InstSSF<bits<12> op, dag outs, dag ins, string asmstr, list<dag> pattern> 959 : InstSystemZ<6, outs, ins, asmstr, pattern> { 960 field bits<48> Inst; 961 field bits<48> SoftFail = 0; 962 963 bits<16> BD1; 964 bits<16> BD2; 965 bits<4> R3; 966 967 let Inst{47-40} = op{11-4}; 968 let Inst{39-36} = R3; 969 let Inst{35-32} = op{3-0}; 970 let Inst{31-16} = BD1; 971 let Inst{15-0} = BD2; 972} 973 974class InstS<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 975 : InstSystemZ<4, outs, ins, asmstr, pattern> { 976 field bits<32> Inst; 977 field bits<32> SoftFail = 0; 978 979 bits<16> BD2; 980 981 let Inst{31-16} = op; 982 let Inst{15-0} = BD2; 983} 984 985class InstVRIa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 986 : InstSystemZ<6, outs, ins, asmstr, pattern> { 987 field bits<48> Inst; 988 field bits<48> SoftFail = 0; 989 990 bits<5> V1; 991 bits<16> I2; 992 bits<4> M3; 993 994 let Inst{47-40} = op{15-8}; 995 let Inst{39-36} = V1{3-0}; 996 let Inst{35-32} = 0; 997 let Inst{31-16} = I2; 998 let Inst{15-12} = M3; 999 let Inst{11} = V1{4}; 1000 let Inst{10-8} = 0; 1001 let Inst{7-0} = op{7-0}; 1002} 1003 1004class InstVRIb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1005 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1006 field bits<48> Inst; 1007 field bits<48> SoftFail = 0; 1008 1009 bits<5> V1; 1010 bits<8> I2; 1011 bits<8> I3; 1012 bits<4> M4; 1013 1014 let Inst{47-40} = op{15-8}; 1015 let Inst{39-36} = V1{3-0}; 1016 let Inst{35-32} = 0; 1017 let Inst{31-24} = I2; 1018 let Inst{23-16} = I3; 1019 let Inst{15-12} = M4; 1020 let Inst{11} = V1{4}; 1021 let Inst{10-8} = 0; 1022 let Inst{7-0} = op{7-0}; 1023} 1024 1025class InstVRIc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1026 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1027 field bits<48> Inst; 1028 field bits<48> SoftFail = 0; 1029 1030 bits<5> V1; 1031 bits<5> V3; 1032 bits<16> I2; 1033 bits<4> M4; 1034 1035 let Inst{47-40} = op{15-8}; 1036 let Inst{39-36} = V1{3-0}; 1037 let Inst{35-32} = V3{3-0}; 1038 let Inst{31-16} = I2; 1039 let Inst{15-12} = M4; 1040 let Inst{11} = V1{4}; 1041 let Inst{10} = V3{4}; 1042 let Inst{9-8} = 0; 1043 let Inst{7-0} = op{7-0}; 1044} 1045 1046class InstVRId<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1047 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1048 field bits<48> Inst; 1049 field bits<48> SoftFail = 0; 1050 1051 bits<5> V1; 1052 bits<5> V2; 1053 bits<5> V3; 1054 bits<8> I4; 1055 bits<4> M5; 1056 1057 let Inst{47-40} = op{15-8}; 1058 let Inst{39-36} = V1{3-0}; 1059 let Inst{35-32} = V2{3-0}; 1060 let Inst{31-28} = V3{3-0}; 1061 let Inst{27-24} = 0; 1062 let Inst{23-16} = I4; 1063 let Inst{15-12} = M5; 1064 let Inst{11} = V1{4}; 1065 let Inst{10} = V2{4}; 1066 let Inst{9} = V3{4}; 1067 let Inst{8} = 0; 1068 let Inst{7-0} = op{7-0}; 1069} 1070 1071class InstVRIe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1072 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1073 field bits<48> Inst; 1074 field bits<48> SoftFail = 0; 1075 1076 bits<5> V1; 1077 bits<5> V2; 1078 bits<12> I3; 1079 bits<4> M4; 1080 bits<4> M5; 1081 1082 let Inst{47-40} = op{15-8}; 1083 let Inst{39-36} = V1{3-0}; 1084 let Inst{35-32} = V2{3-0}; 1085 let Inst{31-20} = I3; 1086 let Inst{19-16} = M5; 1087 let Inst{15-12} = M4; 1088 let Inst{11} = V1{4}; 1089 let Inst{10} = V2{4}; 1090 let Inst{9-8} = 0; 1091 let Inst{7-0} = op{7-0}; 1092} 1093 1094// Depending on the instruction mnemonic, certain bits may be or-ed into 1095// the M4 value provided as explicit operand. These are passed as m4or. 1096class InstVRRa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern, 1097 bits<4> m4or = 0> 1098 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1099 field bits<48> Inst; 1100 field bits<48> SoftFail = 0; 1101 1102 bits<5> V1; 1103 bits<5> V2; 1104 bits<4> M3; 1105 bits<4> M4; 1106 bits<4> M5; 1107 1108 let Inst{47-40} = op{15-8}; 1109 let Inst{39-36} = V1{3-0}; 1110 let Inst{35-32} = V2{3-0}; 1111 let Inst{31-24} = 0; 1112 let Inst{23-20} = M5; 1113 let Inst{19} = !if (!eq (m4or{3}, 1), 1, M4{3}); 1114 let Inst{18} = !if (!eq (m4or{2}, 1), 1, M4{2}); 1115 let Inst{17} = !if (!eq (m4or{1}, 1), 1, M4{1}); 1116 let Inst{16} = !if (!eq (m4or{0}, 1), 1, M4{0}); 1117 let Inst{15-12} = M3; 1118 let Inst{11} = V1{4}; 1119 let Inst{10} = V2{4}; 1120 let Inst{9-8} = 0; 1121 let Inst{7-0} = op{7-0}; 1122} 1123 1124// Depending on the instruction mnemonic, certain bits may be or-ed into 1125// the M5 value provided as explicit operand. These are passed as m5or. 1126class InstVRRb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern, 1127 bits<4> m5or = 0> 1128 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1129 field bits<48> Inst; 1130 field bits<48> SoftFail = 0; 1131 1132 bits<5> V1; 1133 bits<5> V2; 1134 bits<5> V3; 1135 bits<4> M4; 1136 bits<4> M5; 1137 1138 let Inst{47-40} = op{15-8}; 1139 let Inst{39-36} = V1{3-0}; 1140 let Inst{35-32} = V2{3-0}; 1141 let Inst{31-28} = V3{3-0}; 1142 let Inst{27-24} = 0; 1143 let Inst{23} = !if (!eq (m5or{3}, 1), 1, M5{3}); 1144 let Inst{22} = !if (!eq (m5or{2}, 1), 1, M5{2}); 1145 let Inst{21} = !if (!eq (m5or{1}, 1), 1, M5{1}); 1146 let Inst{20} = !if (!eq (m5or{0}, 1), 1, M5{0}); 1147 let Inst{19-16} = 0; 1148 let Inst{15-12} = M4; 1149 let Inst{11} = V1{4}; 1150 let Inst{10} = V2{4}; 1151 let Inst{9} = V3{4}; 1152 let Inst{8} = 0; 1153 let Inst{7-0} = op{7-0}; 1154} 1155 1156class InstVRRc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1157 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1158 field bits<48> Inst; 1159 field bits<48> SoftFail = 0; 1160 1161 bits<5> V1; 1162 bits<5> V2; 1163 bits<5> V3; 1164 bits<4> M4; 1165 bits<4> M5; 1166 bits<4> M6; 1167 1168 let Inst{47-40} = op{15-8}; 1169 let Inst{39-36} = V1{3-0}; 1170 let Inst{35-32} = V2{3-0}; 1171 let Inst{31-28} = V3{3-0}; 1172 let Inst{27-24} = 0; 1173 let Inst{23-20} = M6; 1174 let Inst{19-16} = M5; 1175 let Inst{15-12} = M4; 1176 let Inst{11} = V1{4}; 1177 let Inst{10} = V2{4}; 1178 let Inst{9} = V3{4}; 1179 let Inst{8} = 0; 1180 let Inst{7-0} = op{7-0}; 1181} 1182 1183// Depending on the instruction mnemonic, certain bits may be or-ed into 1184// the M6 value provided as explicit operand. These are passed as m6or. 1185class InstVRRd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern, 1186 bits<4> m6or = 0> 1187 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1188 field bits<48> Inst; 1189 field bits<48> SoftFail = 0; 1190 1191 bits<5> V1; 1192 bits<5> V2; 1193 bits<5> V3; 1194 bits<5> V4; 1195 bits<4> M5; 1196 bits<4> M6; 1197 1198 let Inst{47-40} = op{15-8}; 1199 let Inst{39-36} = V1{3-0}; 1200 let Inst{35-32} = V2{3-0}; 1201 let Inst{31-28} = V3{3-0}; 1202 let Inst{27-24} = M5; 1203 let Inst{23} = !if (!eq (m6or{3}, 1), 1, M6{3}); 1204 let Inst{22} = !if (!eq (m6or{2}, 1), 1, M6{2}); 1205 let Inst{21} = !if (!eq (m6or{1}, 1), 1, M6{1}); 1206 let Inst{20} = !if (!eq (m6or{0}, 1), 1, M6{0}); 1207 let Inst{19-16} = 0; 1208 let Inst{15-12} = V4{3-0}; 1209 let Inst{11} = V1{4}; 1210 let Inst{10} = V2{4}; 1211 let Inst{9} = V3{4}; 1212 let Inst{8} = V4{4}; 1213 let Inst{7-0} = op{7-0}; 1214} 1215 1216class InstVRRe<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1217 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1218 field bits<48> Inst; 1219 field bits<48> SoftFail = 0; 1220 1221 bits<5> V1; 1222 bits<5> V2; 1223 bits<5> V3; 1224 bits<5> V4; 1225 bits<4> M5; 1226 bits<4> M6; 1227 1228 let Inst{47-40} = op{15-8}; 1229 let Inst{39-36} = V1{3-0}; 1230 let Inst{35-32} = V2{3-0}; 1231 let Inst{31-28} = V3{3-0}; 1232 let Inst{27-24} = M6; 1233 let Inst{23-20} = 0; 1234 let Inst{19-16} = M5; 1235 let Inst{15-12} = V4{3-0}; 1236 let Inst{11} = V1{4}; 1237 let Inst{10} = V2{4}; 1238 let Inst{9} = V3{4}; 1239 let Inst{8} = V4{4}; 1240 let Inst{7-0} = op{7-0}; 1241} 1242 1243class InstVRRf<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1244 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1245 field bits<48> Inst; 1246 field bits<48> SoftFail = 0; 1247 1248 bits<5> V1; 1249 bits<4> R2; 1250 bits<4> R3; 1251 1252 let Inst{47-40} = op{15-8}; 1253 let Inst{39-36} = V1{3-0}; 1254 let Inst{35-32} = R2; 1255 let Inst{31-28} = R3; 1256 let Inst{27-12} = 0; 1257 let Inst{11} = V1{4}; 1258 let Inst{10-8} = 0; 1259 let Inst{7-0} = op{7-0}; 1260} 1261 1262class InstVRSa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1263 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1264 field bits<48> Inst; 1265 field bits<48> SoftFail = 0; 1266 1267 bits<5> V1; 1268 bits<16> BD2; 1269 bits<5> V3; 1270 bits<4> M4; 1271 1272 let Inst{47-40} = op{15-8}; 1273 let Inst{39-36} = V1{3-0}; 1274 let Inst{35-32} = V3{3-0}; 1275 let Inst{31-16} = BD2; 1276 let Inst{15-12} = M4; 1277 let Inst{11} = V1{4}; 1278 let Inst{10} = V3{4}; 1279 let Inst{9-8} = 0; 1280 let Inst{7-0} = op{7-0}; 1281} 1282 1283class InstVRSb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1284 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1285 field bits<48> Inst; 1286 field bits<48> SoftFail = 0; 1287 1288 bits<5> V1; 1289 bits<16> BD2; 1290 bits<4> R3; 1291 bits<4> M4; 1292 1293 let Inst{47-40} = op{15-8}; 1294 let Inst{39-36} = V1{3-0}; 1295 let Inst{35-32} = R3; 1296 let Inst{31-16} = BD2; 1297 let Inst{15-12} = M4; 1298 let Inst{11} = V1{4}; 1299 let Inst{10-8} = 0; 1300 let Inst{7-0} = op{7-0}; 1301} 1302 1303class InstVRSc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1304 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1305 field bits<48> Inst; 1306 field bits<48> SoftFail = 0; 1307 1308 bits<4> R1; 1309 bits<16> BD2; 1310 bits<5> V3; 1311 bits<4> M4; 1312 1313 let Inst{47-40} = op{15-8}; 1314 let Inst{39-36} = R1; 1315 let Inst{35-32} = V3{3-0}; 1316 let Inst{31-16} = BD2; 1317 let Inst{15-12} = M4; 1318 let Inst{11} = 0; 1319 let Inst{10} = V3{4}; 1320 let Inst{9-8} = 0; 1321 let Inst{7-0} = op{7-0}; 1322} 1323 1324class InstVRV<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1325 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1326 field bits<48> Inst; 1327 field bits<48> SoftFail = 0; 1328 1329 bits<5> V1; 1330 bits<21> VBD2; 1331 bits<4> M3; 1332 1333 let Inst{47-40} = op{15-8}; 1334 let Inst{39-36} = V1{3-0}; 1335 let Inst{35-16} = VBD2{19-0}; 1336 let Inst{15-12} = M3; 1337 let Inst{11} = V1{4}; 1338 let Inst{10} = VBD2{20}; 1339 let Inst{9-8} = 0; 1340 let Inst{7-0} = op{7-0}; 1341} 1342 1343class InstVRX<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1344 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1345 field bits<48> Inst; 1346 field bits<48> SoftFail = 0; 1347 1348 bits<5> V1; 1349 bits<20> XBD2; 1350 bits<4> M3; 1351 1352 let Inst{47-40} = op{15-8}; 1353 let Inst{39-36} = V1{3-0}; 1354 let Inst{35-16} = XBD2; 1355 let Inst{15-12} = M3; 1356 let Inst{11} = V1{4}; 1357 let Inst{10-8} = 0; 1358 let Inst{7-0} = op{7-0}; 1359} 1360 1361//===----------------------------------------------------------------------===// 1362// Instruction classes for .insn directives 1363//===----------------------------------------------------------------------===// 1364 1365class DirectiveInsnE<dag outs, dag ins, string asmstr, list<dag> pattern> 1366 : InstE<0, outs, ins, asmstr, pattern> { 1367 bits<16> enc; 1368 1369 let Inst = enc; 1370} 1371 1372class DirectiveInsnRI<dag outs, dag ins, string asmstr, list<dag> pattern> 1373 : InstRIa<0, outs, ins, asmstr, pattern> { 1374 bits<32> enc; 1375 1376 let Inst{31-24} = enc{31-24}; 1377 let Inst{19-16} = enc{19-16}; 1378} 1379 1380class DirectiveInsnRIE<dag outs, dag ins, string asmstr, list<dag> pattern> 1381 : InstRIEd<0, outs, ins, asmstr, pattern> { 1382 bits<48> enc; 1383 1384 let Inst{47-40} = enc{47-40}; 1385 let Inst{7-0} = enc{7-0}; 1386} 1387 1388class DirectiveInsnRIL<dag outs, dag ins, string asmstr, list<dag> pattern> 1389 : InstRILa<0, outs, ins, asmstr, pattern> { 1390 bits<48> enc; 1391 string type; 1392 1393 let Inst{47-40} = enc{47-40}; 1394 let Inst{35-32} = enc{35-32}; 1395} 1396 1397class DirectiveInsnRIS<dag outs, dag ins, string asmstr, list<dag> pattern> 1398 : InstRIS<0, outs, ins, asmstr, pattern> { 1399 bits<48> enc; 1400 1401 let Inst{47-40} = enc{47-40}; 1402 let Inst{7-0} = enc{7-0}; 1403} 1404 1405class DirectiveInsnRR<dag outs, dag ins, string asmstr, list<dag> pattern> 1406 : InstRR<0, outs, ins, asmstr, pattern> { 1407 bits<16> enc; 1408 1409 let Inst{15-8} = enc{15-8}; 1410} 1411 1412class DirectiveInsnRRE<dag outs, dag ins, string asmstr, list<dag> pattern> 1413 : InstRRE<0, outs, ins, asmstr, pattern> { 1414 bits<32> enc; 1415 1416 let Inst{31-16} = enc{31-16}; 1417} 1418 1419class DirectiveInsnRRF<dag outs, dag ins, string asmstr, list<dag> pattern> 1420 : InstRRFa<0, outs, ins, asmstr, pattern> { 1421 bits<32> enc; 1422 1423 let Inst{31-16} = enc{31-16}; 1424} 1425 1426class DirectiveInsnRRS<dag outs, dag ins, string asmstr, list<dag> pattern> 1427 : InstRRS<0, outs, ins, asmstr, pattern> { 1428 bits<48> enc; 1429 1430 let Inst{47-40} = enc{47-40}; 1431 let Inst{7-0} = enc{7-0}; 1432} 1433 1434class DirectiveInsnRS<dag outs, dag ins, string asmstr, list<dag> pattern> 1435 : InstRSa<0, outs, ins, asmstr, pattern> { 1436 bits<32> enc; 1437 1438 let Inst{31-24} = enc{31-24}; 1439} 1440 1441// RSE is like RSY except with a 12 bit displacement (instead of 20). 1442class DirectiveInsnRSE<dag outs, dag ins, string asmstr, list<dag> pattern> 1443 : InstRSYa<6, outs, ins, asmstr, pattern> { 1444 bits <48> enc; 1445 1446 let Inst{47-40} = enc{47-40}; 1447 let Inst{31-16} = BD2{15-0}; 1448 let Inst{15-8} = 0; 1449 let Inst{7-0} = enc{7-0}; 1450} 1451 1452class DirectiveInsnRSI<dag outs, dag ins, string asmstr, list<dag> pattern> 1453 : InstRSI<0, outs, ins, asmstr, pattern> { 1454 bits<32> enc; 1455 1456 let Inst{31-24} = enc{31-24}; 1457} 1458 1459class DirectiveInsnRSY<dag outs, dag ins, string asmstr, list<dag> pattern> 1460 : InstRSYa<0, outs, ins, asmstr, pattern> { 1461 bits<48> enc; 1462 1463 let Inst{47-40} = enc{47-40}; 1464 let Inst{7-0} = enc{7-0}; 1465} 1466 1467class DirectiveInsnRX<dag outs, dag ins, string asmstr, list<dag> pattern> 1468 : InstRXa<0, outs, ins, asmstr, pattern> { 1469 bits<32> enc; 1470 1471 let Inst{31-24} = enc{31-24}; 1472} 1473 1474class DirectiveInsnRXE<dag outs, dag ins, string asmstr, list<dag> pattern> 1475 : InstRXE<0, outs, ins, asmstr, pattern> { 1476 bits<48> enc; 1477 1478 let M3 = 0; 1479 1480 let Inst{47-40} = enc{47-40}; 1481 let Inst{7-0} = enc{7-0}; 1482} 1483 1484class DirectiveInsnRXF<dag outs, dag ins, string asmstr, list<dag> pattern> 1485 : InstRXF<0, outs, ins, asmstr, pattern> { 1486 bits<48> enc; 1487 1488 let Inst{47-40} = enc{47-40}; 1489 let Inst{7-0} = enc{7-0}; 1490} 1491 1492class DirectiveInsnRXY<dag outs, dag ins, string asmstr, list<dag> pattern> 1493 : InstRXYa<0, outs, ins, asmstr, pattern> { 1494 bits<48> enc; 1495 1496 let Inst{47-40} = enc{47-40}; 1497 let Inst{7-0} = enc{7-0}; 1498} 1499 1500class DirectiveInsnS<dag outs, dag ins, string asmstr, list<dag> pattern> 1501 : InstS<0, outs, ins, asmstr, pattern> { 1502 bits<32> enc; 1503 1504 let Inst{31-16} = enc{31-16}; 1505} 1506 1507class DirectiveInsnSI<dag outs, dag ins, string asmstr, list<dag> pattern> 1508 : InstSI<0, outs, ins, asmstr, pattern> { 1509 bits<32> enc; 1510 1511 let Inst{31-24} = enc{31-24}; 1512} 1513 1514class DirectiveInsnSIY<dag outs, dag ins, string asmstr, list<dag> pattern> 1515 : InstSIY<0, outs, ins, asmstr, pattern> { 1516 bits<48> enc; 1517 1518 let Inst{47-40} = enc{47-40}; 1519 let Inst{7-0} = enc{7-0}; 1520} 1521 1522class DirectiveInsnSIL<dag outs, dag ins, string asmstr, list<dag> pattern> 1523 : InstSIL<0, outs, ins, asmstr, pattern> { 1524 bits<48> enc; 1525 1526 let Inst{47-32} = enc{47-32}; 1527} 1528 1529class DirectiveInsnSS<dag outs, dag ins, string asmstr, list<dag> pattern> 1530 : InstSSd<0, outs, ins, asmstr, pattern> { 1531 bits<48> enc; 1532 1533 let Inst{47-40} = enc{47-40}; 1534} 1535 1536class DirectiveInsnSSE<dag outs, dag ins, string asmstr, list<dag> pattern> 1537 : InstSSE<0, outs, ins, asmstr, pattern> { 1538 bits<48> enc; 1539 1540 let Inst{47-32} = enc{47-32}; 1541} 1542 1543class DirectiveInsnSSF<dag outs, dag ins, string asmstr, list<dag> pattern> 1544 : InstSSF<0, outs, ins, asmstr, pattern> { 1545 bits<48> enc; 1546 1547 let Inst{47-40} = enc{47-40}; 1548 let Inst{35-32} = enc{35-32}; 1549} 1550 1551//===----------------------------------------------------------------------===// 1552// Variants of instructions with condition mask 1553//===----------------------------------------------------------------------===// 1554// 1555// For instructions using a condition mask (e.g. conditional branches, 1556// compare-and-branch instructions, or conditional move instructions), 1557// we generally need to create multiple instruction patterns: 1558// 1559// - One used for code generation, which encodes the condition mask as an 1560// MI operand, but writes out an extended mnemonic for better readability. 1561// - One pattern for the base form of the instruction with an explicit 1562// condition mask (encoded as a plain integer MI operand). 1563// - Specific patterns for each extended mnemonic, where the condition mask 1564// is implied by the pattern name and not otherwise encoded at all. 1565// 1566// We need the latter primarily for the assembler and disassembler, since the 1567// assembler parser is not able to decode part of an instruction mnemonic 1568// into an operand. Thus we provide separate patterns for each mnemonic. 1569// 1570// Note that in some cases there are two different mnemonics for the same 1571// condition mask. In this case we cannot have both instructions available 1572// to the disassembler at the same time since the encodings are not distinct. 1573// Therefore the alternate forms are marked isAsmParserOnly. 1574// 1575// We don't make one of the two names an alias of the other because 1576// we need the custom parsing routines to select the correct register class. 1577// 1578// This section provides helpers for generating the specific forms. 1579// 1580//===----------------------------------------------------------------------===// 1581 1582// A class to describe a variant of an instruction with condition mask. 1583class CondVariant<bits<4> ccmaskin, string suffixin, bit alternatein> { 1584 // The fixed condition mask to use. 1585 bits<4> ccmask = ccmaskin; 1586 1587 // The suffix to use for the extended assembler mnemonic. 1588 string suffix = suffixin; 1589 1590 // Whether this is an alternate that needs to be marked isAsmParserOnly. 1591 bit alternate = alternatein; 1592} 1593 1594// Condition mask 15 means "always true", which is used to define 1595// unconditional branches as a variant of conditional branches. 1596def CondAlways : CondVariant<15, "", 0>; 1597 1598// Condition masks for general instructions that can set all 4 bits. 1599def CondVariantO : CondVariant<1, "o", 0>; 1600def CondVariantH : CondVariant<2, "h", 0>; 1601def CondVariantP : CondVariant<2, "p", 1>; 1602def CondVariantNLE : CondVariant<3, "nle", 0>; 1603def CondVariantL : CondVariant<4, "l", 0>; 1604def CondVariantM : CondVariant<4, "m", 1>; 1605def CondVariantNHE : CondVariant<5, "nhe", 0>; 1606def CondVariantLH : CondVariant<6, "lh", 0>; 1607def CondVariantNE : CondVariant<7, "ne", 0>; 1608def CondVariantNZ : CondVariant<7, "nz", 1>; 1609def CondVariantE : CondVariant<8, "e", 0>; 1610def CondVariantZ : CondVariant<8, "z", 1>; 1611def CondVariantNLH : CondVariant<9, "nlh", 0>; 1612def CondVariantHE : CondVariant<10, "he", 0>; 1613def CondVariantNL : CondVariant<11, "nl", 0>; 1614def CondVariantNM : CondVariant<11, "nm", 1>; 1615def CondVariantLE : CondVariant<12, "le", 0>; 1616def CondVariantNH : CondVariant<13, "nh", 0>; 1617def CondVariantNP : CondVariant<13, "np", 1>; 1618def CondVariantNO : CondVariant<14, "no", 0>; 1619 1620// A helper class to look up one of the above by name. 1621class CV<string name> 1622 : CondVariant<!cast<CondVariant>("CondVariant"#name).ccmask, 1623 !cast<CondVariant>("CondVariant"#name).suffix, 1624 !cast<CondVariant>("CondVariant"#name).alternate>; 1625 1626// Condition masks for integer instructions (e.g. compare-and-branch). 1627// This is like the list above, except that condition 3 is not possible 1628// and that the low bit of the mask is therefore always 0. This means 1629// that each condition has two names. Conditions "o" and "no" are not used. 1630def IntCondVariantH : CondVariant<2, "h", 0>; 1631def IntCondVariantNLE : CondVariant<2, "nle", 1>; 1632def IntCondVariantL : CondVariant<4, "l", 0>; 1633def IntCondVariantNHE : CondVariant<4, "nhe", 1>; 1634def IntCondVariantLH : CondVariant<6, "lh", 0>; 1635def IntCondVariantNE : CondVariant<6, "ne", 1>; 1636def IntCondVariantE : CondVariant<8, "e", 0>; 1637def IntCondVariantNLH : CondVariant<8, "nlh", 1>; 1638def IntCondVariantHE : CondVariant<10, "he", 0>; 1639def IntCondVariantNL : CondVariant<10, "nl", 1>; 1640def IntCondVariantLE : CondVariant<12, "le", 0>; 1641def IntCondVariantNH : CondVariant<12, "nh", 1>; 1642 1643// A helper class to look up one of the above by name. 1644class ICV<string name> 1645 : CondVariant<!cast<CondVariant>("IntCondVariant"#name).ccmask, 1646 !cast<CondVariant>("IntCondVariant"#name).suffix, 1647 !cast<CondVariant>("IntCondVariant"#name).alternate>; 1648 1649//===----------------------------------------------------------------------===// 1650// Instruction definitions with semantics 1651//===----------------------------------------------------------------------===// 1652// 1653// These classes have the form [Cond]<Category><Format>, where <Format> is one 1654// of the formats defined above and where <Category> describes the inputs 1655// and outputs. "Cond" is used if the instruction is conditional, 1656// in which case the 4-bit condition-code mask is added as a final operand. 1657// <Category> can be one of: 1658// 1659// Inherent: 1660// One register output operand and no input operands. 1661// 1662// InherentDual: 1663// Two register output operands and no input operands. 1664// 1665// StoreInherent: 1666// One address operand. The instruction stores to the address. 1667// 1668// SideEffectInherent: 1669// No input or output operands, but causes some side effect. 1670// 1671// Branch: 1672// One branch target. The instruction branches to the target. 1673// 1674// Call: 1675// One output operand and one branch target. The instruction stores 1676// the return address to the output operand and branches to the target. 1677// 1678// CmpBranch: 1679// Two input operands and one optional branch target. The instruction 1680// compares the two input operands and branches or traps on the result. 1681// 1682// BranchUnary: 1683// One register output operand, one register input operand and one branch 1684// target. The instructions stores a modified form of the source register 1685// in the destination register and branches on the result. 1686// 1687// BranchBinary: 1688// One register output operand, two register input operands and one branch 1689// target. The instructions stores a modified form of one of the source 1690// registers in the destination register and branches on the result. 1691// 1692// LoadMultiple: 1693// One address input operand and two explicit output operands. 1694// The instruction loads a range of registers from the address, 1695// with the explicit operands giving the first and last register 1696// to load. Other loaded registers are added as implicit definitions. 1697// 1698// StoreMultiple: 1699// Two explicit input register operands and an address operand. 1700// The instruction stores a range of registers to the address, 1701// with the explicit operands giving the first and last register 1702// to store. Other stored registers are added as implicit uses. 1703// 1704// StoreLength: 1705// One value operand, one length operand and one address operand. 1706// The instruction stores the value operand to the address but 1707// doesn't write more than the number of bytes specified by the 1708// length operand. 1709// 1710// LoadAddress: 1711// One register output operand and one address operand. 1712// 1713// SideEffectAddress: 1714// One address operand. No output operands, but causes some side effect. 1715// 1716// Unary: 1717// One register output operand and one input operand. 1718// 1719// Store: 1720// One address operand and one other input operand. The instruction 1721// stores to the address. 1722// 1723// SideEffectUnary: 1724// One input operand. No output operands, but causes some side effect. 1725// 1726// Binary: 1727// One register output operand and two input operands. 1728// 1729// StoreBinary: 1730// One address operand and two other input operands. The instruction 1731// stores to the address. 1732// 1733// SideEffectBinary: 1734// Two input operands. No output operands, but causes some side effect. 1735// 1736// Compare: 1737// Two input operands and an implicit CC output operand. 1738// 1739// Test: 1740// One or two input operands and an implicit CC output operand. If 1741// present, the second input operand is an "address" operand used as 1742// a test class mask. 1743// 1744// Ternary: 1745// One register output operand and three input operands. 1746// 1747// SideEffectTernary: 1748// Three input operands. No output operands, but causes some side effect. 1749// 1750// Quaternary: 1751// One register output operand and four input operands. 1752// 1753// LoadAndOp: 1754// One output operand and two input operands, one of which is an address. 1755// The instruction both reads from and writes to the address. 1756// 1757// CmpSwap: 1758// One output operand and three input operands, one of which is an address. 1759// The instruction both reads from and writes to the address. 1760// 1761// RotateSelect: 1762// One output operand and five input operands. The first two operands 1763// are registers and the other three are immediates. 1764// 1765// Prefetch: 1766// One 4-bit immediate operand and one address operand. The immediate 1767// operand is 1 for a load prefetch and 2 for a store prefetch. 1768// 1769// BranchPreload: 1770// One 4-bit immediate operand and two address operands. 1771// 1772// The format determines which input operands are tied to output operands, 1773// and also determines the shape of any address operand. 1774// 1775// Multiclasses of the form <Category><Format>Pair define two instructions, 1776// one with <Category><Format> and one with <Category><Format>Y. The name 1777// of the first instruction has no suffix, the name of the second has 1778// an extra "y". 1779// 1780//===----------------------------------------------------------------------===// 1781 1782class InherentRRE<string mnemonic, bits<16> opcode, RegisterOperand cls, 1783 SDPatternOperator operator> 1784 : InstRRE<opcode, (outs cls:$R1), (ins), 1785 mnemonic#"\t$R1", 1786 [(set cls:$R1, (operator))]> { 1787 let R2 = 0; 1788} 1789 1790class InherentDualRRE<string mnemonic, bits<16> opcode, RegisterOperand cls> 1791 : InstRRE<opcode, (outs cls:$R1, cls:$R2), (ins), 1792 mnemonic#"\t$R1, $R2", []>; 1793 1794class InherentVRIa<string mnemonic, bits<16> opcode, bits<16> value> 1795 : InstVRIa<opcode, (outs VR128:$V1), (ins), mnemonic#"\t$V1", []> { 1796 let I2 = value; 1797 let M3 = 0; 1798} 1799 1800class StoreInherentS<string mnemonic, bits<16> opcode, 1801 SDPatternOperator operator, bits<5> bytes> 1802 : InstS<opcode, (outs), (ins bdaddr12only:$BD2), 1803 mnemonic#"\t$BD2", [(operator bdaddr12only:$BD2)]> { 1804 let mayStore = 1; 1805 let AccessBytes = bytes; 1806} 1807 1808class SideEffectInherentE<string mnemonic, bits<16>opcode> 1809 : InstE<opcode, (outs), (ins), mnemonic, []>; 1810 1811class SideEffectInherentS<string mnemonic, bits<16> opcode, 1812 SDPatternOperator operator> 1813 : InstS<opcode, (outs), (ins), mnemonic, [(operator)]> { 1814 let BD2 = 0; 1815} 1816 1817class SideEffectInherentRRE<string mnemonic, bits<16> opcode> 1818 : InstRRE<opcode, (outs), (ins), mnemonic, []> { 1819 let R1 = 0; 1820 let R2 = 0; 1821} 1822 1823// Allow an optional TLS marker symbol to generate TLS call relocations. 1824class CallRI<string mnemonic, bits<12> opcode> 1825 : InstRIb<opcode, (outs), (ins GR64:$R1, brtarget16tls:$RI2), 1826 mnemonic#"\t$R1, $RI2", []>; 1827 1828// Allow an optional TLS marker symbol to generate TLS call relocations. 1829class CallRIL<string mnemonic, bits<12> opcode> 1830 : InstRILb<opcode, (outs), (ins GR64:$R1, brtarget32tls:$RI2), 1831 mnemonic#"\t$R1, $RI2", []>; 1832 1833class CallRR<string mnemonic, bits<8> opcode> 1834 : InstRR<opcode, (outs), (ins GR64:$R1, ADDR64:$R2), 1835 mnemonic#"\t$R1, $R2", []>; 1836 1837class CallRX<string mnemonic, bits<8> opcode> 1838 : InstRXa<opcode, (outs), (ins GR64:$R1, bdxaddr12only:$XBD2), 1839 mnemonic#"\t$R1, $XBD2", []>; 1840 1841class CondBranchRI<string mnemonic, bits<12> opcode, 1842 SDPatternOperator operator = null_frag> 1843 : InstRIc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget16:$RI2), 1844 !subst("#", "${M1}", mnemonic)#"\t$RI2", 1845 [(operator cond4:$valid, cond4:$M1, bb:$RI2)]> { 1846 let CCMaskFirst = 1; 1847} 1848 1849class AsmCondBranchRI<string mnemonic, bits<12> opcode> 1850 : InstRIc<opcode, (outs), (ins imm32zx4:$M1, brtarget16:$RI2), 1851 mnemonic#"\t$M1, $RI2", []>; 1852 1853class FixedCondBranchRI<CondVariant V, string mnemonic, bits<12> opcode, 1854 SDPatternOperator operator = null_frag> 1855 : InstRIc<opcode, (outs), (ins brtarget16:$RI2), 1856 !subst("#", V.suffix, mnemonic)#"\t$RI2", [(operator bb:$RI2)]> { 1857 let isAsmParserOnly = V.alternate; 1858 let M1 = V.ccmask; 1859} 1860 1861class CondBranchRIL<string mnemonic, bits<12> opcode> 1862 : InstRILc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget32:$RI2), 1863 !subst("#", "${M1}", mnemonic)#"\t$RI2", []> { 1864 let CCMaskFirst = 1; 1865} 1866 1867class AsmCondBranchRIL<string mnemonic, bits<12> opcode> 1868 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, brtarget32:$RI2), 1869 mnemonic#"\t$M1, $RI2", []>; 1870 1871class FixedCondBranchRIL<CondVariant V, string mnemonic, bits<12> opcode> 1872 : InstRILc<opcode, (outs), (ins brtarget32:$RI2), 1873 !subst("#", V.suffix, mnemonic)#"\t$RI2", []> { 1874 let isAsmParserOnly = V.alternate; 1875 let M1 = V.ccmask; 1876} 1877 1878class CondBranchRR<string mnemonic, bits<8> opcode> 1879 : InstRR<opcode, (outs), (ins cond4:$valid, cond4:$R1, GR64:$R2), 1880 !subst("#", "${R1}", mnemonic)#"\t$R2", []> { 1881 let CCMaskFirst = 1; 1882} 1883 1884class AsmCondBranchRR<string mnemonic, bits<8> opcode> 1885 : InstRR<opcode, (outs), (ins imm32zx4:$R1, GR64:$R2), 1886 mnemonic#"\t$R1, $R2", []>; 1887 1888class FixedCondBranchRR<CondVariant V, string mnemonic, bits<8> opcode, 1889 SDPatternOperator operator = null_frag> 1890 : InstRR<opcode, (outs), (ins ADDR64:$R2), 1891 !subst("#", V.suffix, mnemonic)#"\t$R2", [(operator ADDR64:$R2)]> { 1892 let isAsmParserOnly = V.alternate; 1893 let R1 = V.ccmask; 1894} 1895 1896class CondBranchRX<string mnemonic, bits<8> opcode> 1897 : InstRXb<opcode, (outs), (ins cond4:$valid, cond4:$M1, bdxaddr12only:$XBD2), 1898 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> { 1899 let CCMaskFirst = 1; 1900} 1901 1902class AsmCondBranchRX<string mnemonic, bits<8> opcode> 1903 : InstRXb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr12only:$XBD2), 1904 mnemonic#"\t$M1, $XBD2", []>; 1905 1906class FixedCondBranchRX<CondVariant V, string mnemonic, bits<8> opcode> 1907 : InstRXb<opcode, (outs), (ins bdxaddr12only:$XBD2), 1908 !subst("#", V.suffix, mnemonic)#"\t$XBD2", []> { 1909 let isAsmParserOnly = V.alternate; 1910 let M1 = V.ccmask; 1911} 1912 1913class CmpBranchRIEa<string mnemonic, bits<16> opcode, 1914 RegisterOperand cls, Immediate imm> 1915 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, cond4:$M3), 1916 mnemonic#"$M3\t$R1, $I2", []>; 1917 1918class AsmCmpBranchRIEa<string mnemonic, bits<16> opcode, 1919 RegisterOperand cls, Immediate imm> 1920 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, imm32zx4:$M3), 1921 mnemonic#"\t$R1, $I2, $M3", []>; 1922 1923class FixedCmpBranchRIEa<CondVariant V, string mnemonic, bits<16> opcode, 1924 RegisterOperand cls, Immediate imm> 1925 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2), 1926 mnemonic#V.suffix#"\t$R1, $I2", []> { 1927 let isAsmParserOnly = V.alternate; 1928 let M3 = V.ccmask; 1929} 1930 1931multiclass CmpBranchRIEaPair<string mnemonic, bits<16> opcode, 1932 RegisterOperand cls, Immediate imm> { 1933 let isCodeGenOnly = 1 in 1934 def "" : CmpBranchRIEa<mnemonic, opcode, cls, imm>; 1935 def Asm : AsmCmpBranchRIEa<mnemonic, opcode, cls, imm>; 1936} 1937 1938class CmpBranchRIEb<string mnemonic, bits<16> opcode, 1939 RegisterOperand cls> 1940 : InstRIEb<opcode, (outs), 1941 (ins cls:$R1, cls:$R2, cond4:$M3, brtarget16:$RI4), 1942 mnemonic#"$M3\t$R1, $R2, $RI4", []>; 1943 1944class AsmCmpBranchRIEb<string mnemonic, bits<16> opcode, 1945 RegisterOperand cls> 1946 : InstRIEb<opcode, (outs), 1947 (ins cls:$R1, cls:$R2, imm32zx4:$M3, brtarget16:$RI4), 1948 mnemonic#"\t$R1, $R2, $M3, $RI4", []>; 1949 1950class FixedCmpBranchRIEb<CondVariant V, string mnemonic, bits<16> opcode, 1951 RegisterOperand cls> 1952 : InstRIEb<opcode, (outs), (ins cls:$R1, cls:$R2, brtarget16:$RI4), 1953 mnemonic#V.suffix#"\t$R1, $R2, $RI4", []> { 1954 let isAsmParserOnly = V.alternate; 1955 let M3 = V.ccmask; 1956} 1957 1958multiclass CmpBranchRIEbPair<string mnemonic, bits<16> opcode, 1959 RegisterOperand cls> { 1960 let isCodeGenOnly = 1 in 1961 def "" : CmpBranchRIEb<mnemonic, opcode, cls>; 1962 def Asm : AsmCmpBranchRIEb<mnemonic, opcode, cls>; 1963} 1964 1965class CmpBranchRIEc<string mnemonic, bits<16> opcode, 1966 RegisterOperand cls, Immediate imm> 1967 : InstRIEc<opcode, (outs), 1968 (ins cls:$R1, imm:$I2, cond4:$M3, brtarget16:$RI4), 1969 mnemonic#"$M3\t$R1, $I2, $RI4", []>; 1970 1971class AsmCmpBranchRIEc<string mnemonic, bits<16> opcode, 1972 RegisterOperand cls, Immediate imm> 1973 : InstRIEc<opcode, (outs), 1974 (ins cls:$R1, imm:$I2, imm32zx4:$M3, brtarget16:$RI4), 1975 mnemonic#"\t$R1, $I2, $M3, $RI4", []>; 1976 1977class FixedCmpBranchRIEc<CondVariant V, string mnemonic, bits<16> opcode, 1978 RegisterOperand cls, Immediate imm> 1979 : InstRIEc<opcode, (outs), (ins cls:$R1, imm:$I2, brtarget16:$RI4), 1980 mnemonic#V.suffix#"\t$R1, $I2, $RI4", []> { 1981 let isAsmParserOnly = V.alternate; 1982 let M3 = V.ccmask; 1983} 1984 1985multiclass CmpBranchRIEcPair<string mnemonic, bits<16> opcode, 1986 RegisterOperand cls, Immediate imm> { 1987 let isCodeGenOnly = 1 in 1988 def "" : CmpBranchRIEc<mnemonic, opcode, cls, imm>; 1989 def Asm : AsmCmpBranchRIEc<mnemonic, opcode, cls, imm>; 1990} 1991 1992class CmpBranchRRFc<string mnemonic, bits<16> opcode, 1993 RegisterOperand cls> 1994 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, cond4:$M3), 1995 mnemonic#"$M3\t$R1, $R2", []>; 1996 1997class AsmCmpBranchRRFc<string mnemonic, bits<16> opcode, 1998 RegisterOperand cls> 1999 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, imm32zx4:$M3), 2000 mnemonic#"\t$R1, $R2, $M3", []>; 2001 2002multiclass CmpBranchRRFcPair<string mnemonic, bits<16> opcode, 2003 RegisterOperand cls> { 2004 let isCodeGenOnly = 1 in 2005 def "" : CmpBranchRRFc<mnemonic, opcode, cls>; 2006 def Asm : AsmCmpBranchRRFc<mnemonic, opcode, cls>; 2007} 2008 2009class FixedCmpBranchRRFc<CondVariant V, string mnemonic, bits<16> opcode, 2010 RegisterOperand cls> 2011 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2), 2012 mnemonic#V.suffix#"\t$R1, $R2", []> { 2013 let isAsmParserOnly = V.alternate; 2014 let M3 = V.ccmask; 2015} 2016 2017class CmpBranchRRS<string mnemonic, bits<16> opcode, 2018 RegisterOperand cls> 2019 : InstRRS<opcode, (outs), 2020 (ins cls:$R1, cls:$R2, cond4:$M3, bdaddr12only:$BD4), 2021 mnemonic#"$M3\t$R1, $R2, $BD4", []>; 2022 2023class AsmCmpBranchRRS<string mnemonic, bits<16> opcode, 2024 RegisterOperand cls> 2025 : InstRRS<opcode, (outs), 2026 (ins cls:$R1, cls:$R2, imm32zx4:$M3, bdaddr12only:$BD4), 2027 mnemonic#"\t$R1, $R2, $M3, $BD4", []>; 2028 2029class FixedCmpBranchRRS<CondVariant V, string mnemonic, bits<16> opcode, 2030 RegisterOperand cls> 2031 : InstRRS<opcode, (outs), (ins cls:$R1, cls:$R2, bdaddr12only:$BD4), 2032 mnemonic#V.suffix#"\t$R1, $R2, $BD4", []> { 2033 let isAsmParserOnly = V.alternate; 2034 let M3 = V.ccmask; 2035} 2036 2037multiclass CmpBranchRRSPair<string mnemonic, bits<16> opcode, 2038 RegisterOperand cls> { 2039 let isCodeGenOnly = 1 in 2040 def "" : CmpBranchRRS<mnemonic, opcode, cls>; 2041 def Asm : AsmCmpBranchRRS<mnemonic, opcode, cls>; 2042} 2043 2044class CmpBranchRIS<string mnemonic, bits<16> opcode, 2045 RegisterOperand cls, Immediate imm> 2046 : InstRIS<opcode, (outs), 2047 (ins cls:$R1, imm:$I2, cond4:$M3, bdaddr12only:$BD4), 2048 mnemonic#"$M3\t$R1, $I2, $BD4", []>; 2049 2050class AsmCmpBranchRIS<string mnemonic, bits<16> opcode, 2051 RegisterOperand cls, Immediate imm> 2052 : InstRIS<opcode, (outs), 2053 (ins cls:$R1, imm:$I2, imm32zx4:$M3, bdaddr12only:$BD4), 2054 mnemonic#"\t$R1, $I2, $M3, $BD4", []>; 2055 2056class FixedCmpBranchRIS<CondVariant V, string mnemonic, bits<16> opcode, 2057 RegisterOperand cls, Immediate imm> 2058 : InstRIS<opcode, (outs), (ins cls:$R1, imm:$I2, bdaddr12only:$BD4), 2059 mnemonic#V.suffix#"\t$R1, $I2, $BD4", []> { 2060 let isAsmParserOnly = V.alternate; 2061 let M3 = V.ccmask; 2062} 2063 2064multiclass CmpBranchRISPair<string mnemonic, bits<16> opcode, 2065 RegisterOperand cls, Immediate imm> { 2066 let isCodeGenOnly = 1 in 2067 def "" : CmpBranchRIS<mnemonic, opcode, cls, imm>; 2068 def Asm : AsmCmpBranchRIS<mnemonic, opcode, cls, imm>; 2069} 2070 2071class CmpBranchRSYb<string mnemonic, bits<16> opcode, 2072 RegisterOperand cls> 2073 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, cond4:$M3), 2074 mnemonic#"$M3\t$R1, $BD2", []>; 2075 2076class AsmCmpBranchRSYb<string mnemonic, bits<16> opcode, 2077 RegisterOperand cls> 2078 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, imm32zx4:$M3), 2079 mnemonic#"\t$R1, $M3, $BD2", []>; 2080 2081multiclass CmpBranchRSYbPair<string mnemonic, bits<16> opcode, 2082 RegisterOperand cls> { 2083 let isCodeGenOnly = 1 in 2084 def "" : CmpBranchRSYb<mnemonic, opcode, cls>; 2085 def Asm : AsmCmpBranchRSYb<mnemonic, opcode, cls>; 2086} 2087 2088class FixedCmpBranchRSYb<CondVariant V, string mnemonic, bits<16> opcode, 2089 RegisterOperand cls> 2090 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2), 2091 mnemonic#V.suffix#"\t$R1, $BD2", []> { 2092 let isAsmParserOnly = V.alternate; 2093 let M3 = V.ccmask; 2094} 2095 2096class BranchUnaryRI<string mnemonic, bits<12> opcode, RegisterOperand cls> 2097 : InstRIb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget16:$RI2), 2098 mnemonic##"\t$R1, $RI2", []> { 2099 let Constraints = "$R1 = $R1src"; 2100 let DisableEncoding = "$R1src"; 2101} 2102 2103class BranchUnaryRIL<string mnemonic, bits<12> opcode, RegisterOperand cls> 2104 : InstRILb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget32:$RI2), 2105 mnemonic##"\t$R1, $RI2", []> { 2106 let Constraints = "$R1 = $R1src"; 2107 let DisableEncoding = "$R1src"; 2108} 2109 2110class BranchUnaryRR<string mnemonic, bits<8> opcode, RegisterOperand cls> 2111 : InstRR<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2), 2112 mnemonic##"\t$R1, $R2", []> { 2113 let Constraints = "$R1 = $R1src"; 2114 let DisableEncoding = "$R1src"; 2115} 2116 2117class BranchUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls> 2118 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2), 2119 mnemonic##"\t$R1, $R2", []> { 2120 let Constraints = "$R1 = $R1src"; 2121 let DisableEncoding = "$R1src"; 2122} 2123 2124class BranchUnaryRX<string mnemonic, bits<8> opcode, RegisterOperand cls> 2125 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2), 2126 mnemonic##"\t$R1, $XBD2", []> { 2127 let Constraints = "$R1 = $R1src"; 2128 let DisableEncoding = "$R1src"; 2129} 2130 2131class BranchUnaryRXY<string mnemonic, bits<16> opcode, RegisterOperand cls> 2132 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr20only:$XBD2), 2133 mnemonic##"\t$R1, $XBD2", []> { 2134 let Constraints = "$R1 = $R1src"; 2135 let DisableEncoding = "$R1src"; 2136} 2137 2138class BranchBinaryRSI<string mnemonic, bits<8> opcode, RegisterOperand cls> 2139 : InstRSI<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, brtarget16:$RI2), 2140 mnemonic##"\t$R1, $R3, $RI2", []> { 2141 let Constraints = "$R1 = $R1src"; 2142 let DisableEncoding = "$R1src"; 2143} 2144 2145class BranchBinaryRIEe<string mnemonic, bits<16> opcode, RegisterOperand cls> 2146 : InstRIEe<opcode, (outs cls:$R1), 2147 (ins cls:$R1src, cls:$R3, brtarget16:$RI2), 2148 mnemonic##"\t$R1, $R3, $RI2", []> { 2149 let Constraints = "$R1 = $R1src"; 2150 let DisableEncoding = "$R1src"; 2151} 2152 2153class BranchBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls> 2154 : InstRSa<opcode, (outs cls:$R1), 2155 (ins cls:$R1src, cls:$R3, bdaddr12only:$BD2), 2156 mnemonic##"\t$R1, $R3, $BD2", []> { 2157 let Constraints = "$R1 = $R1src"; 2158 let DisableEncoding = "$R1src"; 2159} 2160 2161class BranchBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls> 2162 : InstRSYa<opcode, 2163 (outs cls:$R1), (ins cls:$R1src, cls:$R3, bdaddr20only:$BD2), 2164 mnemonic##"\t$R1, $R3, $BD2", []> { 2165 let Constraints = "$R1 = $R1src"; 2166 let DisableEncoding = "$R1src"; 2167} 2168 2169class LoadMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls, 2170 AddressingMode mode = bdaddr12only> 2171 : InstRSa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2), 2172 mnemonic#"\t$R1, $R3, $BD2", []> { 2173 let mayLoad = 1; 2174} 2175 2176class LoadMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls, 2177 AddressingMode mode = bdaddr20only> 2178 : InstRSYa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2), 2179 mnemonic#"\t$R1, $R3, $BD2", []> { 2180 let mayLoad = 1; 2181} 2182 2183multiclass LoadMultipleRSPair<string mnemonic, bits<8> rsOpcode, 2184 bits<16> rsyOpcode, RegisterOperand cls> { 2185 let DispKey = mnemonic ## #cls in { 2186 let DispSize = "12" in 2187 def "" : LoadMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>; 2188 let DispSize = "20" in 2189 def Y : LoadMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>; 2190 } 2191} 2192 2193class LoadMultipleSSe<string mnemonic, bits<8> opcode, RegisterOperand cls> 2194 : InstSSe<opcode, (outs cls:$R1, cls:$R3), 2195 (ins bdaddr12only:$BD2, bdaddr12only:$BD4), 2196 mnemonic#"\t$R1, $R3, $BD2, $BD4", []> { 2197 let mayLoad = 1; 2198} 2199 2200class LoadMultipleVRSa<string mnemonic, bits<16> opcode> 2201 : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3), (ins bdaddr12only:$BD2), 2202 mnemonic#"\t$V1, $V3, $BD2", []> { 2203 let M4 = 0; 2204 let mayLoad = 1; 2205} 2206 2207class StoreRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator, 2208 RegisterOperand cls> 2209 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2), 2210 mnemonic#"\t$R1, $RI2", 2211 [(operator cls:$R1, pcrel32:$RI2)]> { 2212 let mayStore = 1; 2213 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 2214 // However, BDXs have two extra operands and are therefore 6 units more 2215 // complex. 2216 let AddedComplexity = 7; 2217} 2218 2219class StoreRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2220 RegisterOperand cls, bits<5> bytes, 2221 AddressingMode mode = bdxaddr12only> 2222 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2), 2223 mnemonic#"\t$R1, $XBD2", 2224 [(operator cls:$R1, mode:$XBD2)]> { 2225 let OpKey = mnemonic#"r"#cls; 2226 let OpType = "mem"; 2227 let mayStore = 1; 2228 let AccessBytes = bytes; 2229} 2230 2231class StoreRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2232 RegisterOperand cls, bits<5> bytes, 2233 AddressingMode mode = bdxaddr20only> 2234 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2), 2235 mnemonic#"\t$R1, $XBD2", 2236 [(operator cls:$R1, mode:$XBD2)]> { 2237 let OpKey = mnemonic#"r"#cls; 2238 let OpType = "mem"; 2239 let mayStore = 1; 2240 let AccessBytes = bytes; 2241} 2242 2243multiclass StoreRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 2244 SDPatternOperator operator, RegisterOperand cls, 2245 bits<5> bytes> { 2246 let DispKey = mnemonic ## #cls in { 2247 let DispSize = "12" in 2248 def "" : StoreRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>; 2249 let DispSize = "20" in 2250 def Y : StoreRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes, 2251 bdxaddr20pair>; 2252 } 2253} 2254 2255class StoreVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2256 TypedReg tr, bits<5> bytes, bits<4> type = 0> 2257 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2), 2258 mnemonic#"\t$V1, $XBD2", 2259 [(set tr.op:$V1, (tr.vt (operator bdxaddr12only:$XBD2)))]> { 2260 let M3 = type; 2261 let mayStore = 1; 2262 let AccessBytes = bytes; 2263} 2264 2265class StoreLengthVRSb<string mnemonic, bits<16> opcode, 2266 SDPatternOperator operator, bits<5> bytes> 2267 : InstVRSb<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2), 2268 mnemonic#"\t$V1, $R3, $BD2", 2269 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> { 2270 let M4 = 0; 2271 let mayStore = 1; 2272 let AccessBytes = bytes; 2273} 2274 2275class StoreMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls, 2276 AddressingMode mode = bdaddr12only> 2277 : InstRSa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2), 2278 mnemonic#"\t$R1, $R3, $BD2", []> { 2279 let mayStore = 1; 2280} 2281 2282class StoreMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls, 2283 AddressingMode mode = bdaddr20only> 2284 : InstRSYa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2), 2285 mnemonic#"\t$R1, $R3, $BD2", []> { 2286 let mayStore = 1; 2287} 2288 2289multiclass StoreMultipleRSPair<string mnemonic, bits<8> rsOpcode, 2290 bits<16> rsyOpcode, RegisterOperand cls> { 2291 let DispKey = mnemonic ## #cls in { 2292 let DispSize = "12" in 2293 def "" : StoreMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>; 2294 let DispSize = "20" in 2295 def Y : StoreMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>; 2296 } 2297} 2298 2299class StoreMultipleVRSa<string mnemonic, bits<16> opcode> 2300 : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3, bdaddr12only:$BD2), 2301 mnemonic#"\t$V1, $V3, $BD2", []> { 2302 let M4 = 0; 2303 let mayStore = 1; 2304} 2305 2306// StoreSI* instructions are used to store an integer to memory, but the 2307// addresses are more restricted than for normal stores. If we are in the 2308// situation of having to force either the address into a register or the 2309// constant into a register, it's usually better to do the latter. 2310// We therefore match the address in the same way as a normal store and 2311// only use the StoreSI* instruction if the matched address is suitable. 2312class StoreSI<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2313 Immediate imm> 2314 : InstSI<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2), 2315 mnemonic#"\t$BD1, $I2", 2316 [(operator imm:$I2, mviaddr12pair:$BD1)]> { 2317 let mayStore = 1; 2318} 2319 2320class StoreSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2321 Immediate imm> 2322 : InstSIY<opcode, (outs), (ins mviaddr20pair:$BD1, imm:$I2), 2323 mnemonic#"\t$BD1, $I2", 2324 [(operator imm:$I2, mviaddr20pair:$BD1)]> { 2325 let mayStore = 1; 2326} 2327 2328class StoreSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2329 Immediate imm> 2330 : InstSIL<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2), 2331 mnemonic#"\t$BD1, $I2", 2332 [(operator imm:$I2, mviaddr12pair:$BD1)]> { 2333 let mayStore = 1; 2334} 2335 2336multiclass StoreSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode, 2337 SDPatternOperator operator, Immediate imm> { 2338 let DispKey = mnemonic in { 2339 let DispSize = "12" in 2340 def "" : StoreSI<mnemonic, siOpcode, operator, imm>; 2341 let DispSize = "20" in 2342 def Y : StoreSIY<mnemonic#"y", siyOpcode, operator, imm>; 2343 } 2344} 2345 2346class StoreSSE<string mnemonic, bits<16> opcode> 2347 : InstSSE<opcode, (outs), (ins bdaddr12only:$BD1, bdaddr12only:$BD2), 2348 mnemonic#"\t$BD1, $BD2", []> { 2349 let mayStore = 1; 2350} 2351 2352class CondStoreRSY<string mnemonic, bits<16> opcode, 2353 RegisterOperand cls, bits<5> bytes, 2354 AddressingMode mode = bdaddr20only> 2355 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$M3), 2356 mnemonic#"$M3\t$R1, $BD2", []> { 2357 let mayStore = 1; 2358 let AccessBytes = bytes; 2359 let CCMaskLast = 1; 2360} 2361 2362// Like CondStoreRSY, but used for the raw assembly form. The condition-code 2363// mask is the third operand rather than being part of the mnemonic. 2364class AsmCondStoreRSY<string mnemonic, bits<16> opcode, 2365 RegisterOperand cls, bits<5> bytes, 2366 AddressingMode mode = bdaddr20only> 2367 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, imm32zx4:$M3), 2368 mnemonic#"\t$R1, $BD2, $M3", []> { 2369 let mayStore = 1; 2370 let AccessBytes = bytes; 2371} 2372 2373// Like CondStoreRSY, but with a fixed CC mask. 2374class FixedCondStoreRSY<CondVariant V, string mnemonic, bits<16> opcode, 2375 RegisterOperand cls, bits<5> bytes, 2376 AddressingMode mode = bdaddr20only> 2377 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2), 2378 mnemonic#V.suffix#"\t$R1, $BD2", []> { 2379 let mayStore = 1; 2380 let AccessBytes = bytes; 2381 let isAsmParserOnly = V.alternate; 2382 let M3 = V.ccmask; 2383} 2384 2385multiclass CondStoreRSYPair<string mnemonic, bits<16> opcode, 2386 RegisterOperand cls, bits<5> bytes, 2387 AddressingMode mode = bdaddr20only> { 2388 let isCodeGenOnly = 1 in 2389 def "" : CondStoreRSY<mnemonic, opcode, cls, bytes, mode>; 2390 def Asm : AsmCondStoreRSY<mnemonic, opcode, cls, bytes, mode>; 2391} 2392 2393class SideEffectUnaryI<string mnemonic, bits<8> opcode, Immediate imm> 2394 : InstI<opcode, (outs), (ins imm:$I1), 2395 mnemonic#"\t$I1", []>; 2396 2397class SideEffectUnaryRR<string mnemonic, bits<8>opcode, RegisterOperand cls> 2398 : InstRR<opcode, (outs), (ins cls:$R1), 2399 mnemonic#"\t$R1", []> { 2400 let R2 = 0; 2401} 2402 2403class SideEffectUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls, 2404 SDPatternOperator operator> 2405 : InstRRE<opcode, (outs), (ins cls:$R1), 2406 mnemonic#"\t$R1", [(operator cls:$R1)]> { 2407 let R2 = 0; 2408} 2409 2410class SideEffectUnaryS<string mnemonic, bits<16> opcode, 2411 SDPatternOperator operator, bits<5> bytes, 2412 AddressingMode mode = bdaddr12only> 2413 : InstS<opcode, (outs), (ins mode:$BD2), 2414 mnemonic#"\t$BD2", [(operator mode:$BD2)]> { 2415 let mayLoad = 1; 2416 let AccessBytes = bytes; 2417} 2418 2419class SideEffectAddressS<string mnemonic, bits<16> opcode, 2420 SDPatternOperator operator, 2421 AddressingMode mode = bdaddr12only> 2422 : InstS<opcode, (outs), (ins mode:$BD2), 2423 mnemonic#"\t$BD2", [(operator mode:$BD2)]>; 2424 2425class LoadAddressRX<string mnemonic, bits<8> opcode, 2426 SDPatternOperator operator, AddressingMode mode> 2427 : InstRXa<opcode, (outs GR64:$R1), (ins mode:$XBD2), 2428 mnemonic#"\t$R1, $XBD2", 2429 [(set GR64:$R1, (operator mode:$XBD2))]>; 2430 2431class LoadAddressRXY<string mnemonic, bits<16> opcode, 2432 SDPatternOperator operator, AddressingMode mode> 2433 : InstRXYa<opcode, (outs GR64:$R1), (ins mode:$XBD2), 2434 mnemonic#"\t$R1, $XBD2", 2435 [(set GR64:$R1, (operator mode:$XBD2))]>; 2436 2437multiclass LoadAddressRXPair<string mnemonic, bits<8> rxOpcode, 2438 bits<16> rxyOpcode, SDPatternOperator operator> { 2439 let DispKey = mnemonic in { 2440 let DispSize = "12" in 2441 def "" : LoadAddressRX<mnemonic, rxOpcode, operator, laaddr12pair>; 2442 let DispSize = "20" in 2443 def Y : LoadAddressRXY<mnemonic#"y", rxyOpcode, operator, laaddr20pair>; 2444 } 2445} 2446 2447class LoadAddressRIL<string mnemonic, bits<12> opcode, 2448 SDPatternOperator operator> 2449 : InstRILb<opcode, (outs GR64:$R1), (ins pcrel32:$RI2), 2450 mnemonic#"\t$R1, $RI2", 2451 [(set GR64:$R1, (operator pcrel32:$RI2))]>; 2452 2453class UnaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2454 RegisterOperand cls1, RegisterOperand cls2> 2455 : InstRR<opcode, (outs cls1:$R1), (ins cls2:$R2), 2456 mnemonic#"\t$R1, $R2", 2457 [(set cls1:$R1, (operator cls2:$R2))]> { 2458 let OpKey = mnemonic#cls1; 2459 let OpType = "reg"; 2460} 2461 2462class UnaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2463 RegisterOperand cls1, RegisterOperand cls2> 2464 : InstRRE<opcode, (outs cls1:$R1), (ins cls2:$R2), 2465 mnemonic#"\t$R1, $R2", 2466 [(set cls1:$R1, (operator cls2:$R2))]> { 2467 let OpKey = mnemonic#cls1; 2468 let OpType = "reg"; 2469} 2470 2471class UnaryMemRRFc<string mnemonic, bits<16> opcode, 2472 RegisterOperand cls1, RegisterOperand cls2> 2473 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src), 2474 mnemonic#"\t$R1, $R2", []> { 2475 let Constraints = "$R1 = $R1src"; 2476 let DisableEncoding = "$R1src"; 2477 let M3 = 0; 2478} 2479 2480class UnaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator, 2481 RegisterOperand cls, Immediate imm> 2482 : InstRIa<opcode, (outs cls:$R1), (ins imm:$I2), 2483 mnemonic#"\t$R1, $I2", 2484 [(set cls:$R1, (operator imm:$I2))]>; 2485 2486class UnaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator, 2487 RegisterOperand cls, Immediate imm> 2488 : InstRILa<opcode, (outs cls:$R1), (ins imm:$I2), 2489 mnemonic#"\t$R1, $I2", 2490 [(set cls:$R1, (operator imm:$I2))]>; 2491 2492class UnaryRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator, 2493 RegisterOperand cls> 2494 : InstRILb<opcode, (outs cls:$R1), (ins pcrel32:$RI2), 2495 mnemonic#"\t$R1, $RI2", 2496 [(set cls:$R1, (operator pcrel32:$RI2))]> { 2497 let mayLoad = 1; 2498 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 2499 // However, BDXs have two extra operands and are therefore 6 units more 2500 // complex. 2501 let AddedComplexity = 7; 2502} 2503 2504class CondUnaryRSY<string mnemonic, bits<16> opcode, 2505 SDPatternOperator operator, RegisterOperand cls, 2506 bits<5> bytes, AddressingMode mode = bdaddr20only> 2507 : InstRSYb<opcode, (outs cls:$R1), 2508 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$M3), 2509 mnemonic#"$M3\t$R1, $BD2", 2510 [(set cls:$R1, 2511 (z_select_ccmask (operator bdaddr20only:$BD2), cls:$R1src, 2512 cond4:$valid, cond4:$M3))]> { 2513 let Constraints = "$R1 = $R1src"; 2514 let DisableEncoding = "$R1src"; 2515 let mayLoad = 1; 2516 let AccessBytes = bytes; 2517 let CCMaskLast = 1; 2518} 2519 2520// Like CondUnaryRSY, but used for the raw assembly form. The condition-code 2521// mask is the third operand rather than being part of the mnemonic. 2522class AsmCondUnaryRSY<string mnemonic, bits<16> opcode, 2523 RegisterOperand cls, bits<5> bytes, 2524 AddressingMode mode = bdaddr20only> 2525 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2, imm32zx4:$M3), 2526 mnemonic#"\t$R1, $BD2, $M3", []> { 2527 let mayLoad = 1; 2528 let AccessBytes = bytes; 2529 let Constraints = "$R1 = $R1src"; 2530 let DisableEncoding = "$R1src"; 2531} 2532 2533// Like CondUnaryRSY, but with a fixed CC mask. 2534class FixedCondUnaryRSY<CondVariant V, string mnemonic, bits<16> opcode, 2535 RegisterOperand cls, bits<5> bytes, 2536 AddressingMode mode = bdaddr20only> 2537 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2), 2538 mnemonic#V.suffix#"\t$R1, $BD2", []> { 2539 let Constraints = "$R1 = $R1src"; 2540 let DisableEncoding = "$R1src"; 2541 let mayLoad = 1; 2542 let AccessBytes = bytes; 2543 let isAsmParserOnly = V.alternate; 2544 let M3 = V.ccmask; 2545} 2546 2547multiclass CondUnaryRSYPair<string mnemonic, bits<16> opcode, 2548 SDPatternOperator operator, 2549 RegisterOperand cls, bits<5> bytes, 2550 AddressingMode mode = bdaddr20only> { 2551 let isCodeGenOnly = 1 in 2552 def "" : CondUnaryRSY<mnemonic, opcode, operator, cls, bytes, mode>; 2553 def Asm : AsmCondUnaryRSY<mnemonic, opcode, cls, bytes, mode>; 2554} 2555 2556 2557class UnaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2558 RegisterOperand cls, bits<5> bytes, 2559 AddressingMode mode = bdxaddr12only> 2560 : InstRXa<opcode, (outs cls:$R1), (ins mode:$XBD2), 2561 mnemonic#"\t$R1, $XBD2", 2562 [(set cls:$R1, (operator mode:$XBD2))]> { 2563 let OpKey = mnemonic#"r"#cls; 2564 let OpType = "mem"; 2565 let mayLoad = 1; 2566 let AccessBytes = bytes; 2567} 2568 2569class UnaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2570 RegisterOperand cls, bits<5> bytes> 2571 : InstRXE<opcode, (outs cls:$R1), (ins bdxaddr12only:$XBD2), 2572 mnemonic#"\t$R1, $XBD2", 2573 [(set cls:$R1, (operator bdxaddr12only:$XBD2))]> { 2574 let OpKey = mnemonic#"r"#cls; 2575 let OpType = "mem"; 2576 let mayLoad = 1; 2577 let AccessBytes = bytes; 2578 let M3 = 0; 2579} 2580 2581class UnaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2582 RegisterOperand cls, bits<5> bytes, 2583 AddressingMode mode = bdxaddr20only> 2584 : InstRXYa<opcode, (outs cls:$R1), (ins mode:$XBD2), 2585 mnemonic#"\t$R1, $XBD2", 2586 [(set cls:$R1, (operator mode:$XBD2))]> { 2587 let OpKey = mnemonic#"r"#cls; 2588 let OpType = "mem"; 2589 let mayLoad = 1; 2590 let AccessBytes = bytes; 2591} 2592 2593multiclass UnaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 2594 SDPatternOperator operator, RegisterOperand cls, 2595 bits<5> bytes> { 2596 let DispKey = mnemonic ## #cls in { 2597 let DispSize = "12" in 2598 def "" : UnaryRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>; 2599 let DispSize = "20" in 2600 def Y : UnaryRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes, 2601 bdxaddr20pair>; 2602 } 2603} 2604 2605class UnaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2606 TypedReg tr, Immediate imm, bits<4> type = 0> 2607 : InstVRIa<opcode, (outs tr.op:$V1), (ins imm:$I2), 2608 mnemonic#"\t$V1, $I2", 2609 [(set tr.op:$V1, (tr.vt (operator imm:$I2)))]> { 2610 let M3 = type; 2611} 2612 2613class UnaryVRIaGeneric<string mnemonic, bits<16> opcode, Immediate imm> 2614 : InstVRIa<opcode, (outs VR128:$V1), (ins imm:$I2, imm32zx4:$M3), 2615 mnemonic#"\t$V1, $I2, $M3", []>; 2616 2617class UnaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2618 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0, 2619 bits<4> m5 = 0> 2620 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2), 2621 mnemonic#"\t$V1, $V2", 2622 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2))))]> { 2623 let M3 = type; 2624 let M4 = m4; 2625 let M5 = m5; 2626} 2627 2628class UnaryVRRaGeneric<string mnemonic, bits<16> opcode, bits<4> m4 = 0, 2629 bits<4> m5 = 0> 2630 : InstVRRa<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3), 2631 mnemonic#"\t$V1, $V2, $M3", []> { 2632 let M4 = m4; 2633 let M5 = m5; 2634} 2635 2636class UnaryVRRaFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0> 2637 : InstVRRa<opcode, (outs VR128:$V1), 2638 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4), 2639 mnemonic#"\t$V1, $V2, $M3, $M4", []> { 2640 let M5 = m5; 2641} 2642 2643// Declare a pair of instructions, one which sets CC and one which doesn't. 2644// The CC-setting form ends with "S" and sets the low bit of M5. 2645// The form that does not set CC has an extra operand to optionally allow 2646// specifying arbitrary M5 values in assembler. 2647multiclass UnaryExtraVRRaSPair<string mnemonic, bits<16> opcode, 2648 SDPatternOperator operator, 2649 SDPatternOperator operator_cc, 2650 TypedReg tr1, TypedReg tr2, bits<4> type> { 2651 let M3 = type, M4 = 0 in 2652 def "" : InstVRRa<opcode, (outs tr1.op:$V1), 2653 (ins tr2.op:$V2, imm32zx4:$M5), 2654 mnemonic#"\t$V1, $V2, $M5", []>; 2655 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2))), 2656 (!cast<Instruction>(NAME) tr2.op:$V2, 0)>; 2657 def : InstAlias<mnemonic#"\t$V1, $V2", 2658 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 0)>; 2659 let Defs = [CC] in 2660 def S : UnaryVRRa<mnemonic##"s", opcode, operator_cc, tr1, tr2, 2661 type, 0, 1>; 2662} 2663 2664multiclass UnaryExtraVRRaSPairGeneric<string mnemonic, bits<16> opcode> { 2665 let M4 = 0 in 2666 def "" : InstVRRa<opcode, (outs VR128:$V1), 2667 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M5), 2668 mnemonic#"\t$V1, $V2, $M3, $M5", []>; 2669 def : InstAlias<mnemonic#"\t$V1, $V2, $M3", 2670 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, 2671 imm32zx4:$M3, 0)>; 2672} 2673 2674class UnaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2675 TypedReg tr, bits<5> bytes, bits<4> type = 0> 2676 : InstVRX<opcode, (outs tr.op:$V1), (ins bdxaddr12only:$XBD2), 2677 mnemonic#"\t$V1, $XBD2", 2678 [(set tr.op:$V1, (tr.vt (operator bdxaddr12only:$XBD2)))]> { 2679 let M3 = type; 2680 let mayLoad = 1; 2681 let AccessBytes = bytes; 2682} 2683 2684class UnaryVRXGeneric<string mnemonic, bits<16> opcode> 2685 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3), 2686 mnemonic#"\t$V1, $XBD2, $M3", []> { 2687 let mayLoad = 1; 2688} 2689 2690class SideEffectBinaryRX<string mnemonic, bits<8> opcode, 2691 RegisterOperand cls> 2692 : InstRXa<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2), 2693 mnemonic##"\t$R1, $XBD2", []>; 2694 2695class SideEffectBinaryRILPC<string mnemonic, bits<12> opcode, 2696 RegisterOperand cls> 2697 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2), 2698 mnemonic##"\t$R1, $RI2", []> { 2699 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 2700 // However, BDXs have two extra operands and are therefore 6 units more 2701 // complex. 2702 let AddedComplexity = 7; 2703} 2704 2705class SideEffectBinaryIE<string mnemonic, bits<16> opcode, 2706 Immediate imm1, Immediate imm2> 2707 : InstIE<opcode, (outs), (ins imm1:$I1, imm2:$I2), 2708 mnemonic#"\t$I1, $I2", []>; 2709 2710class SideEffectBinarySI<string mnemonic, bits<8> opcode, Operand imm> 2711 : InstSI<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2), 2712 mnemonic#"\t$BD1, $I2", []>; 2713 2714class SideEffectBinarySIL<string mnemonic, bits<16> opcode, 2715 SDPatternOperator operator, Immediate imm> 2716 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2), 2717 mnemonic#"\t$BD1, $I2", [(operator bdaddr12only:$BD1, imm:$I2)]>; 2718 2719class SideEffectBinarySSa<string mnemonic, bits<8> opcode> 2720 : InstSSa<opcode, (outs), (ins bdladdr12onlylen8:$BDL1, bdaddr12only:$BD2), 2721 mnemonic##"\t$BDL1, $BD2", []>; 2722 2723class SideEffectBinarySSb<string mnemonic, bits<8> opcode> 2724 : InstSSb<opcode, 2725 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2), 2726 mnemonic##"\t$BDL1, $BDL2", []>; 2727 2728class SideEffectBinarySSf<string mnemonic, bits<8> opcode> 2729 : InstSSf<opcode, (outs), (ins bdaddr12only:$BD1, bdladdr12onlylen8:$BDL2), 2730 mnemonic##"\t$BD1, $BDL2", []>; 2731 2732class SideEffectBinaryMemMemRR<string mnemonic, bits<8> opcode, 2733 RegisterOperand cls1, RegisterOperand cls2> 2734 : InstRR<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src), 2735 mnemonic#"\t$R1, $R2", []> { 2736 let Constraints = "$R1 = $R1src, $R2 = $R2src"; 2737 let DisableEncoding = "$R1src, $R2src"; 2738} 2739 2740class SideEffectBinaryMemRRE<string mnemonic, bits<16> opcode, 2741 RegisterOperand cls1, RegisterOperand cls2> 2742 : InstRRE<opcode, (outs cls2:$R2), (ins cls1:$R1, cls2:$R2src), 2743 mnemonic#"\t$R1, $R2", []> { 2744 let Constraints = "$R2 = $R2src"; 2745 let DisableEncoding = "$R2src"; 2746} 2747 2748class SideEffectBinaryMemMemRRE<string mnemonic, bits<16> opcode, 2749 RegisterOperand cls1, RegisterOperand cls2> 2750 : InstRRE<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src), 2751 mnemonic#"\t$R1, $R2", []> { 2752 let Constraints = "$R1 = $R1src, $R2 = $R2src"; 2753 let DisableEncoding = "$R1src, $R2src"; 2754} 2755 2756class SideEffectBinaryMemMemRRFc<string mnemonic, bits<16> opcode, 2757 RegisterOperand cls1, RegisterOperand cls2> 2758 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src), 2759 mnemonic#"\t$R1, $R2", []> { 2760 let Constraints = "$R1 = $R1src, $R2 = $R2src"; 2761 let DisableEncoding = "$R1src, $R2src"; 2762 let M3 = 0; 2763} 2764 2765class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2766 RegisterOperand cls1, RegisterOperand cls2> 2767 : InstRR<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2), 2768 mnemonic#"\t$R1, $R2", 2769 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> { 2770 let OpKey = mnemonic#cls1; 2771 let OpType = "reg"; 2772 let Constraints = "$R1 = $R1src"; 2773 let DisableEncoding = "$R1src"; 2774} 2775 2776class BinaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2777 RegisterOperand cls1, RegisterOperand cls2> 2778 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2), 2779 mnemonic#"\t$R1, $R2", 2780 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> { 2781 let OpKey = mnemonic#cls1; 2782 let OpType = "reg"; 2783 let Constraints = "$R1 = $R1src"; 2784 let DisableEncoding = "$R1src"; 2785} 2786 2787class BinaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2788 RegisterOperand cls1, RegisterOperand cls2> 2789 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R3, cls2:$R2), 2790 mnemonic#"\t$R1, $R3, $R2", 2791 [(set cls1:$R1, (operator cls2:$R3, cls2:$R2))]> { 2792 let OpKey = mnemonic#cls; 2793 let OpType = "reg"; 2794} 2795 2796class BinaryRRFa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2797 RegisterOperand cls1, RegisterOperand cls2, 2798 RegisterOperand cls3> 2799 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3), 2800 mnemonic#"\t$R1, $R2, $R3", 2801 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> { 2802 let M4 = 0; 2803} 2804 2805multiclass BinaryRRAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2, 2806 SDPatternOperator operator, RegisterOperand cls1, 2807 RegisterOperand cls2> { 2808 let NumOpsKey = mnemonic in { 2809 let NumOpsValue = "3" in 2810 def K : BinaryRRFa<mnemonic#"k", opcode2, null_frag, cls1, cls1, cls2>, 2811 Requires<[FeatureDistinctOps]>; 2812 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in 2813 def "" : BinaryRR<mnemonic, opcode1, operator, cls1, cls2>; 2814 } 2815} 2816 2817multiclass BinaryRREAndK<string mnemonic, bits<16> opcode1, bits<16> opcode2, 2818 SDPatternOperator operator, RegisterOperand cls1, 2819 RegisterOperand cls2> { 2820 let NumOpsKey = mnemonic in { 2821 let NumOpsValue = "3" in 2822 def K : BinaryRRFa<mnemonic#"k", opcode2, null_frag, cls1, cls1, cls2>, 2823 Requires<[FeatureDistinctOps]>; 2824 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in 2825 def "" : BinaryRRE<mnemonic, opcode1, operator, cls1, cls2>; 2826 } 2827} 2828 2829class BinaryRRFb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2830 RegisterOperand cls1, RegisterOperand cls2, 2831 RegisterOperand cls3> 2832 : InstRRFb<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3), 2833 mnemonic#"\t$R1, $R3, $R2", 2834 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> { 2835 let M4 = 0; 2836} 2837 2838class BinaryMemRRFc<string mnemonic, bits<16> opcode, 2839 RegisterOperand cls1, RegisterOperand cls2, Immediate imm> 2840 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src, imm:$M3), 2841 mnemonic#"\t$R1, $R2, $M3", []> { 2842 let Constraints = "$R1 = $R1src"; 2843 let DisableEncoding = "$R1src"; 2844} 2845 2846multiclass BinaryMemRRFcOpt<string mnemonic, bits<16> opcode, 2847 RegisterOperand cls1, RegisterOperand cls2> { 2848 def "" : BinaryMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>; 2849 def Opt : UnaryMemRRFc<mnemonic, opcode, cls1, cls2>; 2850} 2851 2852class BinaryRRFd<string mnemonic, bits<16> opcode, RegisterOperand cls1, 2853 RegisterOperand cls2> 2854 : InstRRFd<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M4), 2855 mnemonic#"\t$R1, $R2, $M4", []>; 2856 2857class BinaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1, 2858 RegisterOperand cls2> 2859 : InstRRFe<opcode, (outs cls1:$R1), (ins imm32zx4:$M3, cls2:$R2), 2860 mnemonic#"\t$R1, $M3, $R2", []> { 2861 let M4 = 0; 2862} 2863 2864class CondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 2865 RegisterOperand cls2> 2866 : InstRRFc<opcode, (outs cls1:$R1), 2867 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3), 2868 mnemonic#"$M3\t$R1, $R2", []> { 2869 let Constraints = "$R1 = $R1src"; 2870 let DisableEncoding = "$R1src"; 2871 let CCMaskLast = 1; 2872} 2873 2874// Like CondBinaryRRF, but used for the raw assembly form. The condition-code 2875// mask is the third operand rather than being part of the mnemonic. 2876class AsmCondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 2877 RegisterOperand cls2> 2878 : InstRRFc<opcode, (outs cls1:$R1), 2879 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M3), 2880 mnemonic#"\t$R1, $R2, $M3", []> { 2881 let Constraints = "$R1 = $R1src"; 2882 let DisableEncoding = "$R1src"; 2883} 2884 2885// Like CondBinaryRRF, but with a fixed CC mask. 2886class FixedCondBinaryRRF<CondVariant V, string mnemonic, bits<16> opcode, 2887 RegisterOperand cls1, RegisterOperand cls2> 2888 : InstRRFc<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2), 2889 mnemonic#V.suffix#"\t$R1, $R2", []> { 2890 let Constraints = "$R1 = $R1src"; 2891 let DisableEncoding = "$R1src"; 2892 let isAsmParserOnly = V.alternate; 2893 let M3 = V.ccmask; 2894} 2895 2896multiclass CondBinaryRRFPair<string mnemonic, bits<16> opcode, 2897 RegisterOperand cls1, RegisterOperand cls2> { 2898 let isCodeGenOnly = 1 in 2899 def "" : CondBinaryRRF<mnemonic, opcode, cls1, cls2>; 2900 def Asm : AsmCondBinaryRRF<mnemonic, opcode, cls1, cls2>; 2901} 2902 2903class BinaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator, 2904 RegisterOperand cls, Immediate imm> 2905 : InstRIa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 2906 mnemonic#"\t$R1, $I2", 2907 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 2908 let Constraints = "$R1 = $R1src"; 2909 let DisableEncoding = "$R1src"; 2910} 2911 2912class BinaryRIE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2913 RegisterOperand cls, Immediate imm> 2914 : InstRIEd<opcode, (outs cls:$R1), (ins cls:$R3, imm:$I2), 2915 mnemonic#"\t$R1, $R3, $I2", 2916 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>; 2917 2918multiclass BinaryRIAndK<string mnemonic, bits<12> opcode1, bits<16> opcode2, 2919 SDPatternOperator operator, RegisterOperand cls, 2920 Immediate imm> { 2921 let NumOpsKey = mnemonic in { 2922 let NumOpsValue = "3" in 2923 def K : BinaryRIE<mnemonic##"k", opcode2, null_frag, cls, imm>, 2924 Requires<[FeatureDistinctOps]>; 2925 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in 2926 def "" : BinaryRI<mnemonic, opcode1, operator, cls, imm>; 2927 } 2928} 2929 2930class CondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls, 2931 Immediate imm> 2932 : InstRIEg<opcode, (outs cls:$R1), 2933 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3), 2934 mnemonic#"$M3\t$R1, $I2", 2935 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src, 2936 cond4:$valid, cond4:$M3))]> { 2937 let Constraints = "$R1 = $R1src"; 2938 let DisableEncoding = "$R1src"; 2939 let CCMaskLast = 1; 2940} 2941 2942// Like CondBinaryRIE, but used for the raw assembly form. The condition-code 2943// mask is the third operand rather than being part of the mnemonic. 2944class AsmCondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls, 2945 Immediate imm> 2946 : InstRIEg<opcode, (outs cls:$R1), 2947 (ins cls:$R1src, imm:$I2, imm32zx4:$M3), 2948 mnemonic#"\t$R1, $I2, $M3", []> { 2949 let Constraints = "$R1 = $R1src"; 2950 let DisableEncoding = "$R1src"; 2951} 2952 2953// Like CondBinaryRIE, but with a fixed CC mask. 2954class FixedCondBinaryRIE<CondVariant V, string mnemonic, bits<16> opcode, 2955 RegisterOperand cls, Immediate imm> 2956 : InstRIEg<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 2957 mnemonic#V.suffix#"\t$R1, $I2", []> { 2958 let Constraints = "$R1 = $R1src"; 2959 let DisableEncoding = "$R1src"; 2960 let isAsmParserOnly = V.alternate; 2961 let M3 = V.ccmask; 2962} 2963 2964multiclass CondBinaryRIEPair<string mnemonic, bits<16> opcode, 2965 RegisterOperand cls, Immediate imm> { 2966 let isCodeGenOnly = 1 in 2967 def "" : CondBinaryRIE<mnemonic, opcode, cls, imm>; 2968 def Asm : AsmCondBinaryRIE<mnemonic, opcode, cls, imm>; 2969} 2970 2971class BinaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator, 2972 RegisterOperand cls, Immediate imm> 2973 : InstRILa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 2974 mnemonic#"\t$R1, $I2", 2975 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 2976 let Constraints = "$R1 = $R1src"; 2977 let DisableEncoding = "$R1src"; 2978} 2979 2980class BinaryRS<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2981 RegisterOperand cls> 2982 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, shift12only:$BD2), 2983 mnemonic#"\t$R1, $BD2", 2984 [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> { 2985 let R3 = 0; 2986 let Constraints = "$R1 = $R1src"; 2987 let DisableEncoding = "$R1src"; 2988} 2989 2990class BinaryRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2991 RegisterOperand cls> 2992 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, shift20only:$BD2), 2993 mnemonic#"\t$R1, $R3, $BD2", 2994 [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>; 2995 2996multiclass BinaryRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2, 2997 SDPatternOperator operator, RegisterOperand cls> { 2998 let NumOpsKey = mnemonic in { 2999 let NumOpsValue = "3" in 3000 def K : BinaryRSY<mnemonic##"k", opcode2, null_frag, cls>, 3001 Requires<[FeatureDistinctOps]>; 3002 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in 3003 def "" : BinaryRS<mnemonic, opcode1, operator, cls>; 3004 } 3005} 3006 3007class BinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls> 3008 : InstRSLb<opcode, (outs cls:$R1), 3009 (ins bdladdr12onlylen8:$BDL2, imm32zx4:$M3), 3010 mnemonic#"\t$R1, $BDL2, $M3", []> { 3011 let mayLoad = 1; 3012} 3013 3014class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 3015 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 3016 AddressingMode mode = bdxaddr12only> 3017 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2), 3018 mnemonic#"\t$R1, $XBD2", 3019 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> { 3020 let OpKey = mnemonic#"r"#cls; 3021 let OpType = "mem"; 3022 let Constraints = "$R1 = $R1src"; 3023 let DisableEncoding = "$R1src"; 3024 let mayLoad = 1; 3025 let AccessBytes = bytes; 3026} 3027 3028class BinaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3029 RegisterOperand cls, SDPatternOperator load, bits<5> bytes> 3030 : InstRXE<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2), 3031 mnemonic#"\t$R1, $XBD2", 3032 [(set cls:$R1, (operator cls:$R1src, 3033 (load bdxaddr12only:$XBD2)))]> { 3034 let OpKey = mnemonic#"r"#cls; 3035 let OpType = "mem"; 3036 let Constraints = "$R1 = $R1src"; 3037 let DisableEncoding = "$R1src"; 3038 let mayLoad = 1; 3039 let AccessBytes = bytes; 3040 let M3 = 0; 3041} 3042 3043class BinaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3044 RegisterOperand cls1, RegisterOperand cls2, 3045 SDPatternOperator load, bits<5> bytes> 3046 : InstRXF<opcode, (outs cls1:$R1), (ins cls2:$R3, bdxaddr12only:$XBD2), 3047 mnemonic#"\t$R1, $R3, $XBD2", 3048 [(set cls1:$R1, (operator cls2:$R3, (load bdxaddr12only:$XBD2)))]> { 3049 let OpKey = mnemonic#"r"#cls; 3050 let OpType = "mem"; 3051 let mayLoad = 1; 3052 let AccessBytes = bytes; 3053} 3054 3055class BinaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3056 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 3057 AddressingMode mode = bdxaddr20only> 3058 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2), 3059 mnemonic#"\t$R1, $XBD2", 3060 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> { 3061 let OpKey = mnemonic#"r"#cls; 3062 let OpType = "mem"; 3063 let Constraints = "$R1 = $R1src"; 3064 let DisableEncoding = "$R1src"; 3065 let mayLoad = 1; 3066 let AccessBytes = bytes; 3067} 3068 3069multiclass BinaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 3070 SDPatternOperator operator, RegisterOperand cls, 3071 SDPatternOperator load, bits<5> bytes> { 3072 let DispKey = mnemonic ## #cls in { 3073 let DispSize = "12" in 3074 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes, 3075 bdxaddr12pair>; 3076 let DispSize = "20" in 3077 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load, bytes, 3078 bdxaddr20pair>; 3079 } 3080} 3081 3082class BinarySI<string mnemonic, bits<8> opcode, SDPatternOperator operator, 3083 Operand imm, AddressingMode mode = bdaddr12only> 3084 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2), 3085 mnemonic#"\t$BD1, $I2", 3086 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> { 3087 let mayLoad = 1; 3088 let mayStore = 1; 3089} 3090 3091class BinarySIY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3092 Operand imm, AddressingMode mode = bdaddr20only> 3093 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2), 3094 mnemonic#"\t$BD1, $I2", 3095 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> { 3096 let mayLoad = 1; 3097 let mayStore = 1; 3098} 3099 3100multiclass BinarySIPair<string mnemonic, bits<8> siOpcode, 3101 bits<16> siyOpcode, SDPatternOperator operator, 3102 Operand imm> { 3103 let DispKey = mnemonic ## #cls in { 3104 let DispSize = "12" in 3105 def "" : BinarySI<mnemonic, siOpcode, operator, imm, bdaddr12pair>; 3106 let DispSize = "20" in 3107 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>; 3108 } 3109} 3110 3111class BinarySSF<string mnemonic, bits<12> opcode, RegisterOperand cls> 3112 : InstSSF<opcode, (outs cls:$R3), (ins bdaddr12pair:$BD1, bdaddr12pair:$BD2), 3113 mnemonic#"\t$R3, $BD1, $BD2", []> { 3114 let mayLoad = 1; 3115} 3116 3117class BinaryVRIb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3118 TypedReg tr, bits<4> type> 3119 : InstVRIb<opcode, (outs tr.op:$V1), (ins imm32zx8:$I2, imm32zx8:$I3), 3120 mnemonic#"\t$V1, $I2, $I3", 3121 [(set tr.op:$V1, (tr.vt (operator imm32zx8:$I2, imm32zx8:$I3)))]> { 3122 let M4 = type; 3123} 3124 3125class BinaryVRIbGeneric<string mnemonic, bits<16> opcode> 3126 : InstVRIb<opcode, (outs VR128:$V1), 3127 (ins imm32zx8:$I2, imm32zx8:$I3, imm32zx4:$M4), 3128 mnemonic#"\t$V1, $I2, $I3, $M4", []>; 3129 3130class BinaryVRIc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3131 TypedReg tr1, TypedReg tr2, bits<4> type> 3132 : InstVRIc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, imm32zx16:$I2), 3133 mnemonic#"\t$V1, $V3, $I2", 3134 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V3), 3135 imm32zx16:$I2)))]> { 3136 let M4 = type; 3137} 3138 3139class BinaryVRIcGeneric<string mnemonic, bits<16> opcode> 3140 : InstVRIc<opcode, (outs VR128:$V1), 3141 (ins VR128:$V3, imm32zx16:$I2, imm32zx4:$M4), 3142 mnemonic#"\t$V1, $V3, $I2, $M4", []>; 3143 3144class BinaryVRIe<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3145 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5> 3146 : InstVRIe<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx12:$I3), 3147 mnemonic#"\t$V1, $V2, $I3", 3148 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3149 imm32zx12:$I3)))]> { 3150 let M4 = type; 3151 let M5 = m5; 3152} 3153 3154class BinaryVRIeFloatGeneric<string mnemonic, bits<16> opcode> 3155 : InstVRIe<opcode, (outs VR128:$V1), 3156 (ins VR128:$V2, imm32zx12:$I3, imm32zx4:$M4, imm32zx4:$M5), 3157 mnemonic#"\t$V1, $V2, $I3, $M4, $M5", []>; 3158 3159class BinaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3160 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0> 3161 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx4:$M5), 3162 mnemonic#"\t$V1, $V2, $M5", 3163 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3164 imm32zx12:$M5)))]> { 3165 let M3 = type; 3166 let M4 = m4; 3167} 3168 3169class BinaryVRRaFloatGeneric<string mnemonic, bits<16> opcode> 3170 : InstVRRa<opcode, (outs VR128:$V1), 3171 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5), 3172 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>; 3173 3174class BinaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3175 TypedReg tr1, TypedReg tr2, bits<4> type = 0, 3176 bits<4> modifier = 0> 3177 : InstVRRb<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3), 3178 mnemonic#"\t$V1, $V2, $V3", 3179 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3180 (tr2.vt tr2.op:$V3))))]> { 3181 let M4 = type; 3182 let M5 = modifier; 3183} 3184 3185// Declare a pair of instructions, one which sets CC and one which doesn't. 3186// The CC-setting form ends with "S" and sets the low bit of M5. 3187multiclass BinaryVRRbSPair<string mnemonic, bits<16> opcode, 3188 SDPatternOperator operator, 3189 SDPatternOperator operator_cc, TypedReg tr1, 3190 TypedReg tr2, bits<4> type, bits<4> modifier = 0> { 3191 def "" : BinaryVRRb<mnemonic, opcode, operator, tr1, tr2, type, 3192 !and (modifier, 14)>; 3193 let Defs = [CC] in 3194 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 3195 !add (!and (modifier, 14), 1)>; 3196} 3197 3198class BinaryVRRbSPairGeneric<string mnemonic, bits<16> opcode> 3199 : InstVRRb<opcode, (outs VR128:$V1), 3200 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5), 3201 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>; 3202 3203// Declare a pair of instructions, one which sets CC and one which doesn't. 3204// The CC-setting form ends with "S" and sets the low bit of M5. 3205// The form that does not set CC has an extra operand to optionally allow 3206// specifying arbitrary M5 values in assembler. 3207multiclass BinaryExtraVRRbSPair<string mnemonic, bits<16> opcode, 3208 SDPatternOperator operator, 3209 SDPatternOperator operator_cc, 3210 TypedReg tr1, TypedReg tr2, bits<4> type> { 3211 let M4 = type in 3212 def "" : InstVRRb<opcode, (outs tr1.op:$V1), 3213 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M5), 3214 mnemonic#"\t$V1, $V2, $V3, $M5", []>; 3215 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3))), 3216 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, 0)>; 3217 def : InstAlias<mnemonic#"\t$V1, $V2, $V3", 3218 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 3219 tr2.op:$V3, 0)>; 3220 let Defs = [CC] in 3221 def S : BinaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 1>; 3222} 3223 3224multiclass BinaryExtraVRRbSPairGeneric<string mnemonic, bits<16> opcode> { 3225 def "" : InstVRRb<opcode, (outs VR128:$V1), 3226 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5), 3227 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>; 3228 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4", 3229 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3, 3230 imm32zx4:$M4, 0)>; 3231} 3232 3233class BinaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3234 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0, 3235 bits<4> m6 = 0> 3236 : InstVRRc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3), 3237 mnemonic#"\t$V1, $V2, $V3", 3238 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3239 (tr2.vt tr2.op:$V3))))]> { 3240 let M4 = type; 3241 let M5 = m5; 3242 let M6 = m6; 3243} 3244 3245class BinaryVRRcGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0, 3246 bits<4> m6 = 0> 3247 : InstVRRc<opcode, (outs VR128:$V1), 3248 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4), 3249 mnemonic#"\t$V1, $V2, $V3, $M4", []> { 3250 let M5 = m5; 3251 let M6 = m6; 3252} 3253 3254class BinaryVRRcFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m6 = 0> 3255 : InstVRRc<opcode, (outs VR128:$V1), 3256 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5), 3257 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> { 3258 let M6 = m6; 3259} 3260 3261// Declare a pair of instructions, one which sets CC and one which doesn't. 3262// The CC-setting form ends with "S" and sets the low bit of M5. 3263multiclass BinaryVRRcSPair<string mnemonic, bits<16> opcode, 3264 SDPatternOperator operator, 3265 SDPatternOperator operator_cc, TypedReg tr1, 3266 TypedReg tr2, bits<4> type, bits<4> m5, 3267 bits<4> modifier = 0> { 3268 def "" : BinaryVRRc<mnemonic, opcode, operator, tr1, tr2, type, 3269 m5, !and (modifier, 14)>; 3270 let Defs = [CC] in 3271 def S : BinaryVRRc<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 3272 m5, !add (!and (modifier, 14), 1)>; 3273} 3274 3275class BinaryVRRcSPairFloatGeneric<string mnemonic, bits<16> opcode> 3276 : InstVRRc<opcode, (outs VR128:$V1), 3277 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5, 3278 imm32zx4:$M6), 3279 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>; 3280 3281class BinaryVRRf<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3282 TypedReg tr> 3283 : InstVRRf<opcode, (outs tr.op:$V1), (ins GR64:$R2, GR64:$R3), 3284 mnemonic#"\t$V1, $R2, $R3", 3285 [(set tr.op:$V1, (tr.vt (operator GR64:$R2, GR64:$R3)))]>; 3286 3287class BinaryVRSa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3288 TypedReg tr1, TypedReg tr2, bits<4> type> 3289 : InstVRSa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, shift12only:$BD2), 3290 mnemonic#"\t$V1, $V3, $BD2", 3291 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V3), 3292 shift12only:$BD2)))]> { 3293 let M4 = type; 3294} 3295 3296class BinaryVRSaGeneric<string mnemonic, bits<16> opcode> 3297 : InstVRSa<opcode, (outs VR128:$V1), 3298 (ins VR128:$V3, shift12only:$BD2, imm32zx4:$M4), 3299 mnemonic#"\t$V1, $V3, $BD2, $M4", []>; 3300 3301class BinaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3302 bits<5> bytes> 3303 : InstVRSb<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2), 3304 mnemonic#"\t$V1, $R3, $BD2", 3305 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> { 3306 let M4 = 0; 3307 let mayLoad = 1; 3308 let AccessBytes = bytes; 3309} 3310 3311class BinaryVRSc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3312 TypedReg tr, bits<4> type> 3313 : InstVRSc<opcode, (outs GR64:$R1), (ins tr.op:$V3, shift12only:$BD2), 3314 mnemonic#"\t$R1, $V3, $BD2", 3315 [(set GR64:$R1, (operator (tr.vt tr.op:$V3), shift12only:$BD2))]> { 3316 let M4 = type; 3317} 3318 3319class BinaryVRScGeneric<string mnemonic, bits<16> opcode> 3320 : InstVRSc<opcode, (outs GR64:$R1), 3321 (ins VR128:$V3, shift12only:$BD2, imm32zx4: $M4), 3322 mnemonic#"\t$R1, $V3, $BD2, $M4", []>; 3323 3324class BinaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3325 TypedReg tr, bits<5> bytes> 3326 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3), 3327 mnemonic#"\t$V1, $XBD2, $M3", 3328 [(set tr.op:$V1, (tr.vt (operator bdxaddr12only:$XBD2, 3329 imm32zx4:$M3)))]> { 3330 let mayLoad = 1; 3331 let AccessBytes = bytes; 3332} 3333 3334class StoreBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls, 3335 bits<5> bytes, AddressingMode mode = bdaddr12only> 3336 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2), 3337 mnemonic#"\t$R1, $M3, $BD2", []> { 3338 let mayStore = 1; 3339 let AccessBytes = bytes; 3340} 3341 3342class StoreBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls, 3343 bits<5> bytes, AddressingMode mode = bdaddr20only> 3344 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2), 3345 mnemonic#"\t$R1, $M3, $BD2", []> { 3346 let mayStore = 1; 3347 let AccessBytes = bytes; 3348} 3349 3350multiclass StoreBinaryRSPair<string mnemonic, bits<8> rsOpcode, 3351 bits<16> rsyOpcode, RegisterOperand cls, 3352 bits<5> bytes> { 3353 let DispKey = mnemonic ## #cls in { 3354 let DispSize = "12" in 3355 def "" : StoreBinaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>; 3356 let DispSize = "20" in 3357 def Y : StoreBinaryRSY<mnemonic#"y", rsyOpcode, cls, bytes, 3358 bdaddr20pair>; 3359 } 3360} 3361 3362class StoreBinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls> 3363 : InstRSLb<opcode, (outs), 3364 (ins cls:$R1, bdladdr12onlylen8:$BDL2, imm32zx4:$M3), 3365 mnemonic#"\t$R1, $BDL2, $M3", []> { 3366 let mayStore = 1; 3367} 3368 3369class StoreBinaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes, 3370 Immediate index> 3371 : InstVRV<opcode, (outs), (ins VR128:$V1, bdvaddr12only:$VBD2, index:$M3), 3372 mnemonic#"\t$V1, $VBD2, $M3", []> { 3373 let mayStore = 1; 3374 let AccessBytes = bytes; 3375} 3376 3377class StoreBinaryVRX<string mnemonic, bits<16> opcode, 3378 SDPatternOperator operator, TypedReg tr, bits<5> bytes, 3379 Immediate index> 3380 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2, index:$M3), 3381 mnemonic#"\t$V1, $XBD2, $M3", 3382 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2, index:$M3)]> { 3383 let mayStore = 1; 3384 let AccessBytes = bytes; 3385} 3386 3387class MemoryBinarySSd<string mnemonic, bits<8> opcode, 3388 RegisterOperand cls> 3389 : InstSSd<opcode, (outs), 3390 (ins bdraddr12only:$RBD1, bdaddr12only:$BD2, cls:$R3), 3391 mnemonic#"\t$RBD1, $BD2, $R3", []>; 3392 3393class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator, 3394 RegisterOperand cls1, RegisterOperand cls2> 3395 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2), 3396 mnemonic#"\t$R1, $R2", 3397 [(operator cls1:$R1, cls2:$R2)]> { 3398 let OpKey = mnemonic#cls1; 3399 let OpType = "reg"; 3400 let isCompare = 1; 3401} 3402 3403class CompareRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3404 RegisterOperand cls1, RegisterOperand cls2> 3405 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2), 3406 mnemonic#"\t$R1, $R2", 3407 [(operator cls1:$R1, cls2:$R2)]> { 3408 let OpKey = mnemonic#cls1; 3409 let OpType = "reg"; 3410 let isCompare = 1; 3411} 3412 3413class CompareRI<string mnemonic, bits<12> opcode, SDPatternOperator operator, 3414 RegisterOperand cls, Immediate imm> 3415 : InstRIa<opcode, (outs), (ins cls:$R1, imm:$I2), 3416 mnemonic#"\t$R1, $I2", 3417 [(operator cls:$R1, imm:$I2)]> { 3418 let isCompare = 1; 3419} 3420 3421class CompareRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator, 3422 RegisterOperand cls, Immediate imm> 3423 : InstRILa<opcode, (outs), (ins cls:$R1, imm:$I2), 3424 mnemonic#"\t$R1, $I2", 3425 [(operator cls:$R1, imm:$I2)]> { 3426 let isCompare = 1; 3427} 3428 3429class CompareRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator, 3430 RegisterOperand cls, SDPatternOperator load> 3431 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2), 3432 mnemonic#"\t$R1, $RI2", 3433 [(operator cls:$R1, (load pcrel32:$RI2))]> { 3434 let isCompare = 1; 3435 let mayLoad = 1; 3436 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 3437 // However, BDXs have two extra operands and are therefore 6 units more 3438 // complex. 3439 let AddedComplexity = 7; 3440} 3441 3442class CompareRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 3443 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 3444 AddressingMode mode = bdxaddr12only> 3445 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2), 3446 mnemonic#"\t$R1, $XBD2", 3447 [(operator cls:$R1, (load mode:$XBD2))]> { 3448 let OpKey = mnemonic#"r"#cls; 3449 let OpType = "mem"; 3450 let isCompare = 1; 3451 let mayLoad = 1; 3452 let AccessBytes = bytes; 3453} 3454 3455class CompareRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3456 RegisterOperand cls, SDPatternOperator load, bits<5> bytes> 3457 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2), 3458 mnemonic#"\t$R1, $XBD2", 3459 [(operator cls:$R1, (load bdxaddr12only:$XBD2))]> { 3460 let OpKey = mnemonic#"r"#cls; 3461 let OpType = "mem"; 3462 let isCompare = 1; 3463 let mayLoad = 1; 3464 let AccessBytes = bytes; 3465 let M3 = 0; 3466} 3467 3468class CompareRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3469 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 3470 AddressingMode mode = bdxaddr20only> 3471 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2), 3472 mnemonic#"\t$R1, $XBD2", 3473 [(operator cls:$R1, (load mode:$XBD2))]> { 3474 let OpKey = mnemonic#"r"#cls; 3475 let OpType = "mem"; 3476 let isCompare = 1; 3477 let mayLoad = 1; 3478 let AccessBytes = bytes; 3479} 3480 3481multiclass CompareRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 3482 SDPatternOperator operator, RegisterOperand cls, 3483 SDPatternOperator load, bits<5> bytes> { 3484 let DispKey = mnemonic ## #cls in { 3485 let DispSize = "12" in 3486 def "" : CompareRX<mnemonic, rxOpcode, operator, cls, 3487 load, bytes, bdxaddr12pair>; 3488 let DispSize = "20" in 3489 def Y : CompareRXY<mnemonic#"y", rxyOpcode, operator, cls, 3490 load, bytes, bdxaddr20pair>; 3491 } 3492} 3493 3494class CompareRS<string mnemonic, bits<8> opcode, RegisterOperand cls, 3495 bits<5> bytes, AddressingMode mode = bdaddr12only> 3496 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2), 3497 mnemonic#"\t$R1, $M3, $BD2", []> { 3498 let mayLoad = 1; 3499 let AccessBytes = bytes; 3500} 3501 3502class CompareRSY<string mnemonic, bits<16> opcode, RegisterOperand cls, 3503 bits<5> bytes, AddressingMode mode = bdaddr20only> 3504 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2), 3505 mnemonic#"\t$R1, $M3, $BD2", []> { 3506 let mayLoad = 1; 3507 let AccessBytes = bytes; 3508} 3509 3510multiclass CompareRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode, 3511 RegisterOperand cls, bits<5> bytes> { 3512 let DispKey = mnemonic ## #cls in { 3513 let DispSize = "12" in 3514 def "" : CompareRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>; 3515 let DispSize = "20" in 3516 def Y : CompareRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>; 3517 } 3518} 3519 3520class CompareSSb<string mnemonic, bits<8> opcode> 3521 : InstSSb<opcode, 3522 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2), 3523 mnemonic##"\t$BDL1, $BDL2", []> { 3524 let isCompare = 1; 3525 let mayLoad = 1; 3526} 3527 3528class CompareSI<string mnemonic, bits<8> opcode, SDPatternOperator operator, 3529 SDPatternOperator load, Immediate imm, 3530 AddressingMode mode = bdaddr12only> 3531 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2), 3532 mnemonic#"\t$BD1, $I2", 3533 [(operator (load mode:$BD1), imm:$I2)]> { 3534 let isCompare = 1; 3535 let mayLoad = 1; 3536} 3537 3538class CompareSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3539 SDPatternOperator load, Immediate imm> 3540 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2), 3541 mnemonic#"\t$BD1, $I2", 3542 [(operator (load bdaddr12only:$BD1), imm:$I2)]> { 3543 let isCompare = 1; 3544 let mayLoad = 1; 3545} 3546 3547class CompareSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3548 SDPatternOperator load, Immediate imm, 3549 AddressingMode mode = bdaddr20only> 3550 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2), 3551 mnemonic#"\t$BD1, $I2", 3552 [(operator (load mode:$BD1), imm:$I2)]> { 3553 let isCompare = 1; 3554 let mayLoad = 1; 3555} 3556 3557multiclass CompareSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode, 3558 SDPatternOperator operator, SDPatternOperator load, 3559 Immediate imm> { 3560 let DispKey = mnemonic in { 3561 let DispSize = "12" in 3562 def "" : CompareSI<mnemonic, siOpcode, operator, load, imm, bdaddr12pair>; 3563 let DispSize = "20" in 3564 def Y : CompareSIY<mnemonic#"y", siyOpcode, operator, load, imm, 3565 bdaddr20pair>; 3566 } 3567} 3568 3569class CompareVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3570 TypedReg tr, bits<4> type> 3571 : InstVRRa<opcode, (outs), (ins tr.op:$V1, tr.op:$V2), 3572 mnemonic#"\t$V1, $V2", 3573 [(operator (tr.vt tr.op:$V1), (tr.vt tr.op:$V2))]> { 3574 let isCompare = 1; 3575 let M3 = type; 3576 let M4 = 0; 3577 let M5 = 0; 3578} 3579 3580class CompareVRRaGeneric<string mnemonic, bits<16> opcode> 3581 : InstVRRa<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3), 3582 mnemonic#"\t$V1, $V2, $M3", []> { 3583 let isCompare = 1; 3584 let M4 = 0; 3585 let M5 = 0; 3586} 3587 3588class CompareVRRaFloatGeneric<string mnemonic, bits<16> opcode> 3589 : InstVRRa<opcode, (outs), 3590 (ins VR64:$V1, VR64:$V2, imm32zx4:$M3, imm32zx4:$M4), 3591 mnemonic#"\t$V1, $V2, $M3, $M4", []> { 3592 let isCompare = 1; 3593 let M5 = 0; 3594} 3595 3596class TestRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3597 RegisterOperand cls> 3598 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2), 3599 mnemonic#"\t$R1, $XBD2", 3600 [(operator cls:$R1, bdxaddr12only:$XBD2)]> { 3601 let M3 = 0; 3602} 3603 3604class TestRSL<string mnemonic, bits<16> opcode> 3605 : InstRSLa<opcode, (outs), (ins bdladdr12onlylen4:$BDL1), 3606 mnemonic#"\t$BDL1", []> { 3607 let mayLoad = 1; 3608} 3609 3610class SideEffectTernarySSc<string mnemonic, bits<8> opcode> 3611 : InstSSc<opcode, (outs), (ins bdladdr12onlylen4:$BDL1, 3612 shift12only:$BD2, imm32zx4:$I3), 3613 mnemonic##"\t$BDL1, $BD2, $I3", []>; 3614 3615class SideEffectTernaryMemMemMemRRFb<string mnemonic, bits<16> opcode, 3616 RegisterOperand cls1, 3617 RegisterOperand cls2, 3618 RegisterOperand cls3> 3619 : InstRRFb<opcode, (outs cls1:$R1, cls2:$R2, cls3:$R3), 3620 (ins cls1:$R1src, cls2:$R2src, cls3:$R3src), 3621 mnemonic#"\t$R1, $R3, $R2", []> { 3622 let Constraints = "$R1 = $R1src, $R2 = $R2src, $R3 = $R3src"; 3623 let DisableEncoding = "$R1src, $R2src, $R3src"; 3624 let M4 = 0; 3625} 3626 3627class SideEffectTernaryRRFc<string mnemonic, bits<16> opcode, 3628 RegisterOperand cls1, RegisterOperand cls2, 3629 Immediate imm> 3630 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2, imm:$M3), 3631 mnemonic#"\t$R1, $R2, $M3", []>; 3632 3633class SideEffectTernaryMemMemRRFc<string mnemonic, bits<16> opcode, 3634 RegisterOperand cls1, RegisterOperand cls2, 3635 Immediate imm> 3636 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2), 3637 (ins cls1:$R1src, cls2:$R2src, imm:$M3), 3638 mnemonic#"\t$R1, $R2, $M3", []> { 3639 let Constraints = "$R1 = $R1src, $R2 = $R2src"; 3640 let DisableEncoding = "$R1src, $R2src"; 3641} 3642 3643multiclass SideEffectTernaryMemMemRRFcOpt<string mnemonic, bits<16> opcode, 3644 RegisterOperand cls1, 3645 RegisterOperand cls2> { 3646 def "" : SideEffectTernaryMemMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>; 3647 def Opt : SideEffectBinaryMemMemRRFc<mnemonic, opcode, cls1, cls2>; 3648} 3649 3650class SideEffectTernarySSF<string mnemonic, bits<12> opcode, 3651 RegisterOperand cls> 3652 : InstSSF<opcode, (outs), 3653 (ins bdaddr12only:$BD1, bdaddr12only:$BD2, cls:$R3), 3654 mnemonic#"\t$BD1, $BD2, $R3", []>; 3655 3656class TernaryRRFa<string mnemonic, bits<16> opcode, 3657 RegisterOperand cls1, RegisterOperand cls2, 3658 RegisterOperand cls3> 3659 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3, imm32zx4:$M4), 3660 mnemonic#"\t$R1, $R2, $R3, $M4", []>; 3661 3662class TernaryRRFb<string mnemonic, bits<16> opcode, 3663 RegisterOperand cls1, RegisterOperand cls2, 3664 RegisterOperand cls3> 3665 : InstRRFb<opcode, (outs cls1:$R1, cls3:$R3), 3666 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M4), 3667 mnemonic#"\t$R1, $R3, $R2, $M4", []> { 3668 let Constraints = "$R1 = $R1src"; 3669 let DisableEncoding = "$R1src"; 3670} 3671 3672class TernaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1, 3673 RegisterOperand cls2> 3674 : InstRRFe<opcode, (outs cls1:$R1), 3675 (ins imm32zx4:$M3, cls2:$R2, imm32zx4:$M4), 3676 mnemonic#"\t$R1, $M3, $R2, $M4", []>; 3677 3678class TernaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3679 RegisterOperand cls1, RegisterOperand cls2> 3680 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R1src, cls2:$R3, cls2:$R2), 3681 mnemonic#"\t$R1, $R3, $R2", 3682 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3, cls2:$R2))]> { 3683 let OpKey = mnemonic#cls; 3684 let OpType = "reg"; 3685 let Constraints = "$R1 = $R1src"; 3686 let DisableEncoding = "$R1src"; 3687} 3688 3689class TernaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls, 3690 bits<5> bytes, AddressingMode mode = bdaddr12only> 3691 : InstRSb<opcode, (outs cls:$R1), 3692 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2), 3693 mnemonic#"\t$R1, $M3, $BD2", []> { 3694 3695 let Constraints = "$R1 = $R1src"; 3696 let DisableEncoding = "$R1src"; 3697 let mayLoad = 1; 3698 let AccessBytes = bytes; 3699} 3700 3701class TernaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls, 3702 bits<5> bytes, AddressingMode mode = bdaddr20only> 3703 : InstRSYb<opcode, (outs cls:$R1), 3704 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2), 3705 mnemonic#"\t$R1, $M3, $BD2", []> { 3706 3707 let Constraints = "$R1 = $R1src"; 3708 let DisableEncoding = "$R1src"; 3709 let mayLoad = 1; 3710 let AccessBytes = bytes; 3711} 3712 3713multiclass TernaryRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode, 3714 RegisterOperand cls, bits<5> bytes> { 3715 let DispKey = mnemonic ## #cls in { 3716 let DispSize = "12" in 3717 def "" : TernaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>; 3718 let DispSize = "20" in 3719 def Y : TernaryRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>; 3720 } 3721} 3722 3723class SideEffectTernaryMemMemRS<string mnemonic, bits<8> opcode, 3724 RegisterOperand cls1, RegisterOperand cls2> 3725 : InstRSa<opcode, (outs cls1:$R1, cls2:$R3), 3726 (ins cls1:$R1src, cls2:$R3src, shift12only:$BD2), 3727 mnemonic#"\t$R1, $R3, $BD2", []> { 3728 let Constraints = "$R1 = $R1src, $R3 = $R3src"; 3729 let DisableEncoding = "$R1src, $R3src"; 3730} 3731 3732class SideEffectTernaryMemMemRSY<string mnemonic, bits<16> opcode, 3733 RegisterOperand cls1, RegisterOperand cls2> 3734 : InstRSYa<opcode, (outs cls1:$R1, cls2:$R3), 3735 (ins cls1:$R1src, cls2:$R3src, shift20only:$BD2), 3736 mnemonic#"\t$R1, $R3, $BD2", []> { 3737 let Constraints = "$R1 = $R1src, $R3 = $R3src"; 3738 let DisableEncoding = "$R1src, $R3src"; 3739} 3740 3741class TernaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3742 RegisterOperand cls1, RegisterOperand cls2, 3743 SDPatternOperator load, bits<5> bytes> 3744 : InstRXF<opcode, (outs cls1:$R1), 3745 (ins cls2:$R1src, cls2:$R3, bdxaddr12only:$XBD2), 3746 mnemonic#"\t$R1, $R3, $XBD2", 3747 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3, 3748 (load bdxaddr12only:$XBD2)))]> { 3749 let OpKey = mnemonic#"r"#cls; 3750 let OpType = "mem"; 3751 let Constraints = "$R1 = $R1src"; 3752 let DisableEncoding = "$R1src"; 3753 let mayLoad = 1; 3754 let AccessBytes = bytes; 3755} 3756 3757class TernaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3758 TypedReg tr1, TypedReg tr2, Immediate imm, Immediate index> 3759 : InstVRIa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V1src, imm:$I2, index:$M3), 3760 mnemonic#"\t$V1, $I2, $M3", 3761 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src), 3762 imm:$I2, index:$M3)))]> { 3763 let Constraints = "$V1 = $V1src"; 3764 let DisableEncoding = "$V1src"; 3765} 3766 3767class TernaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3768 TypedReg tr1, TypedReg tr2, bits<4> type> 3769 : InstVRId<opcode, (outs tr1.op:$V1), 3770 (ins tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4), 3771 mnemonic#"\t$V1, $V2, $V3, $I4", 3772 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3773 (tr2.vt tr2.op:$V3), 3774 imm32zx8:$I4)))]> { 3775 let M5 = type; 3776} 3777 3778class TernaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3779 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m4or> 3780 : InstVRRa<opcode, (outs tr1.op:$V1), 3781 (ins tr2.op:$V2, imm32zx4:$M4, imm32zx4:$M5), 3782 mnemonic#"\t$V1, $V2, $M4, $M5", 3783 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3784 imm32zx4:$M4, 3785 imm32zx4:$M5)))], 3786 m4or> { 3787 let M3 = type; 3788} 3789 3790class TernaryVRRaFloatGeneric<string mnemonic, bits<16> opcode> 3791 : InstVRRa<opcode, (outs VR128:$V1), 3792 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5), 3793 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>; 3794 3795class TernaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3796 TypedReg tr1, TypedReg tr2, bits<4> type, 3797 SDPatternOperator m5mask, bits<4> m5or> 3798 : InstVRRb<opcode, (outs tr1.op:$V1), 3799 (ins tr2.op:$V2, tr2.op:$V3, m5mask:$M5), 3800 mnemonic#"\t$V1, $V2, $V3, $M5", 3801 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3802 (tr2.vt tr2.op:$V3), 3803 m5mask:$M5)))], 3804 m5or> { 3805 let M4 = type; 3806} 3807 3808// Declare a pair of instructions, one which sets CC and one which doesn't. 3809// The CC-setting form ends with "S" and sets the low bit of M5. 3810// Also create aliases to make use of M5 operand optional in assembler. 3811multiclass TernaryOptVRRbSPair<string mnemonic, bits<16> opcode, 3812 SDPatternOperator operator, 3813 SDPatternOperator operator_cc, 3814 TypedReg tr1, TypedReg tr2, bits<4> type, 3815 bits<4> modifier = 0> { 3816 def "" : TernaryVRRb<mnemonic, opcode, operator, tr1, tr2, type, 3817 imm32zx4even, !and (modifier, 14)>; 3818 def : InstAlias<mnemonic#"\t$V1, $V2, $V3", 3819 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 3820 tr2.op:$V3, 0)>; 3821 let Defs = [CC] in 3822 def S : TernaryVRRb<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 3823 imm32zx4even, !add(!and (modifier, 14), 1)>; 3824 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3", 3825 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2, 3826 tr2.op:$V3, 0)>; 3827} 3828 3829multiclass TernaryOptVRRbSPairGeneric<string mnemonic, bits<16> opcode> { 3830 def "" : InstVRRb<opcode, (outs VR128:$V1), 3831 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5), 3832 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>; 3833 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4", 3834 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3, 3835 imm32zx4:$M4, 0)>; 3836} 3837 3838class TernaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3839 TypedReg tr1, TypedReg tr2> 3840 : InstVRRc<opcode, (outs tr1.op:$V1), 3841 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M4), 3842 mnemonic#"\t$V1, $V2, $V3, $M4", 3843 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3844 (tr2.vt tr2.op:$V3), 3845 imm32zx4:$M4)))]> { 3846 let M5 = 0; 3847 let M6 = 0; 3848} 3849 3850class TernaryVRRd<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3851 TypedReg tr1, TypedReg tr2, bits<4> type = 0> 3852 : InstVRRd<opcode, (outs tr1.op:$V1), 3853 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4), 3854 mnemonic#"\t$V1, $V2, $V3, $V4", 3855 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3856 (tr2.vt tr2.op:$V3), 3857 (tr1.vt tr1.op:$V4))))]> { 3858 let M5 = type; 3859 let M6 = 0; 3860} 3861 3862class TernaryVRRdGeneric<string mnemonic, bits<16> opcode> 3863 : InstVRRd<opcode, (outs VR128:$V1), 3864 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5), 3865 mnemonic#"\t$V1, $V2, $V3, $V4, $M5", []> { 3866 let M6 = 0; 3867} 3868 3869class TernaryVRRe<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3870 TypedReg tr1, TypedReg tr2, bits<4> m5 = 0, bits<4> type = 0> 3871 : InstVRRe<opcode, (outs tr1.op:$V1), 3872 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4), 3873 mnemonic#"\t$V1, $V2, $V3, $V4", 3874 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3875 (tr2.vt tr2.op:$V3), 3876 (tr1.vt tr1.op:$V4))))]> { 3877 let M5 = m5; 3878 let M6 = type; 3879} 3880 3881class TernaryVRReFloatGeneric<string mnemonic, bits<16> opcode> 3882 : InstVRRe<opcode, (outs VR128:$V1), 3883 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6), 3884 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>; 3885 3886class TernaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3887 TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type> 3888 : InstVRSb<opcode, (outs tr1.op:$V1), 3889 (ins tr2.op:$V1src, cls:$R3, shift12only:$BD2), 3890 mnemonic#"\t$V1, $R3, $BD2", 3891 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src), 3892 cls:$R3, 3893 shift12only:$BD2)))]> { 3894 let Constraints = "$V1 = $V1src"; 3895 let DisableEncoding = "$V1src"; 3896 let M4 = type; 3897} 3898 3899class TernaryVRSbGeneric<string mnemonic, bits<16> opcode> 3900 : InstVRSb<opcode, (outs VR128:$V1), 3901 (ins VR128:$V1src, GR64:$R3, shift12only:$BD2, imm32zx4:$M4), 3902 mnemonic#"\t$V1, $R3, $BD2, $M4", []> { 3903 let Constraints = "$V1 = $V1src"; 3904 let DisableEncoding = "$V1src"; 3905} 3906 3907class TernaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes, 3908 Immediate index> 3909 : InstVRV<opcode, (outs VR128:$V1), 3910 (ins VR128:$V1src, bdvaddr12only:$VBD2, index:$M3), 3911 mnemonic#"\t$V1, $VBD2, $M3", []> { 3912 let Constraints = "$V1 = $V1src"; 3913 let DisableEncoding = "$V1src"; 3914 let mayLoad = 1; 3915 let AccessBytes = bytes; 3916} 3917 3918class TernaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3919 TypedReg tr1, TypedReg tr2, bits<5> bytes, Immediate index> 3920 : InstVRX<opcode, (outs tr1.op:$V1), 3921 (ins tr2.op:$V1src, bdxaddr12only:$XBD2, index:$M3), 3922 mnemonic#"\t$V1, $XBD2, $M3", 3923 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src), 3924 bdxaddr12only:$XBD2, 3925 index:$M3)))]> { 3926 let Constraints = "$V1 = $V1src"; 3927 let DisableEncoding = "$V1src"; 3928 let mayLoad = 1; 3929 let AccessBytes = bytes; 3930} 3931 3932class QuaternaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3933 TypedReg tr1, TypedReg tr2, bits<4> type> 3934 : InstVRId<opcode, (outs tr1.op:$V1), 3935 (ins tr2.op:$V1src, tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4), 3936 mnemonic#"\t$V1, $V2, $V3, $I4", 3937 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V1src), 3938 (tr2.vt tr2.op:$V2), 3939 (tr2.vt tr2.op:$V3), 3940 imm32zx8:$I4)))]> { 3941 let Constraints = "$V1 = $V1src"; 3942 let DisableEncoding = "$V1src"; 3943 let M5 = type; 3944} 3945 3946class QuaternaryVRIdGeneric<string mnemonic, bits<16> opcode> 3947 : InstVRId<opcode, (outs VR128:$V1), 3948 (ins VR128:$V1src, VR128:$V2, VR128:$V3, 3949 imm32zx8:$I4, imm32zx4:$M5), 3950 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []> { 3951 let Constraints = "$V1 = $V1src"; 3952 let DisableEncoding = "$V1src"; 3953} 3954 3955class QuaternaryVRRd<string mnemonic, bits<16> opcode, 3956 SDPatternOperator operator, TypedReg tr1, TypedReg tr2, 3957 bits<4> type, SDPatternOperator m6mask, bits<4> m6or> 3958 : InstVRRd<opcode, (outs tr1.op:$V1), 3959 (ins tr2.op:$V2, tr2.op:$V3, tr2.op:$V4, m6mask:$M6), 3960 mnemonic#"\t$V1, $V2, $V3, $V4, $M6", 3961 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2), 3962 (tr2.vt tr2.op:$V3), 3963 (tr2.vt tr2.op:$V4), 3964 m6mask:$M6)))], 3965 m6or> { 3966 let M5 = type; 3967} 3968 3969// Declare a pair of instructions, one which sets CC and one which doesn't. 3970// The CC-setting form ends with "S" and sets the low bit of M6. 3971// Also create aliases to make use of M6 operand optional in assembler. 3972multiclass QuaternaryOptVRRdSPair<string mnemonic, bits<16> opcode, 3973 SDPatternOperator operator, 3974 SDPatternOperator operator_cc, 3975 TypedReg tr1, TypedReg tr2, bits<4> type, 3976 bits<4> modifier = 0> { 3977 def "" : QuaternaryVRRd<mnemonic, opcode, operator, tr1, tr2, type, 3978 imm32zx4even, !and (modifier, 14)>; 3979 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4", 3980 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 3981 tr2.op:$V3, tr2.op:$V4, 0)>; 3982 let Defs = [CC] in 3983 def S : QuaternaryVRRd<mnemonic##"s", opcode, operator_cc, tr1, tr2, type, 3984 imm32zx4even, !add (!and (modifier, 14), 1)>; 3985 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3, $V4", 3986 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2, 3987 tr2.op:$V3, tr2.op:$V4, 0)>; 3988} 3989 3990multiclass QuaternaryOptVRRdSPairGeneric<string mnemonic, bits<16> opcode> { 3991 def "" : InstVRRd<opcode, (outs VR128:$V1), 3992 (ins VR128:$V2, VR128:$V3, VR128:$V4, 3993 imm32zx4:$M5, imm32zx4:$M6), 3994 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>; 3995 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5", 3996 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3, 3997 VR128:$V4, imm32zx4:$M5, 0)>; 3998} 3999 4000class SideEffectQuaternarySSe<string mnemonic, bits<8> opcode, 4001 RegisterOperand cls> 4002 : InstSSe<opcode, (outs), 4003 (ins cls:$R1, bdaddr12only:$BD2, cls:$R3, bdaddr12only:$BD4), 4004 mnemonic#"\t$R1, $BD2, $R3, $BD4", []>; 4005 4006class LoadAndOpRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4007 RegisterOperand cls, AddressingMode mode = bdaddr20only> 4008 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, mode:$BD2), 4009 mnemonic#"\t$R1, $R3, $BD2", 4010 [(set cls:$R1, (operator mode:$BD2, cls:$R3))]> { 4011 let mayLoad = 1; 4012 let mayStore = 1; 4013} 4014 4015class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator, 4016 RegisterOperand cls, AddressingMode mode = bdaddr12only> 4017 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2), 4018 mnemonic#"\t$R1, $R3, $BD2", 4019 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> { 4020 let Constraints = "$R1 = $R1src"; 4021 let DisableEncoding = "$R1src"; 4022 let mayLoad = 1; 4023 let mayStore = 1; 4024} 4025 4026class CmpSwapRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4027 RegisterOperand cls, AddressingMode mode = bdaddr20only> 4028 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2), 4029 mnemonic#"\t$R1, $R3, $BD2", 4030 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> { 4031 let Constraints = "$R1 = $R1src"; 4032 let DisableEncoding = "$R1src"; 4033 let mayLoad = 1; 4034 let mayStore = 1; 4035} 4036 4037multiclass CmpSwapRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode, 4038 SDPatternOperator operator, RegisterOperand cls> { 4039 let DispKey = mnemonic ## #cls in { 4040 let DispSize = "12" in 4041 def "" : CmpSwapRS<mnemonic, rsOpcode, operator, cls, bdaddr12pair>; 4042 let DispSize = "20" in 4043 def Y : CmpSwapRSY<mnemonic#"y", rsyOpcode, operator, cls, bdaddr20pair>; 4044 } 4045} 4046 4047class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1, 4048 RegisterOperand cls2> 4049 : InstRIEf<opcode, (outs cls1:$R1), 4050 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, 4051 imm32zx6:$I5), 4052 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> { 4053 let Constraints = "$R1 = $R1src"; 4054 let DisableEncoding = "$R1src"; 4055} 4056 4057class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator> 4058 : InstRXYb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr20only:$XBD2), 4059 mnemonic##"\t$M1, $XBD2", 4060 [(operator imm32zx4:$M1, bdxaddr20only:$XBD2)]>; 4061 4062class PrefetchRILPC<string mnemonic, bits<12> opcode, 4063 SDPatternOperator operator> 4064 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, pcrel32:$RI2), 4065 mnemonic##"\t$M1, $RI2", 4066 [(operator imm32zx4:$M1, pcrel32:$RI2)]> { 4067 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 4068 // However, BDXs have two extra operands and are therefore 6 units more 4069 // complex. 4070 let AddedComplexity = 7; 4071} 4072 4073class BranchPreloadSMI<string mnemonic, bits<8> opcode> 4074 : InstSMI<opcode, (outs), 4075 (ins imm32zx4:$M1, brtarget16bpp:$RI2, bdxaddr12only:$BD3), 4076 mnemonic#"\t$M1, $RI2, $BD3", []>; 4077 4078class BranchPreloadMII<string mnemonic, bits<8> opcode> 4079 : InstMII<opcode, (outs), 4080 (ins imm32zx4:$M1, brtarget12bpp:$RI2, brtarget24bpp:$RI3), 4081 mnemonic#"\t$M1, $RI2, $RI3", []>; 4082 4083// A floating-point load-and test operation. Create both a normal unary 4084// operation and one that acts as a comparison against zero. 4085// Note that the comparison against zero operation is not available if we 4086// have vector support, since load-and-test instructions will partially 4087// clobber the target (vector) register. 4088multiclass LoadAndTestRRE<string mnemonic, bits<16> opcode, 4089 RegisterOperand cls> { 4090 def "" : UnaryRRE<mnemonic, opcode, null_frag, cls, cls>; 4091 let isCodeGenOnly = 1, Predicates = [FeatureNoVector] in 4092 def Compare : CompareRRE<mnemonic, opcode, null_frag, cls, cls>; 4093} 4094 4095//===----------------------------------------------------------------------===// 4096// Pseudo instructions 4097//===----------------------------------------------------------------------===// 4098// 4099// Convenience instructions that get lowered to real instructions 4100// by either SystemZTargetLowering::EmitInstrWithCustomInserter() 4101// or SystemZInstrInfo::expandPostRAPseudo(). 4102// 4103//===----------------------------------------------------------------------===// 4104 4105class Pseudo<dag outs, dag ins, list<dag> pattern> 4106 : InstSystemZ<0, outs, ins, "", pattern> { 4107 let isPseudo = 1; 4108 let isCodeGenOnly = 1; 4109} 4110 4111// Like SideEffectBinarySIL, but expanded later. 4112class SideEffectBinarySILPseudo<SDPatternOperator operator, Immediate imm> 4113 : Pseudo<(outs), (ins bdaddr12only:$BD1, imm:$I2), 4114 [(operator bdaddr12only:$BD1, imm:$I2)]>; 4115 4116// Like UnaryRI, but expanded after RA depending on the choice of register. 4117class UnaryRIPseudo<SDPatternOperator operator, RegisterOperand cls, 4118 Immediate imm> 4119 : Pseudo<(outs cls:$R1), (ins imm:$I2), 4120 [(set cls:$R1, (operator imm:$I2))]>; 4121 4122// Like UnaryRXY, but expanded after RA depending on the choice of register. 4123class UnaryRXYPseudo<string key, SDPatternOperator operator, 4124 RegisterOperand cls, bits<5> bytes, 4125 AddressingMode mode = bdxaddr20only> 4126 : Pseudo<(outs cls:$R1), (ins mode:$XBD2), 4127 [(set cls:$R1, (operator mode:$XBD2))]> { 4128 let OpKey = key#"r"#cls; 4129 let OpType = "mem"; 4130 let mayLoad = 1; 4131 let Has20BitOffset = 1; 4132 let HasIndex = 1; 4133 let AccessBytes = bytes; 4134} 4135 4136// Like UnaryRR, but expanded after RA depending on the choice of registers. 4137class UnaryRRPseudo<string key, SDPatternOperator operator, 4138 RegisterOperand cls1, RegisterOperand cls2> 4139 : Pseudo<(outs cls1:$R1), (ins cls2:$R2), 4140 [(set cls1:$R1, (operator cls2:$R2))]> { 4141 let OpKey = key#cls1; 4142 let OpType = "reg"; 4143} 4144 4145// Like BinaryRI, but expanded after RA depending on the choice of register. 4146class BinaryRIPseudo<SDPatternOperator operator, RegisterOperand cls, 4147 Immediate imm> 4148 : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2), 4149 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 4150 let Constraints = "$R1 = $R1src"; 4151} 4152 4153// Like BinaryRIE, but expanded after RA depending on the choice of register. 4154class BinaryRIEPseudo<SDPatternOperator operator, RegisterOperand cls, 4155 Immediate imm> 4156 : Pseudo<(outs cls:$R1), (ins cls:$R3, imm:$I2), 4157 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>; 4158 4159// Like BinaryRIAndK, but expanded after RA depending on the choice of register. 4160multiclass BinaryRIAndKPseudo<string key, SDPatternOperator operator, 4161 RegisterOperand cls, Immediate imm> { 4162 let NumOpsKey = key in { 4163 let NumOpsValue = "3" in 4164 def K : BinaryRIEPseudo<null_frag, cls, imm>, 4165 Requires<[FeatureHighWord, FeatureDistinctOps]>; 4166 let NumOpsValue = "2", isConvertibleToThreeAddress = 1 in 4167 def "" : BinaryRIPseudo<operator, cls, imm>, 4168 Requires<[FeatureHighWord]>; 4169 } 4170} 4171 4172// Like CompareRI, but expanded after RA depending on the choice of register. 4173class CompareRIPseudo<SDPatternOperator operator, RegisterOperand cls, 4174 Immediate imm> 4175 : Pseudo<(outs), (ins cls:$R1, imm:$I2), [(operator cls:$R1, imm:$I2)]> { 4176 let isCompare = 1; 4177} 4178 4179// Like CompareRXY, but expanded after RA depending on the choice of register. 4180class CompareRXYPseudo<SDPatternOperator operator, RegisterOperand cls, 4181 SDPatternOperator load, bits<5> bytes, 4182 AddressingMode mode = bdxaddr20only> 4183 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2), 4184 [(operator cls:$R1, (load mode:$XBD2))]> { 4185 let mayLoad = 1; 4186 let Has20BitOffset = 1; 4187 let HasIndex = 1; 4188 let AccessBytes = bytes; 4189} 4190 4191// Like CondBinaryRRF, but expanded after RA depending on the choice of 4192// register. 4193class CondBinaryRRFPseudo<RegisterOperand cls1, RegisterOperand cls2> 4194 : Pseudo<(outs cls1:$R1), 4195 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3), []> { 4196 let Constraints = "$R1 = $R1src"; 4197 let DisableEncoding = "$R1src"; 4198 let CCMaskLast = 1; 4199} 4200 4201// Like CondBinaryRIE, but expanded after RA depending on the choice of 4202// register. 4203class CondBinaryRIEPseudo<RegisterOperand cls, Immediate imm> 4204 : Pseudo<(outs cls:$R1), 4205 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3), 4206 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src, 4207 cond4:$valid, cond4:$M3))]> { 4208 let Constraints = "$R1 = $R1src"; 4209 let DisableEncoding = "$R1src"; 4210 let CCMaskLast = 1; 4211} 4212 4213// Like CondUnaryRSY, but expanded after RA depending on the choice of 4214// register. 4215class CondUnaryRSYPseudo<SDPatternOperator operator, RegisterOperand cls, 4216 bits<5> bytes, AddressingMode mode = bdaddr20only> 4217 : Pseudo<(outs cls:$R1), 4218 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$R3), 4219 [(set cls:$R1, 4220 (z_select_ccmask (operator mode:$BD2), cls:$R1src, 4221 cond4:$valid, cond4:$R3))]> { 4222 let Constraints = "$R1 = $R1src"; 4223 let DisableEncoding = "$R1src"; 4224 let mayLoad = 1; 4225 let AccessBytes = bytes; 4226 let CCMaskLast = 1; 4227} 4228 4229// Like CondStoreRSY, but expanded after RA depending on the choice of 4230// register. 4231class CondStoreRSYPseudo<RegisterOperand cls, bits<5> bytes, 4232 AddressingMode mode = bdaddr20only> 4233 : Pseudo<(outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$R3), []> { 4234 let mayStore = 1; 4235 let AccessBytes = bytes; 4236 let CCMaskLast = 1; 4237} 4238 4239// Like StoreRXY, but expanded after RA depending on the choice of register. 4240class StoreRXYPseudo<SDPatternOperator operator, RegisterOperand cls, 4241 bits<5> bytes, AddressingMode mode = bdxaddr20only> 4242 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2), 4243 [(operator cls:$R1, mode:$XBD2)]> { 4244 let mayStore = 1; 4245 let Has20BitOffset = 1; 4246 let HasIndex = 1; 4247 let AccessBytes = bytes; 4248} 4249 4250// Like RotateSelectRIEf, but expanded after RA depending on the choice 4251// of registers. 4252class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2> 4253 : Pseudo<(outs cls1:$R1), 4254 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, 4255 imm32zx6:$I5), 4256 []> { 4257 let Constraints = "$R1 = $R1src"; 4258 let DisableEncoding = "$R1src"; 4259} 4260 4261// Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is 4262// the value of the PSW's 2-bit condition code field. 4263class SelectWrapper<RegisterOperand cls> 4264 : Pseudo<(outs cls:$dst), 4265 (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc), 4266 [(set cls:$dst, (z_select_ccmask cls:$src1, cls:$src2, 4267 imm32zx4:$valid, imm32zx4:$cc))]> { 4268 let usesCustomInserter = 1; 4269 // Although the instructions used by these nodes do not in themselves 4270 // change CC, the insertion requires new blocks, and CC cannot be live 4271 // across them. 4272 let Defs = [CC]; 4273 let Uses = [CC]; 4274} 4275 4276// Stores $new to $addr if $cc is true ("" case) or false (Inv case). 4277multiclass CondStores<RegisterOperand cls, SDPatternOperator store, 4278 SDPatternOperator load, AddressingMode mode> { 4279 let Defs = [CC], Uses = [CC], usesCustomInserter = 1 in { 4280 def "" : Pseudo<(outs), 4281 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc), 4282 [(store (z_select_ccmask cls:$new, (load mode:$addr), 4283 imm32zx4:$valid, imm32zx4:$cc), 4284 mode:$addr)]>; 4285 def Inv : Pseudo<(outs), 4286 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc), 4287 [(store (z_select_ccmask (load mode:$addr), cls:$new, 4288 imm32zx4:$valid, imm32zx4:$cc), 4289 mode:$addr)]>; 4290 } 4291} 4292 4293// OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation. PAT and OPERAND 4294// describe the second (non-memory) operand. 4295class AtomicLoadBinary<SDPatternOperator operator, RegisterOperand cls, 4296 dag pat, DAGOperand operand> 4297 : Pseudo<(outs cls:$dst), (ins bdaddr20only:$ptr, operand:$src2), 4298 [(set cls:$dst, (operator bdaddr20only:$ptr, pat))]> { 4299 let Defs = [CC]; 4300 let Has20BitOffset = 1; 4301 let mayLoad = 1; 4302 let mayStore = 1; 4303 let usesCustomInserter = 1; 4304 let hasNoSchedulingInfo = 1; 4305} 4306 4307// Specializations of AtomicLoadWBinary. 4308class AtomicLoadBinaryReg32<SDPatternOperator operator> 4309 : AtomicLoadBinary<operator, GR32, (i32 GR32:$src2), GR32>; 4310class AtomicLoadBinaryImm32<SDPatternOperator operator, Immediate imm> 4311 : AtomicLoadBinary<operator, GR32, (i32 imm:$src2), imm>; 4312class AtomicLoadBinaryReg64<SDPatternOperator operator> 4313 : AtomicLoadBinary<operator, GR64, (i64 GR64:$src2), GR64>; 4314class AtomicLoadBinaryImm64<SDPatternOperator operator, Immediate imm> 4315 : AtomicLoadBinary<operator, GR64, (i64 imm:$src2), imm>; 4316 4317// OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation. PAT and OPERAND 4318// describe the second (non-memory) operand. 4319class AtomicLoadWBinary<SDPatternOperator operator, dag pat, 4320 DAGOperand operand> 4321 : Pseudo<(outs GR32:$dst), 4322 (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift, 4323 ADDR32:$negbitshift, uimm32:$bitsize), 4324 [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift, 4325 ADDR32:$negbitshift, uimm32:$bitsize))]> { 4326 let Defs = [CC]; 4327 let Has20BitOffset = 1; 4328 let mayLoad = 1; 4329 let mayStore = 1; 4330 let usesCustomInserter = 1; 4331 let hasNoSchedulingInfo = 1; 4332} 4333 4334// Specializations of AtomicLoadWBinary. 4335class AtomicLoadWBinaryReg<SDPatternOperator operator> 4336 : AtomicLoadWBinary<operator, (i32 GR32:$src2), GR32>; 4337class AtomicLoadWBinaryImm<SDPatternOperator operator, Immediate imm> 4338 : AtomicLoadWBinary<operator, (i32 imm:$src2), imm>; 4339 4340// Define an instruction that operates on two fixed-length blocks of memory, 4341// and associated pseudo instructions for operating on blocks of any size. 4342// The Sequence form uses a straight-line sequence of instructions and 4343// the Loop form uses a loop of length-256 instructions followed by 4344// another instruction to handle the excess. 4345multiclass MemorySS<string mnemonic, bits<8> opcode, 4346 SDPatternOperator sequence, SDPatternOperator loop> { 4347 def "" : SideEffectBinarySSa<mnemonic, opcode>; 4348 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in { 4349 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, 4350 imm64:$length), 4351 [(sequence bdaddr12only:$dest, bdaddr12only:$src, 4352 imm64:$length)]>; 4353 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, 4354 imm64:$length, GR64:$count256), 4355 [(loop bdaddr12only:$dest, bdaddr12only:$src, 4356 imm64:$length, GR64:$count256)]>; 4357 } 4358} 4359 4360// Define an instruction that operates on two strings, both terminated 4361// by the character in R0. The instruction processes a CPU-determinated 4362// number of bytes at a time and sets CC to 3 if the instruction needs 4363// to be repeated. Also define a pseudo instruction that represents 4364// the full loop (the main instruction plus the branch on CC==3). 4365multiclass StringRRE<string mnemonic, bits<16> opcode, 4366 SDPatternOperator operator> { 4367 let Uses = [R0L] in 4368 def "" : SideEffectBinaryMemMemRRE<mnemonic, opcode, GR64, GR64>; 4369 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in 4370 def Loop : Pseudo<(outs GR64:$end), 4371 (ins GR64:$start1, GR64:$start2, GR32:$char), 4372 [(set GR64:$end, (operator GR64:$start1, GR64:$start2, 4373 GR32:$char))]>; 4374} 4375 4376// A pseudo instruction that is a direct alias of a real instruction. 4377// These aliases are used in cases where a particular register operand is 4378// fixed or where the same instruction is used with different register sizes. 4379// The size parameter is the size in bytes of the associated real instruction. 4380class Alias<int size, dag outs, dag ins, list<dag> pattern> 4381 : InstSystemZ<size, outs, ins, "", pattern> { 4382 let isPseudo = 1; 4383 let isCodeGenOnly = 1; 4384} 4385 4386class UnaryAliasVRS<RegisterOperand cls1, RegisterOperand cls2> 4387 : Alias<6, (outs cls1:$src1), (ins cls2:$src2), []>; 4388 4389// An alias of a UnaryVRR*, but with different register sizes. 4390class UnaryAliasVRR<SDPatternOperator operator, TypedReg tr1, TypedReg tr2> 4391 : Alias<6, (outs tr1.op:$V1), (ins tr2.op:$V2), 4392 [(set tr1.op:$V1, (tr1.vt (operator (tr2.vt tr2.op:$V2))))]>; 4393 4394// An alias of a UnaryVRX, but with different register sizes. 4395class UnaryAliasVRX<SDPatternOperator operator, TypedReg tr, 4396 AddressingMode mode = bdxaddr12only> 4397 : Alias<6, (outs tr.op:$V1), (ins mode:$XBD2), 4398 [(set tr.op:$V1, (tr.vt (operator mode:$XBD2)))]>; 4399 4400// An alias of a StoreVRX, but with different register sizes. 4401class StoreAliasVRX<SDPatternOperator operator, TypedReg tr, 4402 AddressingMode mode = bdxaddr12only> 4403 : Alias<6, (outs), (ins tr.op:$V1, mode:$XBD2), 4404 [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>; 4405 4406// An alias of a BinaryRI, but with different register sizes. 4407class BinaryAliasRI<SDPatternOperator operator, RegisterOperand cls, 4408 Immediate imm> 4409 : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 4410 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 4411 let Constraints = "$R1 = $R1src"; 4412} 4413 4414// An alias of a BinaryRIL, but with different register sizes. 4415class BinaryAliasRIL<SDPatternOperator operator, RegisterOperand cls, 4416 Immediate imm> 4417 : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 4418 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 4419 let Constraints = "$R1 = $R1src"; 4420} 4421 4422// An alias of a BinaryVRRf, but with different register sizes. 4423class BinaryAliasVRRf<RegisterOperand cls> 4424 : Alias<6, (outs VR128:$V1), (ins cls:$R2, cls:$R3), []>; 4425 4426// An alias of a CompareRI, but with different register sizes. 4427class CompareAliasRI<SDPatternOperator operator, RegisterOperand cls, 4428 Immediate imm> 4429 : Alias<4, (outs), (ins cls:$R1, imm:$I2), [(operator cls:$R1, imm:$I2)]> { 4430 let isCompare = 1; 4431} 4432 4433// An alias of a RotateSelectRIEf, but with different register sizes. 4434class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2> 4435 : Alias<6, (outs cls1:$R1), 4436 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, 4437 imm32zx6:$I5), []> { 4438 let Constraints = "$R1 = $R1src"; 4439} 4440