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