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