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 InstVRRj<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<5> V2; 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} = V2{3-0}; 1454 let Inst{31-28} = V3{3-0}; 1455 let Inst{27-24} = 0; 1456 let Inst{23-20} = M4; 1457 let Inst{19-16} = 0; 1458 let Inst{15-12} = 0; 1459 let Inst{11} = V1{4}; 1460 let Inst{10} = V2{4}; 1461 let Inst{9} = V3{4}; 1462 let Inst{8} = 0; 1463 let Inst{7-0} = op{7-0}; 1464} 1465 1466class InstVRRk<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1467 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1468 field bits<48> Inst; 1469 field bits<48> SoftFail = 0; 1470 1471 bits<5> V1; 1472 bits<5> V2; 1473 bits<4> M3; 1474 1475 let Inst{47-40} = op{15-8}; 1476 let Inst{39-36} = V1{3-0}; 1477 let Inst{35-32} = V2{3-0}; 1478 let Inst{31-28} = 0; 1479 let Inst{27-24} = 0; 1480 let Inst{23-20} = M3; 1481 let Inst{19-16} = 0; 1482 let Inst{15-12} = 0; 1483 let Inst{11} = V1{4}; 1484 let Inst{10} = V2{4}; 1485 let Inst{9} = 0; 1486 let Inst{8} = 0; 1487 let Inst{7-0} = op{7-0}; 1488} 1489 1490class InstVRSa<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1491 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1492 field bits<48> Inst; 1493 field bits<48> SoftFail = 0; 1494 1495 bits<5> V1; 1496 bits<16> BD2; 1497 bits<5> V3; 1498 bits<4> M4; 1499 1500 let Inst{47-40} = op{15-8}; 1501 let Inst{39-36} = V1{3-0}; 1502 let Inst{35-32} = V3{3-0}; 1503 let Inst{31-16} = BD2; 1504 let Inst{15-12} = M4; 1505 let Inst{11} = V1{4}; 1506 let Inst{10} = V3{4}; 1507 let Inst{9-8} = 0; 1508 let Inst{7-0} = op{7-0}; 1509} 1510 1511class InstVRSb<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1512 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1513 field bits<48> Inst; 1514 field bits<48> SoftFail = 0; 1515 1516 bits<5> V1; 1517 bits<16> BD2; 1518 bits<4> R3; 1519 bits<4> M4; 1520 1521 let Inst{47-40} = op{15-8}; 1522 let Inst{39-36} = V1{3-0}; 1523 let Inst{35-32} = R3; 1524 let Inst{31-16} = BD2; 1525 let Inst{15-12} = M4; 1526 let Inst{11} = V1{4}; 1527 let Inst{10-8} = 0; 1528 let Inst{7-0} = op{7-0}; 1529} 1530 1531class InstVRSc<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1532 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1533 field bits<48> Inst; 1534 field bits<48> SoftFail = 0; 1535 1536 bits<4> R1; 1537 bits<16> BD2; 1538 bits<5> V3; 1539 bits<4> M4; 1540 1541 let Inst{47-40} = op{15-8}; 1542 let Inst{39-36} = R1; 1543 let Inst{35-32} = V3{3-0}; 1544 let Inst{31-16} = BD2; 1545 let Inst{15-12} = M4; 1546 let Inst{11} = 0; 1547 let Inst{10} = V3{4}; 1548 let Inst{9-8} = 0; 1549 let Inst{7-0} = op{7-0}; 1550} 1551 1552class InstVRSd<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1553 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1554 field bits<48> Inst; 1555 field bits<48> SoftFail = 0; 1556 1557 bits<5> V1; 1558 bits<16> BD2; 1559 bits<4> R3; 1560 1561 let Inst{47-40} = op{15-8}; 1562 let Inst{39-36} = 0; 1563 let Inst{35-32} = R3; 1564 let Inst{31-16} = BD2; 1565 let Inst{15-12} = V1{3-0}; 1566 let Inst{11-9} = 0; 1567 let Inst{8} = V1{4}; 1568 let Inst{7-0} = op{7-0}; 1569} 1570 1571class InstVRV<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1572 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1573 field bits<48> Inst; 1574 field bits<48> SoftFail = 0; 1575 1576 bits<5> V1; 1577 bits<21> VBD2; 1578 bits<4> M3; 1579 1580 let Inst{47-40} = op{15-8}; 1581 let Inst{39-36} = V1{3-0}; 1582 let Inst{35-16} = VBD2{19-0}; 1583 let Inst{15-12} = M3; 1584 let Inst{11} = V1{4}; 1585 let Inst{10} = VBD2{20}; 1586 let Inst{9-8} = 0; 1587 let Inst{7-0} = op{7-0}; 1588} 1589 1590class InstVRX<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1591 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1592 field bits<48> Inst; 1593 field bits<48> SoftFail = 0; 1594 1595 bits<5> V1; 1596 bits<20> XBD2; 1597 bits<4> M3; 1598 1599 let Inst{47-40} = op{15-8}; 1600 let Inst{39-36} = V1{3-0}; 1601 let Inst{35-16} = XBD2; 1602 let Inst{15-12} = M3; 1603 let Inst{11} = V1{4}; 1604 let Inst{10-8} = 0; 1605 let Inst{7-0} = op{7-0}; 1606} 1607 1608class InstVSI<bits<16> op, dag outs, dag ins, string asmstr, list<dag> pattern> 1609 : InstSystemZ<6, outs, ins, asmstr, pattern> { 1610 field bits<48> Inst; 1611 field bits<48> SoftFail = 0; 1612 1613 bits<5> V1; 1614 bits<16> BD2; 1615 bits<8> I3; 1616 1617 let Inst{47-40} = op{15-8}; 1618 let Inst{39-32} = I3; 1619 let Inst{31-16} = BD2; 1620 let Inst{15-12} = V1{3-0}; 1621 let Inst{11-9} = 0; 1622 let Inst{8} = V1{4}; 1623 let Inst{7-0} = op{7-0}; 1624} 1625 1626//===----------------------------------------------------------------------===// 1627// Instruction classes for .insn directives 1628//===----------------------------------------------------------------------===// 1629 1630class DirectiveInsnE<dag outs, dag ins, string asmstr, list<dag> pattern> 1631 : InstE<0, outs, ins, asmstr, pattern> { 1632 bits<16> enc; 1633 1634 let Inst = enc; 1635} 1636 1637class DirectiveInsnRI<dag outs, dag ins, string asmstr, list<dag> pattern> 1638 : InstRIa<0, outs, ins, asmstr, pattern> { 1639 bits<32> enc; 1640 1641 let Inst{31-24} = enc{31-24}; 1642 let Inst{19-16} = enc{19-16}; 1643} 1644 1645class DirectiveInsnRIE<dag outs, dag ins, string asmstr, list<dag> pattern> 1646 : InstRIEd<0, outs, ins, asmstr, pattern> { 1647 bits<48> enc; 1648 1649 let Inst{47-40} = enc{47-40}; 1650 let Inst{7-0} = enc{7-0}; 1651} 1652 1653class DirectiveInsnRIL<dag outs, dag ins, string asmstr, list<dag> pattern> 1654 : InstRILa<0, outs, ins, asmstr, pattern> { 1655 bits<48> enc; 1656 string type; 1657 1658 let Inst{47-40} = enc{47-40}; 1659 let Inst{35-32} = enc{35-32}; 1660} 1661 1662class DirectiveInsnRIS<dag outs, dag ins, string asmstr, list<dag> pattern> 1663 : InstRIS<0, outs, ins, asmstr, pattern> { 1664 bits<48> enc; 1665 1666 let Inst{47-40} = enc{47-40}; 1667 let Inst{7-0} = enc{7-0}; 1668} 1669 1670class DirectiveInsnRR<dag outs, dag ins, string asmstr, list<dag> pattern> 1671 : InstRR<0, outs, ins, asmstr, pattern> { 1672 bits<16> enc; 1673 1674 let Inst{15-8} = enc{15-8}; 1675} 1676 1677class DirectiveInsnRRE<dag outs, dag ins, string asmstr, list<dag> pattern> 1678 : InstRRE<0, outs, ins, asmstr, pattern> { 1679 bits<32> enc; 1680 1681 let Inst{31-16} = enc{31-16}; 1682} 1683 1684class DirectiveInsnRRF<dag outs, dag ins, string asmstr, list<dag> pattern> 1685 : InstRRFa<0, outs, ins, asmstr, pattern> { 1686 bits<32> enc; 1687 1688 let Inst{31-16} = enc{31-16}; 1689} 1690 1691class DirectiveInsnRRS<dag outs, dag ins, string asmstr, list<dag> pattern> 1692 : InstRRS<0, outs, ins, asmstr, pattern> { 1693 bits<48> enc; 1694 1695 let Inst{47-40} = enc{47-40}; 1696 let Inst{7-0} = enc{7-0}; 1697} 1698 1699class DirectiveInsnRS<dag outs, dag ins, string asmstr, list<dag> pattern> 1700 : InstRSa<0, outs, ins, asmstr, pattern> { 1701 bits<32> enc; 1702 1703 let Inst{31-24} = enc{31-24}; 1704} 1705 1706// RSE is like RSY except with a 12 bit displacement (instead of 20). 1707class DirectiveInsnRSE<dag outs, dag ins, string asmstr, list<dag> pattern> 1708 : InstRSYa<6, outs, ins, asmstr, pattern> { 1709 bits <48> enc; 1710 1711 let Inst{47-40} = enc{47-40}; 1712 let Inst{31-16} = BD2{15-0}; 1713 let Inst{15-8} = 0; 1714 let Inst{7-0} = enc{7-0}; 1715} 1716 1717class DirectiveInsnRSI<dag outs, dag ins, string asmstr, list<dag> pattern> 1718 : InstRSI<0, outs, ins, asmstr, pattern> { 1719 bits<32> enc; 1720 1721 let Inst{31-24} = enc{31-24}; 1722} 1723 1724class DirectiveInsnRSY<dag outs, dag ins, string asmstr, list<dag> pattern> 1725 : InstRSYa<0, outs, ins, asmstr, pattern> { 1726 bits<48> enc; 1727 1728 let Inst{47-40} = enc{47-40}; 1729 let Inst{7-0} = enc{7-0}; 1730} 1731 1732class DirectiveInsnRX<dag outs, dag ins, string asmstr, list<dag> pattern> 1733 : InstRXa<0, outs, ins, asmstr, pattern> { 1734 bits<32> enc; 1735 1736 let Inst{31-24} = enc{31-24}; 1737} 1738 1739class DirectiveInsnRXE<dag outs, dag ins, string asmstr, list<dag> pattern> 1740 : InstRXE<0, outs, ins, asmstr, pattern> { 1741 bits<48> enc; 1742 1743 let M3 = 0; 1744 1745 let Inst{47-40} = enc{47-40}; 1746 let Inst{7-0} = enc{7-0}; 1747} 1748 1749class DirectiveInsnRXF<dag outs, dag ins, string asmstr, list<dag> pattern> 1750 : InstRXF<0, outs, ins, asmstr, pattern> { 1751 bits<48> enc; 1752 1753 let Inst{47-40} = enc{47-40}; 1754 let Inst{7-0} = enc{7-0}; 1755} 1756 1757class DirectiveInsnRXY<dag outs, dag ins, string asmstr, list<dag> pattern> 1758 : InstRXYa<0, outs, ins, asmstr, pattern> { 1759 bits<48> enc; 1760 1761 let Inst{47-40} = enc{47-40}; 1762 let Inst{7-0} = enc{7-0}; 1763} 1764 1765class DirectiveInsnS<dag outs, dag ins, string asmstr, list<dag> pattern> 1766 : InstS<0, outs, ins, asmstr, pattern> { 1767 bits<32> enc; 1768 1769 let Inst{31-16} = enc{31-16}; 1770} 1771 1772class DirectiveInsnSI<dag outs, dag ins, string asmstr, list<dag> pattern> 1773 : InstSI<0, outs, ins, asmstr, pattern> { 1774 bits<32> enc; 1775 1776 let Inst{31-24} = enc{31-24}; 1777} 1778 1779class DirectiveInsnSIY<dag outs, dag ins, string asmstr, list<dag> pattern> 1780 : InstSIY<0, outs, ins, asmstr, pattern> { 1781 bits<48> enc; 1782 1783 let Inst{47-40} = enc{47-40}; 1784 let Inst{7-0} = enc{7-0}; 1785} 1786 1787class DirectiveInsnSIL<dag outs, dag ins, string asmstr, list<dag> pattern> 1788 : InstSIL<0, outs, ins, asmstr, pattern> { 1789 bits<48> enc; 1790 1791 let Inst{47-32} = enc{47-32}; 1792} 1793 1794class DirectiveInsnSS<dag outs, dag ins, string asmstr, list<dag> pattern> 1795 : InstSSd<0, outs, ins, asmstr, pattern> { 1796 bits<48> enc; 1797 1798 let Inst{47-40} = enc{47-40}; 1799} 1800 1801class DirectiveInsnSSE<dag outs, dag ins, string asmstr, list<dag> pattern> 1802 : InstSSE<0, outs, ins, asmstr, pattern> { 1803 bits<48> enc; 1804 1805 let Inst{47-32} = enc{47-32}; 1806} 1807 1808class DirectiveInsnSSF<dag outs, dag ins, string asmstr, list<dag> pattern> 1809 : InstSSF<0, outs, ins, asmstr, pattern> { 1810 bits<48> enc; 1811 1812 let Inst{47-40} = enc{47-40}; 1813 let Inst{35-32} = enc{35-32}; 1814} 1815 1816class DirectiveInsnVRI<dag outs, dag ins, string asmstr, list<dag> pattern> 1817 : InstVRIe<0, outs, ins, asmstr, pattern> { 1818 bits<48> enc; 1819 1820 let Inst{47-40} = enc{47-40}; 1821 let Inst{7-0} = enc{7-0}; 1822} 1823 1824class DirectiveInsnVRR<dag outs, dag ins, string asmstr, list<dag> pattern> 1825 : InstVRRc<0, outs, ins, asmstr, pattern> { 1826 bits<48> enc; 1827 1828 let Inst{47-40} = enc{47-40}; 1829 let Inst{7-0} = enc{7-0}; 1830} 1831 1832class DirectiveInsnVRS<dag outs, dag ins, string asmstr, list<dag> pattern> 1833 : InstVRSc<0, outs, ins, asmstr, pattern> { 1834 bits<48> enc; 1835 1836 let Inst{47-40} = enc{47-40}; 1837 let Inst{7-0} = enc{7-0}; 1838} 1839 1840class DirectiveInsnVRV<dag outs, dag ins, string asmstr, list<dag> pattern> 1841 : InstVRV<0, outs, ins, asmstr, pattern> { 1842 bits<48> enc; 1843 1844 let Inst{47-40} = enc{47-40}; 1845 let Inst{7-0} = enc{7-0}; 1846} 1847 1848class DirectiveInsnVRX<dag outs, dag ins, string asmstr, list<dag> pattern> 1849 : InstVRX<0, outs, ins, asmstr, pattern> { 1850 bits<48> enc; 1851 1852 let Inst{47-40} = enc{47-40}; 1853 let Inst{7-0} = enc{7-0}; 1854} 1855 1856class DirectiveInsnVSI<dag outs, dag ins, string asmstr, list<dag> pattern> 1857 : InstVSI<0, outs, ins, asmstr, pattern> { 1858 bits<48> enc; 1859 1860 let Inst{47-40} = enc{47-40}; 1861 let Inst{7-0} = enc{7-0}; 1862} 1863 1864 1865//===----------------------------------------------------------------------===// 1866// Variants of instructions with condition mask 1867//===----------------------------------------------------------------------===// 1868// 1869// For instructions using a condition mask (e.g. conditional branches, 1870// compare-and-branch instructions, or conditional move instructions), 1871// we generally need to create multiple instruction patterns: 1872// 1873// - One used for code generation, which encodes the condition mask as an 1874// MI operand, but writes out an extended mnemonic for better readability. 1875// - One pattern for the base form of the instruction with an explicit 1876// condition mask (encoded as a plain integer MI operand). 1877// - Specific patterns for each extended mnemonic, where the condition mask 1878// is implied by the pattern name and not otherwise encoded at all. 1879// 1880// We need the latter primarily for the assembler and disassembler, since the 1881// assembler parser is not able to decode part of an instruction mnemonic 1882// into an operand. Thus we provide separate patterns for each mnemonic. 1883// 1884// Note that in some cases there are two different mnemonics for the same 1885// condition mask. In this case we cannot have both instructions available 1886// to the disassembler at the same time since the encodings are not distinct. 1887// Therefore the alternate forms are marked isAsmParserOnly. 1888// 1889// We don't make one of the two names an alias of the other because 1890// we need the custom parsing routines to select the correct register class. 1891// 1892// This section provides helpers for generating the specific forms. 1893// 1894//===----------------------------------------------------------------------===// 1895 1896// A class to describe a variant of an instruction with condition mask. 1897class CondVariant<bits<4> ccmaskin, string suffixin, bit alternatein, 1898 string asmvariantin = ""> { 1899 // The fixed condition mask to use. 1900 bits<4> ccmask = ccmaskin; 1901 1902 // The suffix to use for the extended assembler mnemonic. 1903 string suffix = suffixin; 1904 1905 // Whether this is an alternate that needs to be marked isAsmParserOnly. 1906 bit alternate = alternatein; 1907 1908 // Whether this needs be to restricted to a specific dialect. 1909 // Valid values are "att" and "hlasm", which when passed in 1910 // will set AsmVariantName. 1911 string asmvariant = asmvariantin; 1912} 1913 1914// Condition mask 15 means "always true", which is used to define 1915// unconditional branches as a variant of conditional branches. 1916def CondAlways : CondVariant<15, "", 0>; 1917 1918// Condition masks for general instructions that can set all 4 bits. 1919def CondVariantO : CondVariant<1, "o", 0>; 1920def CondVariantH : CondVariant<2, "h", 0>; 1921def CondVariantP : CondVariant<2, "p", 1>; 1922def CondVariantNLE : CondVariant<3, "nle", 0, "att">; 1923def CondVariantL : CondVariant<4, "l", 0>; 1924def CondVariantM : CondVariant<4, "m", 1>; 1925def CondVariantNHE : CondVariant<5, "nhe", 0, "att">; 1926def CondVariantLH : CondVariant<6, "lh", 0, "att">; 1927def CondVariantNE : CondVariant<7, "ne", 0>; 1928def CondVariantNZ : CondVariant<7, "nz", 1>; 1929def CondVariantE : CondVariant<8, "e", 0>; 1930def CondVariantZ : CondVariant<8, "z", 1>; 1931def CondVariantNLH : CondVariant<9, "nlh", 0, "att">; 1932def CondVariantHE : CondVariant<10, "he", 0, "att">; 1933def CondVariantNL : CondVariant<11, "nl", 0>; 1934def CondVariantNM : CondVariant<11, "nm", 1>; 1935def CondVariantLE : CondVariant<12, "le", 0, "att">; 1936def CondVariantNH : CondVariant<13, "nh", 0>; 1937def CondVariantNP : CondVariant<13, "np", 1>; 1938def CondVariantNO : CondVariant<14, "no", 0>; 1939 1940// A helper class to look up one of the above by name. 1941class CV<string name> 1942 : CondVariant<!cast<CondVariant>("CondVariant"#name).ccmask, 1943 !cast<CondVariant>("CondVariant"#name).suffix, 1944 !cast<CondVariant>("CondVariant"#name).alternate, 1945 !cast<CondVariant>("CondVariant"#name).asmvariant>; 1946 1947// Condition masks for integer instructions (e.g. compare-and-branch). 1948// This is like the list above, except that condition 3 is not possible 1949// and that the low bit of the mask is therefore always 0. This means 1950// that each condition has two names. Conditions "o" and "no" are not used. 1951def IntCondVariantH : CondVariant<2, "h", 0>; 1952def IntCondVariantNLE : CondVariant<2, "nle", 1, "att">; 1953def IntCondVariantL : CondVariant<4, "l", 0>; 1954def IntCondVariantNHE : CondVariant<4, "nhe", 1, "att">; 1955def IntCondVariantLH : CondVariant<6, "lh", 0, "att">; 1956def IntCondVariantNE : CondVariant<6, "ne", 1>; 1957def IntCondVariantE : CondVariant<8, "e", 0>; 1958def IntCondVariantNLH : CondVariant<8, "nlh", 1, "att">; 1959def IntCondVariantHE : CondVariant<10, "he", 0, "att">; 1960def IntCondVariantNL : CondVariant<10, "nl", 1>; 1961def IntCondVariantLE : CondVariant<12, "le", 0, "att">; 1962def IntCondVariantNH : CondVariant<12, "nh", 1>; 1963 1964// A helper class to look up one of the above by name. 1965class ICV<string name> 1966 : CondVariant<!cast<CondVariant>("IntCondVariant"#name).ccmask, 1967 !cast<CondVariant>("IntCondVariant"#name).suffix, 1968 !cast<CondVariant>("IntCondVariant"#name).alternate, 1969 !cast<CondVariant>("IntCondVariant"#name).asmvariant>; 1970 1971// Defines a class that makes it easier to define 1972// a MnemonicAlias when CondVariant's are involved. 1973multiclass MnemonicCondBranchAlias<CondVariant V, string from, string to, 1974 string asmvariant = V.asmvariant> { 1975 if !or(!eq(V.asmvariant, ""), !eq(V.asmvariant, asmvariant)) then 1976 def "" : MnemonicAlias<!subst("#", V.suffix, from), 1977 !subst("#", V.suffix, to), 1978 asmvariant>; 1979} 1980 1981//===----------------------------------------------------------------------===// 1982// Instruction definitions with semantics 1983//===----------------------------------------------------------------------===// 1984// 1985// These classes have the form [Cond]<Category><Format>, where <Format> is one 1986// of the formats defined above and where <Category> describes the inputs 1987// and outputs. "Cond" is used if the instruction is conditional, 1988// in which case the 4-bit condition-code mask is added as a final operand. 1989// <Category> can be one of: 1990// 1991// Inherent: 1992// One register output operand and no input operands. 1993// 1994// InherentDual: 1995// Two register output operands and no input operands. 1996// 1997// StoreInherent: 1998// One address operand. The instruction stores to the address. 1999// 2000// SideEffectInherent: 2001// No input or output operands, but causes some side effect. 2002// 2003// Branch: 2004// One branch target. The instruction branches to the target. 2005// 2006// Call: 2007// One output operand and one branch target. The instruction stores 2008// the return address to the output operand and branches to the target. 2009// 2010// CmpBranch: 2011// Two input operands and one optional branch target. The instruction 2012// compares the two input operands and branches or traps on the result. 2013// 2014// BranchUnary: 2015// One register output operand, one register input operand and one branch 2016// target. The instructions stores a modified form of the source register 2017// in the destination register and branches on the result. 2018// 2019// BranchBinary: 2020// One register output operand, two register input operands and one branch 2021// target. The instructions stores a modified form of one of the source 2022// registers in the destination register and branches on the result. 2023// 2024// LoadMultiple: 2025// One address input operand and two explicit output operands. 2026// The instruction loads a range of registers from the address, 2027// with the explicit operands giving the first and last register 2028// to load. Other loaded registers are added as implicit definitions. 2029// 2030// StoreMultiple: 2031// Two explicit input register operands and an address operand. 2032// The instruction stores a range of registers to the address, 2033// with the explicit operands giving the first and last register 2034// to store. Other stored registers are added as implicit uses. 2035// 2036// StoreLength: 2037// One value operand, one length operand and one address operand. 2038// The instruction stores the value operand to the address but 2039// doesn't write more than the number of bytes specified by the 2040// length operand. 2041// 2042// LoadAddress: 2043// One register output operand and one address operand. 2044// 2045// SideEffectAddress: 2046// One address operand. No output operands, but causes some side effect. 2047// 2048// Unary: 2049// One register output operand and one input operand. 2050// 2051// Store: 2052// One address operand and one other input operand. The instruction 2053// stores to the address. 2054// 2055// SideEffectUnary: 2056// One input operand. No output operands, but causes some side effect. 2057// 2058// Binary: 2059// One register output operand and two input operands. 2060// 2061// StoreBinary: 2062// One address operand and two other input operands. The instruction 2063// stores to the address. 2064// 2065// SideEffectBinary: 2066// Two input operands. No output operands, but causes some side effect. 2067// 2068// Compare: 2069// Two input operands and an implicit CC output operand. 2070// 2071// Test: 2072// One or two input operands and an implicit CC output operand. If 2073// present, the second input operand is an "address" operand used as 2074// a test class mask. 2075// 2076// Ternary: 2077// One register output operand and three input operands. 2078// 2079// SideEffectTernary: 2080// Three input operands. No output operands, but causes some side effect. 2081// 2082// Quaternary: 2083// One register output operand and four input operands. 2084// 2085// LoadAndOp: 2086// One output operand and two input operands, one of which is an address. 2087// The instruction both reads from and writes to the address. 2088// 2089// CmpSwap: 2090// One output operand and three input operands, one of which is an address. 2091// The instruction both reads from and writes to the address. 2092// 2093// RotateSelect: 2094// One output operand and five input operands. The first two operands 2095// are registers and the other three are immediates. 2096// 2097// Prefetch: 2098// One 4-bit immediate operand and one address operand. The immediate 2099// operand is 1 for a load prefetch and 2 for a store prefetch. 2100// 2101// BranchPreload: 2102// One 4-bit immediate operand and two address operands. 2103// 2104// The format determines which input operands are tied to output operands, 2105// and also determines the shape of any address operand. 2106// 2107// Multiclasses of the form <Category><Format>Pair define two instructions, 2108// one with <Category><Format> and one with <Category><Format>Y. The name 2109// of the first instruction has no suffix, the name of the second has 2110// an extra "y". 2111// 2112//===----------------------------------------------------------------------===// 2113 2114class InherentRRE<string mnemonic, bits<16> opcode, RegisterOperand cls, 2115 SDPatternOperator operator> 2116 : InstRRE<opcode, (outs cls:$R1), (ins), 2117 mnemonic#"\t$R1", 2118 [(set cls:$R1, (operator))]> { 2119 let R2 = 0; 2120} 2121 2122class InherentDualRRE<string mnemonic, bits<16> opcode, RegisterOperand cls> 2123 : InstRRE<opcode, (outs cls:$R1, cls:$R2), (ins), 2124 mnemonic#"\t$R1, $R2", []>; 2125 2126class InherentVRIa<string mnemonic, bits<16> opcode, bits<16> value> 2127 : InstVRIa<opcode, (outs VR128:$V1), (ins), mnemonic#"\t$V1", []> { 2128 let I2 = value; 2129 let M3 = 0; 2130} 2131 2132class StoreInherentS<string mnemonic, bits<16> opcode, 2133 SDPatternOperator operator, bits<5> bytes> 2134 : InstS<opcode, (outs), (ins bdaddr12only:$BD2), 2135 mnemonic#"\t$BD2", [(operator bdaddr12only:$BD2)]> { 2136 let mayStore = 1; 2137 let AccessBytes = bytes; 2138} 2139 2140class SideEffectInherentE<string mnemonic, bits<16>opcode> 2141 : InstE<opcode, (outs), (ins), mnemonic, []>; 2142 2143class SideEffectInherentS<string mnemonic, bits<16> opcode, 2144 SDPatternOperator operator> 2145 : InstS<opcode, (outs), (ins), mnemonic, [(operator)]> { 2146 let BD2 = 0; 2147} 2148 2149class SideEffectInherentRRE<string mnemonic, bits<16> opcode> 2150 : InstRRE<opcode, (outs), (ins), mnemonic, []> { 2151 let R1 = 0; 2152 let R2 = 0; 2153} 2154 2155// Allow an optional TLS marker symbol to generate TLS call relocations. 2156class CallRI<string mnemonic, bits<12> opcode> 2157 : InstRIb<opcode, (outs), (ins GR64:$R1, brtarget16tls:$RI2), 2158 mnemonic#"\t$R1, $RI2", []>; 2159 2160// Allow an optional TLS marker symbol to generate TLS call relocations. 2161class CallRIL<string mnemonic, bits<12> opcode> 2162 : InstRILb<opcode, (outs), (ins GR64:$R1, brtarget32tls:$RI2), 2163 mnemonic#"\t$R1, $RI2", []>; 2164 2165class CallRR<string mnemonic, bits<8> opcode> 2166 : InstRR<opcode, (outs), (ins GR64:$R1, ADDR64:$R2), 2167 mnemonic#"\t$R1, $R2", []>; 2168 2169class CallRX<string mnemonic, bits<8> opcode> 2170 : InstRXa<opcode, (outs), (ins GR64:$R1, bdxaddr12only:$XBD2), 2171 mnemonic#"\t$R1, $XBD2", []>; 2172 2173class CondBranchRI<string mnemonic, bits<12> opcode, 2174 SDPatternOperator operator = null_frag> 2175 : InstRIc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget16:$RI2), 2176 !subst("#", "${M1}", mnemonic)#"\t$RI2", 2177 [(operator cond4:$valid, cond4:$M1, bb:$RI2)]> { 2178 let CCMaskFirst = 1; 2179} 2180 2181class AsmCondBranchRI<string mnemonic, bits<12> opcode> 2182 : InstRIc<opcode, (outs), (ins imm32zx4:$M1, brtarget16:$RI2), 2183 mnemonic#"\t$M1, $RI2", []>; 2184 2185class FixedCondBranchRI<CondVariant V, string mnemonic, bits<12> opcode, 2186 SDPatternOperator operator = null_frag> 2187 : InstRIc<opcode, (outs), (ins brtarget16:$RI2), 2188 !subst("#", V.suffix, mnemonic)#"\t$RI2", [(operator bb:$RI2)]> { 2189 let isAsmParserOnly = V.alternate; 2190 let AsmVariantName = V.asmvariant; 2191 let M1 = V.ccmask; 2192} 2193 2194class CondBranchRIL<string mnemonic, bits<12> opcode> 2195 : InstRILc<opcode, (outs), (ins cond4:$valid, cond4:$M1, brtarget32:$RI2), 2196 !subst("#", "${M1}", mnemonic)#"\t$RI2", []> { 2197 let CCMaskFirst = 1; 2198} 2199 2200class AsmCondBranchRIL<string mnemonic, bits<12> opcode> 2201 : InstRILc<opcode, (outs), (ins imm32zx4:$M1, brtarget32:$RI2), 2202 mnemonic#"\t$M1, $RI2", []>; 2203 2204class FixedCondBranchRIL<CondVariant V, string mnemonic, bits<12> opcode> 2205 : InstRILc<opcode, (outs), (ins brtarget32:$RI2), 2206 !subst("#", V.suffix, mnemonic)#"\t$RI2", []> { 2207 let isAsmParserOnly = V.alternate; 2208 let AsmVariantName = V.asmvariant; 2209 let M1 = V.ccmask; 2210} 2211 2212class CondBranchRR<string mnemonic, bits<8> opcode> 2213 : InstRR<opcode, (outs), (ins cond4:$valid, cond4:$R1, GR64:$R2), 2214 !subst("#", "${R1}", mnemonic)#"\t$R2", []> { 2215 let CCMaskFirst = 1; 2216} 2217 2218class AsmCondBranchRR<string mnemonic, bits<8> opcode> 2219 : InstRR<opcode, (outs), (ins imm32zx4:$R1, GR64:$R2), 2220 mnemonic#"\t$R1, $R2", []>; 2221 2222class FixedCondBranchRR<CondVariant V, string mnemonic, bits<8> opcode, 2223 SDPatternOperator operator = null_frag> 2224 : InstRR<opcode, (outs), (ins ADDR64:$R2), 2225 !subst("#", V.suffix, mnemonic)#"\t$R2", [(operator ADDR64:$R2)]> { 2226 let isAsmParserOnly = V.alternate; 2227 let AsmVariantName = V.asmvariant; 2228 let R1 = V.ccmask; 2229} 2230 2231class CondBranchRX<string mnemonic, bits<8> opcode> 2232 : InstRXb<opcode, (outs), (ins cond4:$valid, cond4:$M1, bdxaddr12only:$XBD2), 2233 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> { 2234 let CCMaskFirst = 1; 2235} 2236 2237class AsmCondBranchRX<string mnemonic, bits<8> opcode> 2238 : InstRXb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr12only:$XBD2), 2239 mnemonic#"\t$M1, $XBD2", []>; 2240 2241class FixedCondBranchRX<CondVariant V, string mnemonic, bits<8> opcode> 2242 : InstRXb<opcode, (outs), (ins bdxaddr12only:$XBD2), 2243 !subst("#", V.suffix, mnemonic)#"\t$XBD2", []> { 2244 let isAsmParserOnly = V.alternate; 2245 let AsmVariantName = V.asmvariant; 2246 let M1 = V.ccmask; 2247} 2248 2249class CondBranchRXY<string mnemonic, bits<16> opcode> 2250 : InstRXYb<opcode, (outs), (ins cond4:$valid, cond4:$M1, bdxaddr20only:$XBD2), 2251 !subst("#", "${M1}", mnemonic)#"\t$XBD2", []> { 2252 let CCMaskFirst = 1; 2253 let mayLoad = 1; 2254} 2255 2256class AsmCondBranchRXY<string mnemonic, bits<16> opcode> 2257 : InstRXYb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr20only:$XBD2), 2258 mnemonic#"\t$M1, $XBD2", []> { 2259 let mayLoad = 1; 2260} 2261 2262class FixedCondBranchRXY<CondVariant V, string mnemonic, bits<16> opcode, 2263 SDPatternOperator operator = null_frag> 2264 : InstRXYb<opcode, (outs), (ins bdxaddr20only:$XBD2), 2265 !subst("#", V.suffix, mnemonic)#"\t$XBD2", 2266 [(operator (load bdxaddr20only:$XBD2))]> { 2267 let isAsmParserOnly = V.alternate; 2268 let AsmVariantName = V.asmvariant; 2269 let M1 = V.ccmask; 2270 let mayLoad = 1; 2271} 2272 2273class CmpBranchRIEa<string mnemonic, bits<16> opcode, 2274 RegisterOperand cls, ImmOpWithPattern imm> 2275 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, cond4:$M3), 2276 mnemonic#"$M3\t$R1, $I2", []>; 2277 2278class AsmCmpBranchRIEa<string mnemonic, bits<16> opcode, 2279 RegisterOperand cls, ImmOpWithPattern imm> 2280 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2, imm32zx4:$M3), 2281 mnemonic#"\t$R1, $I2, $M3", []>; 2282 2283class FixedCmpBranchRIEa<CondVariant V, string mnemonic, bits<16> opcode, 2284 RegisterOperand cls, ImmOpWithPattern imm> 2285 : InstRIEa<opcode, (outs), (ins cls:$R1, imm:$I2), 2286 mnemonic#V.suffix#"\t$R1, $I2", []> { 2287 let isAsmParserOnly = V.alternate; 2288 let AsmVariantName = V.asmvariant; 2289 let M3 = V.ccmask; 2290} 2291 2292multiclass CmpBranchRIEaPair<string mnemonic, bits<16> opcode, 2293 RegisterOperand cls, ImmOpWithPattern imm> { 2294 let isCodeGenOnly = 1 in 2295 def "" : CmpBranchRIEa<mnemonic, opcode, cls, imm>; 2296 def Asm : AsmCmpBranchRIEa<mnemonic, opcode, cls, imm>; 2297} 2298 2299class CmpBranchRIEb<string mnemonic, bits<16> opcode, 2300 RegisterOperand cls> 2301 : InstRIEb<opcode, (outs), 2302 (ins cls:$R1, cls:$R2, cond4:$M3, brtarget16:$RI4), 2303 mnemonic#"$M3\t$R1, $R2, $RI4", []>; 2304 2305class AsmCmpBranchRIEb<string mnemonic, bits<16> opcode, 2306 RegisterOperand cls> 2307 : InstRIEb<opcode, (outs), 2308 (ins cls:$R1, cls:$R2, imm32zx4:$M3, brtarget16:$RI4), 2309 mnemonic#"\t$R1, $R2, $M3, $RI4", []>; 2310 2311class FixedCmpBranchRIEb<CondVariant V, string mnemonic, bits<16> opcode, 2312 RegisterOperand cls> 2313 : InstRIEb<opcode, (outs), (ins cls:$R1, cls:$R2, brtarget16:$RI4), 2314 mnemonic#V.suffix#"\t$R1, $R2, $RI4", []> { 2315 let isAsmParserOnly = V.alternate; 2316 let AsmVariantName = V.asmvariant; 2317 let M3 = V.ccmask; 2318} 2319 2320multiclass CmpBranchRIEbPair<string mnemonic, bits<16> opcode, 2321 RegisterOperand cls> { 2322 let isCodeGenOnly = 1 in 2323 def "" : CmpBranchRIEb<mnemonic, opcode, cls>; 2324 def Asm : AsmCmpBranchRIEb<mnemonic, opcode, cls>; 2325} 2326 2327class CmpBranchRIEc<string mnemonic, bits<16> opcode, 2328 RegisterOperand cls, ImmOpWithPattern imm> 2329 : InstRIEc<opcode, (outs), 2330 (ins cls:$R1, imm:$I2, cond4:$M3, brtarget16:$RI4), 2331 mnemonic#"$M3\t$R1, $I2, $RI4", []>; 2332 2333class AsmCmpBranchRIEc<string mnemonic, bits<16> opcode, 2334 RegisterOperand cls, ImmOpWithPattern imm> 2335 : InstRIEc<opcode, (outs), 2336 (ins cls:$R1, imm:$I2, imm32zx4:$M3, brtarget16:$RI4), 2337 mnemonic#"\t$R1, $I2, $M3, $RI4", []>; 2338 2339class FixedCmpBranchRIEc<CondVariant V, string mnemonic, bits<16> opcode, 2340 RegisterOperand cls, ImmOpWithPattern imm> 2341 : InstRIEc<opcode, (outs), (ins cls:$R1, imm:$I2, brtarget16:$RI4), 2342 mnemonic#V.suffix#"\t$R1, $I2, $RI4", []> { 2343 let isAsmParserOnly = V.alternate; 2344 let AsmVariantName = V.asmvariant; 2345 let M3 = V.ccmask; 2346} 2347 2348multiclass CmpBranchRIEcPair<string mnemonic, bits<16> opcode, 2349 RegisterOperand cls, ImmOpWithPattern imm> { 2350 let isCodeGenOnly = 1 in 2351 def "" : CmpBranchRIEc<mnemonic, opcode, cls, imm>; 2352 def Asm : AsmCmpBranchRIEc<mnemonic, opcode, cls, imm>; 2353} 2354 2355class CmpBranchRRFc<string mnemonic, bits<16> opcode, 2356 RegisterOperand cls> 2357 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, cond4:$M3), 2358 mnemonic#"$M3\t$R1, $R2", []>; 2359 2360class AsmCmpBranchRRFc<string mnemonic, bits<16> opcode, 2361 RegisterOperand cls> 2362 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2, imm32zx4:$M3), 2363 mnemonic#"\t$R1, $R2, $M3", []>; 2364 2365multiclass CmpBranchRRFcPair<string mnemonic, bits<16> opcode, 2366 RegisterOperand cls> { 2367 let isCodeGenOnly = 1 in 2368 def "" : CmpBranchRRFc<mnemonic, opcode, cls>; 2369 def Asm : AsmCmpBranchRRFc<mnemonic, opcode, cls>; 2370} 2371 2372class FixedCmpBranchRRFc<CondVariant V, string mnemonic, bits<16> opcode, 2373 RegisterOperand cls> 2374 : InstRRFc<opcode, (outs), (ins cls:$R1, cls:$R2), 2375 mnemonic#V.suffix#"\t$R1, $R2", []> { 2376 let isAsmParserOnly = V.alternate; 2377 let AsmVariantName = V.asmvariant; 2378 let M3 = V.ccmask; 2379} 2380 2381class CmpBranchRRS<string mnemonic, bits<16> opcode, 2382 RegisterOperand cls> 2383 : InstRRS<opcode, (outs), 2384 (ins cls:$R1, cls:$R2, cond4:$M3, bdaddr12only:$BD4), 2385 mnemonic#"$M3\t$R1, $R2, $BD4", []>; 2386 2387class AsmCmpBranchRRS<string mnemonic, bits<16> opcode, 2388 RegisterOperand cls> 2389 : InstRRS<opcode, (outs), 2390 (ins cls:$R1, cls:$R2, imm32zx4:$M3, bdaddr12only:$BD4), 2391 mnemonic#"\t$R1, $R2, $M3, $BD4", []>; 2392 2393class FixedCmpBranchRRS<CondVariant V, string mnemonic, bits<16> opcode, 2394 RegisterOperand cls> 2395 : InstRRS<opcode, (outs), (ins cls:$R1, cls:$R2, bdaddr12only:$BD4), 2396 mnemonic#V.suffix#"\t$R1, $R2, $BD4", []> { 2397 let isAsmParserOnly = V.alternate; 2398 let AsmVariantName = V.asmvariant; 2399 let M3 = V.ccmask; 2400} 2401 2402multiclass CmpBranchRRSPair<string mnemonic, bits<16> opcode, 2403 RegisterOperand cls> { 2404 let isCodeGenOnly = 1 in 2405 def "" : CmpBranchRRS<mnemonic, opcode, cls>; 2406 def Asm : AsmCmpBranchRRS<mnemonic, opcode, cls>; 2407} 2408 2409class CmpBranchRIS<string mnemonic, bits<16> opcode, 2410 RegisterOperand cls, ImmOpWithPattern imm> 2411 : InstRIS<opcode, (outs), 2412 (ins cls:$R1, imm:$I2, cond4:$M3, bdaddr12only:$BD4), 2413 mnemonic#"$M3\t$R1, $I2, $BD4", []>; 2414 2415class AsmCmpBranchRIS<string mnemonic, bits<16> opcode, 2416 RegisterOperand cls, ImmOpWithPattern imm> 2417 : InstRIS<opcode, (outs), 2418 (ins cls:$R1, imm:$I2, imm32zx4:$M3, bdaddr12only:$BD4), 2419 mnemonic#"\t$R1, $I2, $M3, $BD4", []>; 2420 2421class FixedCmpBranchRIS<CondVariant V, string mnemonic, bits<16> opcode, 2422 RegisterOperand cls, ImmOpWithPattern imm> 2423 : InstRIS<opcode, (outs), (ins cls:$R1, imm:$I2, bdaddr12only:$BD4), 2424 mnemonic#V.suffix#"\t$R1, $I2, $BD4", []> { 2425 let isAsmParserOnly = V.alternate; 2426 let AsmVariantName = V.asmvariant; 2427 let M3 = V.ccmask; 2428} 2429 2430multiclass CmpBranchRISPair<string mnemonic, bits<16> opcode, 2431 RegisterOperand cls, ImmOpWithPattern imm> { 2432 let isCodeGenOnly = 1 in 2433 def "" : CmpBranchRIS<mnemonic, opcode, cls, imm>; 2434 def Asm : AsmCmpBranchRIS<mnemonic, opcode, cls, imm>; 2435} 2436 2437class CmpBranchRSYb<string mnemonic, bits<16> opcode, 2438 RegisterOperand cls> 2439 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, cond4:$M3), 2440 mnemonic#"$M3\t$R1, $BD2", []>; 2441 2442class AsmCmpBranchRSYb<string mnemonic, bits<16> opcode, 2443 RegisterOperand cls> 2444 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2, imm32zx4:$M3), 2445 mnemonic#"\t$R1, $M3, $BD2", []>; 2446 2447multiclass CmpBranchRSYbPair<string mnemonic, bits<16> opcode, 2448 RegisterOperand cls> { 2449 let isCodeGenOnly = 1 in 2450 def "" : CmpBranchRSYb<mnemonic, opcode, cls>; 2451 def Asm : AsmCmpBranchRSYb<mnemonic, opcode, cls>; 2452} 2453 2454class FixedCmpBranchRSYb<CondVariant V, string mnemonic, bits<16> opcode, 2455 RegisterOperand cls> 2456 : InstRSYb<opcode, (outs), (ins cls:$R1, bdaddr20only:$BD2), 2457 mnemonic#V.suffix#"\t$R1, $BD2", []> { 2458 let isAsmParserOnly = V.alternate; 2459 let AsmVariantName = V.asmvariant; 2460 let M3 = V.ccmask; 2461} 2462 2463class BranchUnaryRI<string mnemonic, bits<12> opcode, RegisterOperand cls> 2464 : InstRIb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget16:$RI2), 2465 mnemonic#"\t$R1, $RI2", []> { 2466 let Constraints = "$R1 = $R1src"; 2467 let DisableEncoding = "$R1src"; 2468} 2469 2470class BranchUnaryRIL<string mnemonic, bits<12> opcode, RegisterOperand cls> 2471 : InstRILb<opcode, (outs cls:$R1), (ins cls:$R1src, brtarget32:$RI2), 2472 mnemonic#"\t$R1, $RI2", []> { 2473 let Constraints = "$R1 = $R1src"; 2474 let DisableEncoding = "$R1src"; 2475} 2476 2477class BranchUnaryRR<string mnemonic, bits<8> opcode, RegisterOperand cls> 2478 : InstRR<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2), 2479 mnemonic#"\t$R1, $R2", []> { 2480 let Constraints = "$R1 = $R1src"; 2481 let DisableEncoding = "$R1src"; 2482} 2483 2484class BranchUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls> 2485 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src, GR64:$R2), 2486 mnemonic#"\t$R1, $R2", []> { 2487 let Constraints = "$R1 = $R1src"; 2488 let DisableEncoding = "$R1src"; 2489} 2490 2491class BranchUnaryRX<string mnemonic, bits<8> opcode, RegisterOperand cls> 2492 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2), 2493 mnemonic#"\t$R1, $XBD2", []> { 2494 let Constraints = "$R1 = $R1src"; 2495 let DisableEncoding = "$R1src"; 2496} 2497 2498class BranchUnaryRXY<string mnemonic, bits<16> opcode, RegisterOperand cls> 2499 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr20only:$XBD2), 2500 mnemonic#"\t$R1, $XBD2", []> { 2501 let Constraints = "$R1 = $R1src"; 2502 let DisableEncoding = "$R1src"; 2503} 2504 2505class BranchBinaryRSI<string mnemonic, bits<8> opcode, RegisterOperand cls> 2506 : InstRSI<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, brtarget16:$RI2), 2507 mnemonic#"\t$R1, $R3, $RI2", []> { 2508 let Constraints = "$R1 = $R1src"; 2509 let DisableEncoding = "$R1src"; 2510} 2511 2512class BranchBinaryRIEe<string mnemonic, bits<16> opcode, RegisterOperand cls> 2513 : InstRIEe<opcode, (outs cls:$R1), 2514 (ins cls:$R1src, cls:$R3, brtarget16:$RI2), 2515 mnemonic#"\t$R1, $R3, $RI2", []> { 2516 let Constraints = "$R1 = $R1src"; 2517 let DisableEncoding = "$R1src"; 2518} 2519 2520class BranchBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls> 2521 : InstRSa<opcode, (outs cls:$R1), 2522 (ins cls:$R1src, cls:$R3, bdaddr12only:$BD2), 2523 mnemonic#"\t$R1, $R3, $BD2", []> { 2524 let Constraints = "$R1 = $R1src"; 2525 let DisableEncoding = "$R1src"; 2526} 2527 2528class BranchBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls> 2529 : InstRSYa<opcode, 2530 (outs cls:$R1), (ins cls:$R1src, cls:$R3, bdaddr20only:$BD2), 2531 mnemonic#"\t$R1, $R3, $BD2", []> { 2532 let Constraints = "$R1 = $R1src"; 2533 let DisableEncoding = "$R1src"; 2534} 2535 2536class LoadMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls, 2537 AddressingMode mode = bdaddr12only> 2538 : InstRSa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2), 2539 mnemonic#"\t$R1, $R3, $BD2", []> { 2540 let mayLoad = 1; 2541} 2542 2543class LoadMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls, 2544 AddressingMode mode = bdaddr20only> 2545 : InstRSYa<opcode, (outs cls:$R1, cls:$R3), (ins mode:$BD2), 2546 mnemonic#"\t$R1, $R3, $BD2", []> { 2547 let mayLoad = 1; 2548} 2549 2550multiclass LoadMultipleRSPair<string mnemonic, bits<8> rsOpcode, 2551 bits<16> rsyOpcode, RegisterOperand cls> { 2552 let DispKey = mnemonic # cls in { 2553 let DispSize = "12" in 2554 def "" : LoadMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>; 2555 let DispSize = "20" in 2556 def Y : LoadMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>; 2557 } 2558} 2559 2560class LoadMultipleSSe<string mnemonic, bits<8> opcode, RegisterOperand cls> 2561 : InstSSe<opcode, (outs cls:$R1, cls:$R3), 2562 (ins bdaddr12only:$BD2, bdaddr12only:$BD4), 2563 mnemonic#"\t$R1, $R3, $BD2, $BD4", []> { 2564 let mayLoad = 1; 2565} 2566 2567multiclass LoadMultipleVRSaAlign<string mnemonic, bits<16> opcode> { 2568 let mayLoad = 1 in { 2569 def Align : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3), 2570 (ins bdaddr12only:$BD2, imm32zx4:$M4), 2571 mnemonic#"\t$V1, $V3, $BD2, $M4", []>; 2572 let M4 = 0 in 2573 def "" : InstVRSa<opcode, (outs VR128:$V1, VR128:$V3), 2574 (ins bdaddr12only:$BD2), 2575 mnemonic#"\t$V1, $V3, $BD2", []>; 2576 } 2577} 2578 2579class StoreRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator, 2580 RegisterOperand cls> 2581 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2), 2582 mnemonic#"\t$R1, $RI2", 2583 [(operator cls:$R1, pcrel32:$RI2)]> { 2584 let mayStore = 1; 2585 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 2586 // However, BDXs have two extra operands and are therefore 6 units more 2587 // complex. 2588 let AddedComplexity = 7; 2589} 2590 2591class StoreRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2592 RegisterOperand cls, bits<5> bytes, 2593 AddressingMode mode = bdxaddr12only> 2594 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2), 2595 mnemonic#"\t$R1, $XBD2", 2596 [(operator cls:$R1, mode:$XBD2)]> { 2597 let OpKey = mnemonic#"r"#cls; 2598 let OpType = "mem"; 2599 let mayStore = 1; 2600 let AccessBytes = bytes; 2601} 2602 2603class StoreRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2604 RegisterOperand cls, bits<5> bytes, 2605 AddressingMode mode = bdxaddr20only> 2606 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2), 2607 mnemonic#"\t$R1, $XBD2", 2608 [(operator cls:$R1, mode:$XBD2)]> { 2609 let OpKey = mnemonic#"r"#cls; 2610 let OpType = "mem"; 2611 let mayStore = 1; 2612 let AccessBytes = bytes; 2613} 2614 2615multiclass StoreRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 2616 SDPatternOperator operator, RegisterOperand cls, 2617 bits<5> bytes> { 2618 let DispKey = mnemonic # cls in { 2619 let DispSize = "12" in 2620 def "" : StoreRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>; 2621 let DispSize = "20" in 2622 def Y : StoreRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes, 2623 bdxaddr20pair>; 2624 } 2625} 2626 2627class StoreVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2628 TypedReg tr, bits<5> bytes, bits<4> type = 0> 2629 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2), 2630 mnemonic#"\t$V1, $XBD2", 2631 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2)]> { 2632 let M3 = type; 2633 let mayStore = 1; 2634 let AccessBytes = bytes; 2635} 2636 2637class StoreVRXGeneric<string mnemonic, bits<16> opcode> 2638 : InstVRX<opcode, (outs), (ins VR128:$V1, bdxaddr12only:$XBD2, imm32zx4:$M3), 2639 mnemonic#"\t$V1, $XBD2, $M3", []> { 2640 let mayStore = 1; 2641} 2642 2643multiclass StoreVRXAlign<string mnemonic, bits<16> opcode> { 2644 let mayStore = 1, AccessBytes = 16 in { 2645 def Align : InstVRX<opcode, (outs), 2646 (ins VR128:$V1, bdxaddr12only:$XBD2, imm32zx4:$M3), 2647 mnemonic#"\t$V1, $XBD2, $M3", []>; 2648 let M3 = 0 in 2649 def "" : InstVRX<opcode, (outs), (ins VR128:$V1, bdxaddr12only:$XBD2), 2650 mnemonic#"\t$V1, $XBD2", []>; 2651 } 2652} 2653 2654class StoreLengthVRSb<string mnemonic, bits<16> opcode, 2655 SDPatternOperator operator, bits<5> bytes> 2656 : InstVRSb<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2), 2657 mnemonic#"\t$V1, $R3, $BD2", 2658 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> { 2659 let M4 = 0; 2660 let mayStore = 1; 2661 let AccessBytes = bytes; 2662} 2663 2664class StoreLengthVRSd<string mnemonic, bits<16> opcode, 2665 SDPatternOperator operator, bits<5> bytes> 2666 : InstVRSd<opcode, (outs), (ins VR128:$V1, GR32:$R3, bdaddr12only:$BD2), 2667 mnemonic#"\t$V1, $R3, $BD2", 2668 [(operator VR128:$V1, GR32:$R3, bdaddr12only:$BD2)]> { 2669 let mayStore = 1; 2670 let AccessBytes = bytes; 2671} 2672 2673class StoreLengthVSI<string mnemonic, bits<16> opcode, 2674 SDPatternOperator operator, bits<5> bytes> 2675 : InstVSI<opcode, (outs), (ins VR128:$V1, bdaddr12only:$BD2, imm32zx8:$I3), 2676 mnemonic#"\t$V1, $BD2, $I3", 2677 [(operator VR128:$V1, imm32zx8:$I3, bdaddr12only:$BD2)]> { 2678 let mayStore = 1; 2679 let AccessBytes = bytes; 2680} 2681 2682class StoreMultipleRS<string mnemonic, bits<8> opcode, RegisterOperand cls, 2683 AddressingMode mode = bdaddr12only> 2684 : InstRSa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2), 2685 mnemonic#"\t$R1, $R3, $BD2", []> { 2686 let mayStore = 1; 2687} 2688 2689class StoreMultipleRSY<string mnemonic, bits<16> opcode, RegisterOperand cls, 2690 AddressingMode mode = bdaddr20only> 2691 : InstRSYa<opcode, (outs), (ins cls:$R1, cls:$R3, mode:$BD2), 2692 mnemonic#"\t$R1, $R3, $BD2", []> { 2693 let mayStore = 1; 2694} 2695 2696multiclass StoreMultipleRSPair<string mnemonic, bits<8> rsOpcode, 2697 bits<16> rsyOpcode, RegisterOperand cls> { 2698 let DispKey = mnemonic # cls in { 2699 let DispSize = "12" in 2700 def "" : StoreMultipleRS<mnemonic, rsOpcode, cls, bdaddr12pair>; 2701 let DispSize = "20" in 2702 def Y : StoreMultipleRSY<mnemonic#"y", rsyOpcode, cls, bdaddr20pair>; 2703 } 2704} 2705 2706multiclass StoreMultipleVRSaAlign<string mnemonic, bits<16> opcode> { 2707 let mayStore = 1 in { 2708 def Align : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3, 2709 bdaddr12only:$BD2, imm32zx4:$M4), 2710 mnemonic#"\t$V1, $V3, $BD2, $M4", []>; 2711 let M4 = 0 in 2712 def "" : InstVRSa<opcode, (outs), (ins VR128:$V1, VR128:$V3, 2713 bdaddr12only:$BD2), 2714 mnemonic#"\t$V1, $V3, $BD2", []>; 2715 } 2716} 2717 2718// StoreSI* instructions are used to store an integer to memory, but the 2719// addresses are more restricted than for normal stores. If we are in the 2720// situation of having to force either the address into a register or the 2721// constant into a register, it's usually better to do the latter. 2722// We therefore match the address in the same way as a normal store and 2723// only use the StoreSI* instruction if the matched address is suitable. 2724class StoreSI<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2725 ImmOpWithPattern imm> 2726 : InstSI<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2), 2727 mnemonic#"\t$BD1, $I2", 2728 [(operator imm:$I2, mviaddr12pair:$BD1)]> { 2729 let mayStore = 1; 2730} 2731 2732class StoreSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2733 ImmOpWithPattern imm> 2734 : InstSIY<opcode, (outs), (ins mviaddr20pair:$BD1, imm:$I2), 2735 mnemonic#"\t$BD1, $I2", 2736 [(operator imm:$I2, mviaddr20pair:$BD1)]> { 2737 let mayStore = 1; 2738} 2739 2740class StoreSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2741 ImmOpWithPattern imm> 2742 : InstSIL<opcode, (outs), (ins mviaddr12pair:$BD1, imm:$I2), 2743 mnemonic#"\t$BD1, $I2", 2744 [(operator imm:$I2, mviaddr12pair:$BD1)]> { 2745 let mayStore = 1; 2746} 2747 2748multiclass StoreSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode, 2749 SDPatternOperator operator, ImmOpWithPattern imm> { 2750 let DispKey = mnemonic in { 2751 let DispSize = "12" in 2752 def "" : StoreSI<mnemonic, siOpcode, operator, imm>; 2753 let DispSize = "20" in 2754 def Y : StoreSIY<mnemonic#"y", siyOpcode, operator, imm>; 2755 } 2756} 2757 2758class StoreSSE<string mnemonic, bits<16> opcode> 2759 : InstSSE<opcode, (outs), (ins bdaddr12only:$BD1, bdaddr12only:$BD2), 2760 mnemonic#"\t$BD1, $BD2", []> { 2761 let mayStore = 1; 2762} 2763 2764class CondStoreRSY<string mnemonic, bits<16> opcode, 2765 RegisterOperand cls, bits<5> bytes, 2766 AddressingMode mode = bdaddr20only> 2767 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$M3), 2768 mnemonic#"$M3\t$R1, $BD2", []> { 2769 let mayStore = 1; 2770 let AccessBytes = bytes; 2771 let CCMaskLast = 1; 2772} 2773 2774// Like CondStoreRSY, but used for the raw assembly form. The condition-code 2775// mask is the third operand rather than being part of the mnemonic. 2776class AsmCondStoreRSY<string mnemonic, bits<16> opcode, 2777 RegisterOperand cls, bits<5> bytes, 2778 AddressingMode mode = bdaddr20only> 2779 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2, imm32zx4:$M3), 2780 mnemonic#"\t$R1, $BD2, $M3", []> { 2781 let mayStore = 1; 2782 let AccessBytes = bytes; 2783} 2784 2785// Like CondStoreRSY, but with a fixed CC mask. 2786class FixedCondStoreRSY<CondVariant V, string mnemonic, bits<16> opcode, 2787 RegisterOperand cls, bits<5> bytes, 2788 AddressingMode mode = bdaddr20only> 2789 : InstRSYb<opcode, (outs), (ins cls:$R1, mode:$BD2), 2790 mnemonic#V.suffix#"\t$R1, $BD2", []> { 2791 let mayStore = 1; 2792 let AccessBytes = bytes; 2793 let isAsmParserOnly = V.alternate; 2794 let AsmVariantName = V.asmvariant; 2795 let M3 = V.ccmask; 2796} 2797 2798multiclass CondStoreRSYPair<string mnemonic, bits<16> opcode, 2799 RegisterOperand cls, bits<5> bytes, 2800 AddressingMode mode = bdaddr20only> { 2801 let isCodeGenOnly = 1 in 2802 def "" : CondStoreRSY<mnemonic, opcode, cls, bytes, mode>; 2803 def Asm : AsmCondStoreRSY<mnemonic, opcode, cls, bytes, mode>; 2804} 2805 2806class SideEffectUnaryI<string mnemonic, bits<8> opcode, ImmOpWithPattern imm> 2807 : InstI<opcode, (outs), (ins imm:$I1), 2808 mnemonic#"\t$I1", []>; 2809 2810class SideEffectUnaryRR<string mnemonic, bits<8>opcode, RegisterOperand cls> 2811 : InstRR<opcode, (outs), (ins cls:$R1), 2812 mnemonic#"\t$R1", []> { 2813 let R2 = 0; 2814} 2815 2816class SideEffectUnaryRRE<string mnemonic, bits<16> opcode, RegisterOperand cls, 2817 SDPatternOperator operator> 2818 : InstRRE<opcode, (outs), (ins cls:$R1), 2819 mnemonic#"\t$R1", [(operator cls:$R1)]> { 2820 let R2 = 0; 2821} 2822 2823class SideEffectUnaryS<string mnemonic, bits<16> opcode, 2824 SDPatternOperator operator, bits<5> bytes, 2825 AddressingMode mode = bdaddr12only> 2826 : InstS<opcode, (outs), (ins mode:$BD2), 2827 mnemonic#"\t$BD2", [(operator mode:$BD2)]> { 2828 let mayLoad = 1; 2829 let AccessBytes = bytes; 2830} 2831 2832class SideEffectUnarySIY<string mnemonic, bits<16> opcode, 2833 bits<5> bytes, 2834 AddressingMode mode = bdaddr20only> 2835 : InstSIY<opcode, (outs), (ins mode:$BD1), 2836 mnemonic#"\t$BD1", []> { 2837 let mayLoad = 1; 2838 let AccessBytes = bytes; 2839 let I2 = 0; 2840} 2841 2842class SideEffectAddressS<string mnemonic, bits<16> opcode, 2843 SDPatternOperator operator, 2844 AddressingMode mode = bdaddr12only> 2845 : InstS<opcode, (outs), (ins mode:$BD2), 2846 mnemonic#"\t$BD2", [(operator mode:$BD2)]>; 2847 2848class LoadAddressRX<string mnemonic, bits<8> opcode, 2849 SDPatternOperator operator, AddressingMode mode> 2850 : InstRXa<opcode, (outs GR64:$R1), (ins mode:$XBD2), 2851 mnemonic#"\t$R1, $XBD2", 2852 [(set GR64:$R1, (operator mode:$XBD2))]>; 2853 2854class LoadAddressRXY<string mnemonic, bits<16> opcode, 2855 SDPatternOperator operator, AddressingMode mode> 2856 : InstRXYa<opcode, (outs GR64:$R1), (ins mode:$XBD2), 2857 mnemonic#"\t$R1, $XBD2", 2858 [(set GR64:$R1, (operator mode:$XBD2))]>; 2859 2860multiclass LoadAddressRXPair<string mnemonic, bits<8> rxOpcode, 2861 bits<16> rxyOpcode, SDPatternOperator operator> { 2862 let DispKey = mnemonic in { 2863 let DispSize = "12" in 2864 def "" : LoadAddressRX<mnemonic, rxOpcode, operator, laaddr12pair>; 2865 let DispSize = "20" in 2866 def Y : LoadAddressRXY<mnemonic#"y", rxyOpcode, operator, laaddr20pair>; 2867 } 2868} 2869 2870class LoadAddressRIL<string mnemonic, bits<12> opcode, 2871 SDPatternOperator operator> 2872 : InstRILb<opcode, (outs GR64:$R1), (ins pcrel32:$RI2), 2873 mnemonic#"\t$R1, $RI2", 2874 [(set GR64:$R1, (operator pcrel32:$RI2))]>; 2875 2876class UnaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2877 RegisterOperand cls1, RegisterOperand cls2> 2878 : InstRR<opcode, (outs cls1:$R1), (ins cls2:$R2), 2879 mnemonic#"\t$R1, $R2", 2880 [(set cls1:$R1, (operator cls2:$R2))]> { 2881 let OpKey = mnemonic#cls1; 2882 let OpType = "reg"; 2883} 2884 2885class UnaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 2886 RegisterOperand cls1, RegisterOperand cls2> 2887 : InstRRE<opcode, (outs cls1:$R1), (ins cls2:$R2), 2888 mnemonic#"\t$R1, $R2", 2889 [(set cls1:$R1, (operator cls2:$R2))]> { 2890 let OpKey = mnemonic#cls1; 2891 let OpType = "reg"; 2892} 2893 2894class UnaryTiedRRE<string mnemonic, bits<16> opcode, RegisterOperand cls> 2895 : InstRRE<opcode, (outs cls:$R1), (ins cls:$R1src), 2896 mnemonic#"\t$R1", []> { 2897 let Constraints = "$R1 = $R1src"; 2898 let DisableEncoding = "$R1src"; 2899 let R2 = 0; 2900} 2901 2902class UnaryMemRRFc<string mnemonic, bits<16> opcode, 2903 RegisterOperand cls1, RegisterOperand cls2> 2904 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src), 2905 mnemonic#"\t$R1, $R2", []> { 2906 let Constraints = "$R1 = $R1src"; 2907 let DisableEncoding = "$R1src"; 2908 let M3 = 0; 2909} 2910 2911class UnaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator, 2912 RegisterOperand cls, ImmOpWithPattern imm> 2913 : InstRIa<opcode, (outs cls:$R1), (ins imm:$I2), 2914 mnemonic#"\t$R1, $I2", 2915 [(set cls:$R1, (operator imm:$I2))]>; 2916 2917class UnaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator, 2918 RegisterOperand cls, ImmOpWithPattern imm> 2919 : InstRILa<opcode, (outs cls:$R1), (ins imm:$I2), 2920 mnemonic#"\t$R1, $I2", 2921 [(set cls:$R1, (operator imm:$I2))]>; 2922 2923class UnaryRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator, 2924 RegisterOperand cls> 2925 : InstRILb<opcode, (outs cls:$R1), (ins pcrel32:$RI2), 2926 mnemonic#"\t$R1, $RI2", 2927 [(set cls:$R1, (operator pcrel32:$RI2))]> { 2928 let mayLoad = 1; 2929 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 2930 // However, BDXs have two extra operands and are therefore 6 units more 2931 // complex. 2932 let AddedComplexity = 7; 2933} 2934 2935class CondUnaryRSY<string mnemonic, bits<16> opcode, 2936 SDPatternOperator operator, RegisterOperand cls, 2937 bits<5> bytes, AddressingMode mode = bdaddr20only> 2938 : InstRSYb<opcode, (outs cls:$R1), 2939 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$M3), 2940 mnemonic#"$M3\t$R1, $BD2", 2941 [(set cls:$R1, 2942 (z_select_ccmask (operator bdaddr20only:$BD2), cls:$R1src, 2943 cond4:$valid, cond4:$M3))]> { 2944 let Constraints = "$R1 = $R1src"; 2945 let DisableEncoding = "$R1src"; 2946 let mayLoad = 1; 2947 let AccessBytes = bytes; 2948 let CCMaskLast = 1; 2949 let OpKey = mnemonic#"r"#cls; 2950 let OpType = "mem"; 2951 let MemKey = mnemonic#cls; 2952 let MemType = "target"; 2953} 2954 2955// Like CondUnaryRSY, but used for the raw assembly form. The condition-code 2956// mask is the third operand rather than being part of the mnemonic. 2957class AsmCondUnaryRSY<string mnemonic, bits<16> opcode, 2958 RegisterOperand cls, bits<5> bytes, 2959 AddressingMode mode = bdaddr20only> 2960 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2, imm32zx4:$M3), 2961 mnemonic#"\t$R1, $BD2, $M3", []> { 2962 let mayLoad = 1; 2963 let AccessBytes = bytes; 2964 let Constraints = "$R1 = $R1src"; 2965 let DisableEncoding = "$R1src"; 2966} 2967 2968// Like CondUnaryRSY, but with a fixed CC mask. 2969class FixedCondUnaryRSY<CondVariant V, string mnemonic, bits<16> opcode, 2970 RegisterOperand cls, bits<5> bytes, 2971 AddressingMode mode = bdaddr20only> 2972 : InstRSYb<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$BD2), 2973 mnemonic#V.suffix#"\t$R1, $BD2", []> { 2974 let Constraints = "$R1 = $R1src"; 2975 let DisableEncoding = "$R1src"; 2976 let mayLoad = 1; 2977 let AccessBytes = bytes; 2978 let isAsmParserOnly = V.alternate; 2979 let AsmVariantName = V.asmvariant; 2980 let M3 = V.ccmask; 2981} 2982 2983multiclass CondUnaryRSYPair<string mnemonic, bits<16> opcode, 2984 SDPatternOperator operator, 2985 RegisterOperand cls, bits<5> bytes, 2986 AddressingMode mode = bdaddr20only> { 2987 let isCodeGenOnly = 1 in 2988 def "" : CondUnaryRSY<mnemonic, opcode, operator, cls, bytes, mode>; 2989 def Asm : AsmCondUnaryRSY<mnemonic, opcode, cls, bytes, mode>; 2990} 2991 2992class UnaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 2993 RegisterOperand cls, bits<5> bytes, 2994 AddressingMode mode = bdxaddr12only> 2995 : InstRXa<opcode, (outs cls:$R1), (ins mode:$XBD2), 2996 mnemonic#"\t$R1, $XBD2", 2997 [(set cls:$R1, (operator mode:$XBD2))]> { 2998 let OpKey = mnemonic#"r"#cls; 2999 let OpType = "mem"; 3000 let mayLoad = 1; 3001 let AccessBytes = bytes; 3002} 3003 3004class UnaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3005 RegisterOperand cls, bits<5> bytes> 3006 : InstRXE<opcode, (outs cls:$R1), (ins bdxaddr12only:$XBD2), 3007 mnemonic#"\t$R1, $XBD2", 3008 [(set cls:$R1, (operator bdxaddr12only:$XBD2))]> { 3009 let OpKey = mnemonic#"r"#cls; 3010 let OpType = "mem"; 3011 let mayLoad = 1; 3012 let AccessBytes = bytes; 3013 let M3 = 0; 3014} 3015 3016class UnaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3017 RegisterOperand cls, bits<5> bytes, 3018 AddressingMode mode = bdxaddr20only> 3019 : InstRXYa<opcode, (outs cls:$R1), (ins mode:$XBD2), 3020 mnemonic#"\t$R1, $XBD2", 3021 [(set cls:$R1, (operator mode:$XBD2))]> { 3022 let OpKey = mnemonic#"r"#cls; 3023 let OpType = "mem"; 3024 let mayLoad = 1; 3025 let AccessBytes = bytes; 3026} 3027 3028multiclass UnaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 3029 SDPatternOperator operator, RegisterOperand cls, 3030 bits<5> bytes> { 3031 let DispKey = mnemonic # cls in { 3032 let DispSize = "12" in 3033 def "" : UnaryRX<mnemonic, rxOpcode, operator, cls, bytes, bdxaddr12pair>; 3034 let DispSize = "20" in 3035 def Y : UnaryRXY<mnemonic#"y", rxyOpcode, operator, cls, bytes, 3036 bdxaddr20pair>; 3037 } 3038} 3039 3040class UnaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3041 TypedReg tr, ImmOpWithPattern imm, bits<4> type = 0> 3042 : InstVRIa<opcode, (outs tr.op:$V1), (ins imm:$I2), 3043 mnemonic#"\t$V1, $I2", 3044 [(set (tr.vt tr.op:$V1), (operator (i32 timm:$I2)))]> { 3045 let M3 = type; 3046} 3047 3048class UnaryVRIaGeneric<string mnemonic, bits<16> opcode, ImmOpWithPattern imm> 3049 : InstVRIa<opcode, (outs VR128:$V1), (ins imm:$I2, imm32zx4:$M3), 3050 mnemonic#"\t$V1, $I2, $M3", []>; 3051 3052class UnaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3053 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0, 3054 bits<4> m5 = 0, string fp_mnemonic = ""> 3055 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2), 3056 mnemonic#"\t$V1, $V2", 3057 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]> { 3058 let M3 = type; 3059 let M4 = m4; 3060 let M5 = m5; 3061 let OpKey = fp_mnemonic#!subst("VR", "FP", !cast<string>(tr1.op)); 3062 let OpType = "reg"; 3063} 3064 3065class UnaryVRRaGeneric<string mnemonic, bits<16> opcode, bits<4> m4 = 0, 3066 bits<4> m5 = 0> 3067 : InstVRRa<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3), 3068 mnemonic#"\t$V1, $V2, $M3", []> { 3069 let M4 = m4; 3070 let M5 = m5; 3071} 3072 3073class UnaryVRRaFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0> 3074 : InstVRRa<opcode, (outs VR128:$V1), 3075 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4), 3076 mnemonic#"\t$V1, $V2, $M3, $M4", []> { 3077 let M5 = m5; 3078} 3079 3080// Declare a pair of instructions, one which sets CC and one which doesn't. 3081// The CC-setting form ends with "S" and sets the low bit of M5. 3082// The form that does not set CC has an extra operand to optionally allow 3083// specifying arbitrary M5 values in assembler. 3084multiclass UnaryExtraVRRaSPair<string mnemonic, bits<16> opcode, 3085 SDPatternOperator operator, 3086 SDPatternOperator operator_cc, 3087 TypedReg tr1, TypedReg tr2, bits<4> type> { 3088 let M3 = type, M4 = 0 in 3089 def "" : InstVRRa<opcode, (outs tr1.op:$V1), 3090 (ins tr2.op:$V2, imm32zx4:$M5), 3091 mnemonic#"\t$V1, $V2, $M5", []>; 3092 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2))), 3093 (!cast<Instruction>(NAME) tr2.op:$V2, 0)>; 3094 def : InstAlias<mnemonic#"\t$V1, $V2", 3095 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 0)>; 3096 let Defs = [CC] in 3097 def S : UnaryVRRa<mnemonic#"s", opcode, operator_cc, tr1, tr2, 3098 type, 0, 1>; 3099} 3100 3101multiclass UnaryExtraVRRaSPairGeneric<string mnemonic, bits<16> opcode> { 3102 let M4 = 0, Defs = [CC] in 3103 def "" : InstVRRa<opcode, (outs VR128:$V1), 3104 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M5), 3105 mnemonic#"\t$V1, $V2, $M3, $M5", []>; 3106 def : InstAlias<mnemonic#"\t$V1, $V2, $M3", 3107 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, 3108 imm32zx4:$M3, 0)>; 3109} 3110 3111class UnaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3112 TypedReg tr, bits<5> bytes, bits<4> type = 0> 3113 : InstVRX<opcode, (outs tr.op:$V1), (ins bdxaddr12only:$XBD2), 3114 mnemonic#"\t$V1, $XBD2", 3115 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2))]> { 3116 let M3 = type; 3117 let mayLoad = 1; 3118 let AccessBytes = bytes; 3119} 3120 3121class UnaryVRXGeneric<string mnemonic, bits<16> opcode> 3122 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3), 3123 mnemonic#"\t$V1, $XBD2, $M3", []> { 3124 let mayLoad = 1; 3125} 3126 3127multiclass UnaryVRXAlign<string mnemonic, bits<16> opcode> { 3128 let mayLoad = 1, AccessBytes = 16 in { 3129 def Align : InstVRX<opcode, (outs VR128:$V1), 3130 (ins bdxaddr12only:$XBD2, imm32zx4:$M3), 3131 mnemonic#"\t$V1, $XBD2, $M3", []>; 3132 let M3 = 0 in 3133 def "" : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2), 3134 mnemonic#"\t$V1, $XBD2", []>; 3135 } 3136} 3137 3138class SideEffectBinaryRX<string mnemonic, bits<8> opcode, 3139 RegisterOperand cls> 3140 : InstRXa<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2), 3141 mnemonic#"\t$R1, $XBD2", []>; 3142 3143class SideEffectBinaryRXY<string mnemonic, bits<16> opcode, 3144 RegisterOperand cls> 3145 : InstRXYa<opcode, (outs), (ins cls:$R1, bdxaddr20only:$XBD2), 3146 mnemonic#"\t$R1, $XBD2", []>; 3147 3148class SideEffectBinaryRILPC<string mnemonic, bits<12> opcode, 3149 RegisterOperand cls> 3150 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2), 3151 mnemonic#"\t$R1, $RI2", []> { 3152 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 3153 // However, BDXs have two extra operands and are therefore 6 units more 3154 // complex. 3155 let AddedComplexity = 7; 3156} 3157 3158class SideEffectBinaryRRE<string mnemonic, bits<16> opcode, 3159 RegisterOperand cls1, RegisterOperand cls2> 3160 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2), 3161 mnemonic#"\t$R1, $R2", []>; 3162 3163class SideEffectBinaryRRFa<string mnemonic, bits<16> opcode, 3164 RegisterOperand cls1, RegisterOperand cls2> 3165 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2), 3166 mnemonic#"\t$R1, $R2", []> { 3167 let R3 = 0; 3168 let M4 = 0; 3169} 3170 3171class SideEffectBinaryRRFc<string mnemonic, bits<16> opcode, 3172 RegisterOperand cls1, RegisterOperand cls2> 3173 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2), 3174 mnemonic#"\t$R1, $R2", []> { 3175 let M3 = 0; 3176} 3177 3178class SideEffectBinaryIE<string mnemonic, bits<16> opcode, 3179 ImmOpWithPattern imm1, ImmOpWithPattern imm2> 3180 : InstIE<opcode, (outs), (ins imm1:$I1, imm2:$I2), 3181 mnemonic#"\t$I1, $I2", []>; 3182 3183class SideEffectBinarySI<string mnemonic, bits<8> opcode, Operand imm> 3184 : InstSI<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2), 3185 mnemonic#"\t$BD1, $I2", []>; 3186 3187class SideEffectBinarySIL<string mnemonic, bits<16> opcode, 3188 SDPatternOperator operator, ImmOpWithPattern imm> 3189 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2), 3190 mnemonic#"\t$BD1, $I2", [(operator bdaddr12only:$BD1, imm:$I2)]>; 3191 3192class SideEffectBinarySSa<string mnemonic, bits<8> opcode> 3193 : InstSSa<opcode, (outs), (ins bdladdr12onlylen8:$BDL1, bdaddr12only:$BD2), 3194 mnemonic#"\t$BDL1, $BD2", []>; 3195 3196class SideEffectBinarySSb<string mnemonic, bits<8> opcode> 3197 : InstSSb<opcode, 3198 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2), 3199 mnemonic#"\t$BDL1, $BDL2", []>; 3200 3201class SideEffectBinarySSf<string mnemonic, bits<8> opcode> 3202 : InstSSf<opcode, (outs), (ins bdaddr12only:$BD1, bdladdr12onlylen8:$BDL2), 3203 mnemonic#"\t$BD1, $BDL2", []>; 3204 3205class SideEffectBinarySSE<string mnemonic, bits<16> opcode> 3206 : InstSSE<opcode, (outs), (ins bdaddr12only:$BD1, bdaddr12only:$BD2), 3207 mnemonic#"\t$BD1, $BD2", []>; 3208 3209class SideEffectBinaryMemMemRR<string mnemonic, bits<8> opcode, 3210 RegisterOperand cls1, RegisterOperand cls2> 3211 : InstRR<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src), 3212 mnemonic#"\t$R1, $R2", []> { 3213 let Constraints = "$R1 = $R1src, $R2 = $R2src"; 3214 let DisableEncoding = "$R1src, $R2src"; 3215} 3216 3217class SideEffectBinaryMemRRE<string mnemonic, bits<16> opcode, 3218 RegisterOperand cls1, RegisterOperand cls2> 3219 : InstRRE<opcode, (outs cls2:$R2), (ins cls1:$R1, cls2:$R2src), 3220 mnemonic#"\t$R1, $R2", []> { 3221 let Constraints = "$R2 = $R2src"; 3222 let DisableEncoding = "$R2src"; 3223} 3224 3225class SideEffectBinaryMemMemRRE<string mnemonic, bits<16> opcode, 3226 RegisterOperand cls1, RegisterOperand cls2> 3227 : InstRRE<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src), 3228 mnemonic#"\t$R1, $R2", []> { 3229 let Constraints = "$R1 = $R1src, $R2 = $R2src"; 3230 let DisableEncoding = "$R1src, $R2src"; 3231} 3232 3233class SideEffectBinaryMemMemRRFc<string mnemonic, bits<16> opcode, 3234 RegisterOperand cls1, RegisterOperand cls2> 3235 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2), (ins cls1:$R1src, cls2:$R2src), 3236 mnemonic#"\t$R1, $R2", []> { 3237 let Constraints = "$R1 = $R1src, $R2 = $R2src"; 3238 let DisableEncoding = "$R1src, $R2src"; 3239 let M3 = 0; 3240} 3241 3242class BinaryRR<string mnemonic, bits<8> opcode, SDPatternOperator operator, 3243 RegisterOperand cls1, RegisterOperand cls2> 3244 : InstRR<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2), 3245 mnemonic#"\t$R1, $R2", 3246 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> { 3247 let OpKey = mnemonic#cls1; 3248 let OpType = "reg"; 3249 let Constraints = "$R1 = $R1src"; 3250 let DisableEncoding = "$R1src"; 3251} 3252 3253class BinaryRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3254 RegisterOperand cls1, RegisterOperand cls2> 3255 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2), 3256 mnemonic#"\t$R1, $R2", 3257 [(set cls1:$R1, (operator cls1:$R1src, cls2:$R2))]> { 3258 let OpKey = mnemonic#cls1; 3259 let OpType = "reg"; 3260 let Constraints = "$R1 = $R1src"; 3261 let DisableEncoding = "$R1src"; 3262} 3263 3264class BinaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3265 RegisterOperand cls1, RegisterOperand cls2> 3266 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R3, cls2:$R2), 3267 mnemonic#"\t$R1, $R3, $R2", 3268 [(set cls1:$R1, (operator cls2:$R3, cls2:$R2))]> { 3269 let OpKey = mnemonic#cls; 3270 let OpType = "reg"; 3271} 3272 3273class BinaryRRFa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3274 RegisterOperand cls1, RegisterOperand cls2, 3275 RegisterOperand cls3> 3276 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3), 3277 mnemonic#"\t$R1, $R2, $R3", 3278 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> { 3279 let M4 = 0; 3280 let OpKey = mnemonic#cls1; 3281 let OpType = "reg"; 3282} 3283 3284multiclass BinaryRRAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2, 3285 SDPatternOperator operator, RegisterOperand cls1, 3286 RegisterOperand cls2> { 3287 let NumOpsKey = mnemonic in { 3288 let NumOpsValue = "3" in 3289 def K : BinaryRRFa<mnemonic#"k", opcode2, operator, cls1, cls1, cls2>, 3290 Requires<[FeatureDistinctOps]>; 3291 let NumOpsValue = "2" in 3292 def "" : BinaryRR<mnemonic, opcode1, operator, cls1, cls2>; 3293 } 3294} 3295 3296multiclass BinaryRREAndK<string mnemonic, bits<16> opcode1, bits<16> opcode2, 3297 SDPatternOperator operator, RegisterOperand cls1, 3298 RegisterOperand cls2> { 3299 let NumOpsKey = mnemonic in { 3300 let NumOpsValue = "3" in 3301 def K : BinaryRRFa<mnemonic#"k", opcode2, operator, cls1, cls1, cls2>, 3302 Requires<[FeatureDistinctOps]>; 3303 let NumOpsValue = "2" in 3304 def "" : BinaryRRE<mnemonic, opcode1, operator, cls1, cls2>; 3305 } 3306} 3307 3308class BinaryRRFb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3309 RegisterOperand cls1, RegisterOperand cls2, 3310 RegisterOperand cls3> 3311 : InstRRFb<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3), 3312 mnemonic#"\t$R1, $R3, $R2", 3313 [(set cls1:$R1, (operator cls2:$R2, cls3:$R3))]> { 3314 let M4 = 0; 3315} 3316 3317class BinaryRRFc<string mnemonic, bits<16> opcode, 3318 RegisterOperand cls1, RegisterOperand cls2> 3319 : InstRRFc<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M3), 3320 mnemonic#"\t$R1, $R2, $M3", []>; 3321 3322class BinaryMemRRFc<string mnemonic, bits<16> opcode, 3323 RegisterOperand cls1, RegisterOperand cls2, ImmOpWithPattern imm> 3324 : InstRRFc<opcode, (outs cls2:$R2, cls1:$R1), (ins cls1:$R1src, imm:$M3), 3325 mnemonic#"\t$R1, $R2, $M3", []> { 3326 let Constraints = "$R1 = $R1src"; 3327 let DisableEncoding = "$R1src"; 3328} 3329 3330multiclass BinaryMemRRFcOpt<string mnemonic, bits<16> opcode, 3331 RegisterOperand cls1, RegisterOperand cls2> { 3332 def "" : BinaryMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>; 3333 def Opt : UnaryMemRRFc<mnemonic, opcode, cls1, cls2>; 3334} 3335 3336class BinaryRRFd<string mnemonic, bits<16> opcode, RegisterOperand cls1, 3337 RegisterOperand cls2> 3338 : InstRRFd<opcode, (outs cls1:$R1), (ins cls2:$R2, imm32zx4:$M4), 3339 mnemonic#"\t$R1, $R2, $M4", []>; 3340 3341class BinaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1, 3342 RegisterOperand cls2> 3343 : InstRRFe<opcode, (outs cls1:$R1), (ins imm32zx4:$M3, cls2:$R2), 3344 mnemonic#"\t$R1, $M3, $R2", []> { 3345 let M4 = 0; 3346} 3347 3348class CondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 3349 RegisterOperand cls2> 3350 : InstRRFc<opcode, (outs cls1:$R1), 3351 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3), 3352 mnemonic#"$M3\t$R1, $R2", 3353 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src, 3354 cond4:$valid, cond4:$M3))]> { 3355 let Constraints = "$R1 = $R1src"; 3356 let DisableEncoding = "$R1src"; 3357 let CCMaskLast = 1; 3358 let NumOpsKey = !subst("loc", "sel", mnemonic); 3359 let NumOpsValue = "2"; 3360 let OpKey = mnemonic#cls1; 3361 let OpType = "reg"; 3362} 3363 3364// Like CondBinaryRRF, but used for the raw assembly form. The condition-code 3365// mask is the third operand rather than being part of the mnemonic. 3366class AsmCondBinaryRRF<string mnemonic, bits<16> opcode, RegisterOperand cls1, 3367 RegisterOperand cls2> 3368 : InstRRFc<opcode, (outs cls1:$R1), 3369 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M3), 3370 mnemonic#"\t$R1, $R2, $M3", []> { 3371 let Constraints = "$R1 = $R1src"; 3372 let DisableEncoding = "$R1src"; 3373} 3374 3375// Like CondBinaryRRF, but with a fixed CC mask. 3376class FixedCondBinaryRRF<CondVariant V, string mnemonic, bits<16> opcode, 3377 RegisterOperand cls1, RegisterOperand cls2> 3378 : InstRRFc<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2), 3379 mnemonic#V.suffix#"\t$R1, $R2", []> { 3380 let Constraints = "$R1 = $R1src"; 3381 let DisableEncoding = "$R1src"; 3382 let isAsmParserOnly = V.alternate; 3383 let AsmVariantName = V.asmvariant; 3384 let M3 = V.ccmask; 3385} 3386 3387multiclass CondBinaryRRFPair<string mnemonic, bits<16> opcode, 3388 RegisterOperand cls1, RegisterOperand cls2> { 3389 let isCodeGenOnly = 1 in 3390 def "" : CondBinaryRRF<mnemonic, opcode, cls1, cls2>; 3391 def Asm : AsmCondBinaryRRF<mnemonic, opcode, cls1, cls2>; 3392} 3393 3394class CondBinaryRRFa<string mnemonic, bits<16> opcode, RegisterOperand cls1, 3395 RegisterOperand cls2, RegisterOperand cls3> 3396 : InstRRFa<opcode, (outs cls1:$R1), 3397 (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4), 3398 mnemonic#"$M4\t$R1, $R2, $R3", 3399 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3, 3400 cond4:$valid, cond4:$M4))]> { 3401 let CCMaskLast = 1; 3402 let NumOpsKey = mnemonic; 3403 let NumOpsValue = "3"; 3404 let OpKey = mnemonic#cls1; 3405 let OpType = "reg"; 3406} 3407 3408// Like CondBinaryRRFa, but used for the raw assembly form. The condition-code 3409// mask is the third operand rather than being part of the mnemonic. 3410class AsmCondBinaryRRFa<string mnemonic, bits<16> opcode, RegisterOperand cls1, 3411 RegisterOperand cls2, RegisterOperand cls3> 3412 : InstRRFa<opcode, (outs cls1:$R1), (ins cls3:$R3, cls2:$R2, imm32zx4:$M4), 3413 mnemonic#"\t$R1, $R2, $R3, $M4", []>; 3414 3415// Like CondBinaryRRFa, but with a fixed CC mask. 3416class FixedCondBinaryRRFa<CondVariant V, string mnemonic, bits<16> opcode, 3417 RegisterOperand cls1, RegisterOperand cls2, 3418 RegisterOperand cls3> 3419 : InstRRFa<opcode, (outs cls1:$R1), (ins cls3:$R3, cls2:$R2), 3420 mnemonic#V.suffix#"\t$R1, $R2, $R3", []> { 3421 let isAsmParserOnly = V.alternate; 3422 let AsmVariantName = V.asmvariant; 3423 let M4 = V.ccmask; 3424} 3425 3426multiclass CondBinaryRRFaPair<string mnemonic, bits<16> opcode, 3427 RegisterOperand cls1, RegisterOperand cls2, 3428 RegisterOperand cls3> { 3429 let isCodeGenOnly = 1 in 3430 def "" : CondBinaryRRFa<mnemonic, opcode, cls1, cls2, cls3>; 3431 def Asm : AsmCondBinaryRRFa<mnemonic, opcode, cls1, cls2, cls3>; 3432} 3433 3434class BinaryRI<string mnemonic, bits<12> opcode, SDPatternOperator operator, 3435 RegisterOperand cls, ImmOpWithPattern imm> 3436 : InstRIa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 3437 mnemonic#"\t$R1, $I2", 3438 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 3439 let Constraints = "$R1 = $R1src"; 3440 let DisableEncoding = "$R1src"; 3441} 3442 3443class BinaryRIE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3444 RegisterOperand cls, ImmOpWithPattern imm> 3445 : InstRIEd<opcode, (outs cls:$R1), (ins cls:$R3, imm:$I2), 3446 mnemonic#"\t$R1, $R3, $I2", 3447 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>; 3448 3449multiclass BinaryRIAndK<string mnemonic, bits<12> opcode1, bits<16> opcode2, 3450 SDPatternOperator operator, RegisterOperand cls, 3451 ImmOpWithPattern imm> { 3452 let NumOpsKey = mnemonic in { 3453 let NumOpsValue = "3" in 3454 def K : BinaryRIE<mnemonic#"k", opcode2, operator, cls, imm>, 3455 Requires<[FeatureDistinctOps]>; 3456 let NumOpsValue = "2" in 3457 def "" : BinaryRI<mnemonic, opcode1, operator, cls, imm>; 3458 } 3459} 3460 3461class CondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls, 3462 ImmOpWithPattern imm> 3463 : InstRIEg<opcode, (outs cls:$R1), 3464 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3), 3465 mnemonic#"$M3\t$R1, $I2", 3466 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src, 3467 cond4:$valid, cond4:$M3))]> { 3468 let Constraints = "$R1 = $R1src"; 3469 let DisableEncoding = "$R1src"; 3470 let CCMaskLast = 1; 3471} 3472 3473// Like CondBinaryRIE, but used for the raw assembly form. The condition-code 3474// mask is the third operand rather than being part of the mnemonic. 3475class AsmCondBinaryRIE<string mnemonic, bits<16> opcode, RegisterOperand cls, 3476 ImmOpWithPattern imm> 3477 : InstRIEg<opcode, (outs cls:$R1), 3478 (ins cls:$R1src, imm:$I2, imm32zx4:$M3), 3479 mnemonic#"\t$R1, $I2, $M3", []> { 3480 let Constraints = "$R1 = $R1src"; 3481 let DisableEncoding = "$R1src"; 3482} 3483 3484// Like CondBinaryRIE, but with a fixed CC mask. 3485class FixedCondBinaryRIE<CondVariant V, string mnemonic, bits<16> opcode, 3486 RegisterOperand cls, ImmOpWithPattern imm> 3487 : InstRIEg<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 3488 mnemonic#V.suffix#"\t$R1, $I2", []> { 3489 let Constraints = "$R1 = $R1src"; 3490 let DisableEncoding = "$R1src"; 3491 let isAsmParserOnly = V.alternate; 3492 let AsmVariantName = V.asmvariant; 3493 let M3 = V.ccmask; 3494} 3495 3496multiclass CondBinaryRIEPair<string mnemonic, bits<16> opcode, 3497 RegisterOperand cls, ImmOpWithPattern imm> { 3498 let isCodeGenOnly = 1 in 3499 def "" : CondBinaryRIE<mnemonic, opcode, cls, imm>; 3500 def Asm : AsmCondBinaryRIE<mnemonic, opcode, cls, imm>; 3501} 3502 3503class BinaryRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator, 3504 RegisterOperand cls, ImmOpWithPattern imm> 3505 : InstRILa<opcode, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 3506 mnemonic#"\t$R1, $I2", 3507 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 3508 let Constraints = "$R1 = $R1src"; 3509 let DisableEncoding = "$R1src"; 3510} 3511 3512class BinaryRS<string mnemonic, bits<8> opcode, SDPatternOperator operator, 3513 RegisterOperand cls> 3514 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, shift12only:$BD2), 3515 mnemonic#"\t$R1, $BD2", 3516 [(set cls:$R1, (operator cls:$R1src, shift12only:$BD2))]> { 3517 let R3 = 0; 3518 let Constraints = "$R1 = $R1src"; 3519 let DisableEncoding = "$R1src"; 3520} 3521 3522class BinaryRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3523 RegisterOperand cls> 3524 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, shift20only:$BD2), 3525 mnemonic#"\t$R1, $R3, $BD2", 3526 [(set cls:$R1, (operator cls:$R3, shift20only:$BD2))]>; 3527 3528multiclass BinaryRSAndK<string mnemonic, bits<8> opcode1, bits<16> opcode2, 3529 SDPatternOperator operator, RegisterOperand cls> { 3530 let NumOpsKey = mnemonic in { 3531 let NumOpsValue = "3" in 3532 def K : BinaryRSY<mnemonic#"k", opcode2, operator, cls>, 3533 Requires<[FeatureDistinctOps]>; 3534 let NumOpsValue = "2" in 3535 def "" : BinaryRS<mnemonic, opcode1, operator, cls>; 3536 } 3537} 3538 3539class BinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls> 3540 : InstRSLb<opcode, (outs cls:$R1), 3541 (ins bdladdr12onlylen8:$BDL2, imm32zx4:$M3), 3542 mnemonic#"\t$R1, $BDL2, $M3", []> { 3543 let mayLoad = 1; 3544} 3545 3546class BinaryRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 3547 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 3548 AddressingMode mode = bdxaddr12only> 3549 : InstRXa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2), 3550 mnemonic#"\t$R1, $XBD2", 3551 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> { 3552 let OpKey = mnemonic#"r"#cls; 3553 let OpType = "mem"; 3554 let Constraints = "$R1 = $R1src"; 3555 let DisableEncoding = "$R1src"; 3556 let mayLoad = 1; 3557 let AccessBytes = bytes; 3558} 3559 3560class BinaryRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3561 RegisterOperand cls, SDPatternOperator load, bits<5> bytes> 3562 : InstRXE<opcode, (outs cls:$R1), (ins cls:$R1src, bdxaddr12only:$XBD2), 3563 mnemonic#"\t$R1, $XBD2", 3564 [(set cls:$R1, (operator cls:$R1src, 3565 (load bdxaddr12only:$XBD2)))]> { 3566 let OpKey = mnemonic#"r"#cls; 3567 let OpType = "mem"; 3568 let Constraints = "$R1 = $R1src"; 3569 let DisableEncoding = "$R1src"; 3570 let mayLoad = 1; 3571 let AccessBytes = bytes; 3572 let M3 = 0; 3573} 3574 3575class BinaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3576 RegisterOperand cls1, RegisterOperand cls2, 3577 SDPatternOperator load, bits<5> bytes> 3578 : InstRXF<opcode, (outs cls1:$R1), (ins cls2:$R3, bdxaddr12only:$XBD2), 3579 mnemonic#"\t$R1, $R3, $XBD2", 3580 [(set cls1:$R1, (operator cls2:$R3, (load bdxaddr12only:$XBD2)))]> { 3581 let OpKey = mnemonic#"r"#cls; 3582 let OpType = "mem"; 3583 let mayLoad = 1; 3584 let AccessBytes = bytes; 3585} 3586 3587class BinaryRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3588 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 3589 AddressingMode mode = bdxaddr20only> 3590 : InstRXYa<opcode, (outs cls:$R1), (ins cls:$R1src, mode:$XBD2), 3591 mnemonic#"\t$R1, $XBD2", 3592 [(set cls:$R1, (operator cls:$R1src, (load mode:$XBD2)))]> { 3593 let OpKey = mnemonic#"r"#cls; 3594 let OpType = "mem"; 3595 let Constraints = "$R1 = $R1src"; 3596 let DisableEncoding = "$R1src"; 3597 let mayLoad = 1; 3598 let AccessBytes = bytes; 3599} 3600 3601multiclass BinaryRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 3602 SDPatternOperator operator, RegisterOperand cls, 3603 SDPatternOperator load, bits<5> bytes> { 3604 let DispKey = mnemonic # cls in { 3605 let DispSize = "12" in 3606 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes, 3607 bdxaddr12pair>; 3608 let DispSize = "20" in 3609 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load, bytes, 3610 bdxaddr20pair>; 3611 } 3612} 3613 3614class BinarySI<string mnemonic, bits<8> opcode, SDPatternOperator operator, 3615 Operand imm, AddressingMode mode = bdaddr12only> 3616 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2), 3617 mnemonic#"\t$BD1, $I2", 3618 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> { 3619 let mayLoad = 1; 3620 let mayStore = 1; 3621} 3622 3623class BinarySIY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3624 Operand imm, AddressingMode mode = bdaddr20only> 3625 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2), 3626 mnemonic#"\t$BD1, $I2", 3627 [(store (operator (load mode:$BD1), imm:$I2), mode:$BD1)]> { 3628 let mayLoad = 1; 3629 let mayStore = 1; 3630} 3631 3632multiclass BinarySIPair<string mnemonic, bits<8> siOpcode, 3633 bits<16> siyOpcode, SDPatternOperator operator, 3634 Operand imm> { 3635 let DispKey = mnemonic # cls in { 3636 let DispSize = "12" in 3637 def "" : BinarySI<mnemonic, siOpcode, operator, imm, bdaddr12pair>; 3638 let DispSize = "20" in 3639 def Y : BinarySIY<mnemonic#"y", siyOpcode, operator, imm, bdaddr20pair>; 3640 } 3641} 3642 3643class BinarySSF<string mnemonic, bits<12> opcode, RegisterOperand cls> 3644 : InstSSF<opcode, (outs cls:$R3), (ins bdaddr12pair:$BD1, bdaddr12pair:$BD2), 3645 mnemonic#"\t$R3, $BD1, $BD2", []> { 3646 let mayLoad = 1; 3647} 3648 3649class BinaryVRIb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3650 TypedReg tr, bits<4> type> 3651 : InstVRIb<opcode, (outs tr.op:$V1), (ins imm32zx8:$I2, imm32zx8:$I3), 3652 mnemonic#"\t$V1, $I2, $I3", 3653 [(set (tr.vt tr.op:$V1), (operator imm32zx8_timm:$I2, imm32zx8_timm:$I3))]> { 3654 let M4 = type; 3655} 3656 3657class BinaryVRIbGeneric<string mnemonic, bits<16> opcode> 3658 : InstVRIb<opcode, (outs VR128:$V1), 3659 (ins imm32zx8:$I2, imm32zx8:$I3, imm32zx4:$M4), 3660 mnemonic#"\t$V1, $I2, $I3, $M4", []>; 3661 3662class BinaryVRIc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3663 TypedReg tr1, TypedReg tr2, bits<4> type> 3664 : InstVRIc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, imm32zx16:$I2), 3665 mnemonic#"\t$V1, $V3, $I2", 3666 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3), 3667 imm32zx16_timm:$I2))]> { 3668 let M4 = type; 3669} 3670 3671class BinaryVRIcGeneric<string mnemonic, bits<16> opcode> 3672 : InstVRIc<opcode, (outs VR128:$V1), 3673 (ins VR128:$V3, imm32zx16:$I2, imm32zx4:$M4), 3674 mnemonic#"\t$V1, $V3, $I2, $M4", []>; 3675 3676class BinaryVRIe<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3677 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m5> 3678 : InstVRIe<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx12:$I3), 3679 mnemonic#"\t$V1, $V2, $I3", 3680 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 3681 imm32zx12_timm:$I3))]> { 3682 let M4 = type; 3683 let M5 = m5; 3684} 3685 3686class BinaryVRIeFloatGeneric<string mnemonic, bits<16> opcode> 3687 : InstVRIe<opcode, (outs VR128:$V1), 3688 (ins VR128:$V2, imm32zx12:$I3, imm32zx4:$M4, imm32zx4:$M5), 3689 mnemonic#"\t$V1, $V2, $I3, $M4, $M5", []>; 3690 3691class BinaryVRIh<string mnemonic, bits<16> opcode> 3692 : InstVRIh<opcode, (outs VR128:$V1), 3693 (ins imm32zx16:$I2, imm32zx4:$I3), 3694 mnemonic#"\t$V1, $I2, $I3", []>; 3695 3696class BinaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3697 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m4 = 0> 3698 : InstVRRa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, imm32zx4:$M5), 3699 mnemonic#"\t$V1, $V2, $M5", 3700 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 3701 imm32zx12:$M5))]> { 3702 let M3 = type; 3703 let M4 = m4; 3704} 3705 3706class BinaryVRRaFloatGeneric<string mnemonic, bits<16> opcode> 3707 : InstVRRa<opcode, (outs VR128:$V1), 3708 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5), 3709 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>; 3710 3711class BinaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3712 TypedReg tr1, TypedReg tr2, bits<4> type = 0, 3713 bits<4> modifier = 0> 3714 : InstVRRb<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3), 3715 mnemonic#"\t$V1, $V2, $V3", 3716 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 3717 (tr2.vt tr2.op:$V3)))]> { 3718 let M4 = type; 3719 let M5 = modifier; 3720} 3721 3722class BinaryExtraVRRb<string mnemonic, bits<16> opcode, bits<4> type = 0> 3723 : InstVRRb<opcode, (outs VR128:$V1), (ins VR128:$V2, VR128:$V3, imm32zx4:$M5), 3724 mnemonic#"\t$V1, $V2, $V3, $M5", []> { 3725 let M4 = type; 3726} 3727 3728class BinaryExtraVRRbGeneric<string mnemonic, bits<16> opcode> 3729 : InstVRRb<opcode, (outs VR128:$V1), 3730 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5), 3731 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>; 3732 3733// Declare a pair of instructions, one which sets CC and one which doesn't. 3734// The CC-setting form ends with "S" and sets the low bit of M5. 3735multiclass BinaryVRRbSPair<string mnemonic, bits<16> opcode, 3736 SDPatternOperator operator, 3737 SDPatternOperator operator_cc, TypedReg tr1, 3738 TypedReg tr2, bits<4> type, bits<4> modifier = 0> { 3739 def "" : BinaryVRRb<mnemonic, opcode, operator, tr1, tr2, type, 3740 !and (modifier, 14)>; 3741 let Defs = [CC] in 3742 def S : BinaryVRRb<mnemonic#"s", opcode, operator_cc, tr1, tr2, type, 3743 !add (!and (modifier, 14), 1)>; 3744} 3745 3746class BinaryVRRbSPairGeneric<string mnemonic, bits<16> opcode> 3747 : InstVRRb<opcode, (outs VR128:$V1), 3748 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5), 3749 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> { 3750 let Defs = [CC]; 3751} 3752 3753// Declare a pair of instructions, one which sets CC and one which doesn't. 3754// The CC-setting form ends with "S" and sets the low bit of M5. 3755// The form that does not set CC has an extra operand to optionally allow 3756// specifying arbitrary M5 values in assembler. 3757multiclass BinaryExtraVRRbSPair<string mnemonic, bits<16> opcode, 3758 SDPatternOperator operator, 3759 SDPatternOperator operator_cc, 3760 TypedReg tr1, TypedReg tr2, bits<4> type> { 3761 let M4 = type in 3762 def "" : InstVRRb<opcode, (outs tr1.op:$V1), 3763 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M5), 3764 mnemonic#"\t$V1, $V2, $V3, $M5", []>; 3765 def : Pat<(tr1.vt (operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3))), 3766 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, 0)>; 3767 def : InstAlias<mnemonic#"\t$V1, $V2, $V3", 3768 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 3769 tr2.op:$V3, 0)>; 3770 let Defs = [CC] in 3771 def S : BinaryVRRb<mnemonic#"s", opcode, operator_cc, tr1, tr2, type, 1>; 3772} 3773 3774multiclass BinaryExtraVRRbSPairGeneric<string mnemonic, bits<16> opcode> { 3775 let Defs = [CC] in 3776 def "" : InstVRRb<opcode, (outs VR128:$V1), 3777 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5), 3778 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>; 3779 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4", 3780 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3, 3781 imm32zx4:$M4, 0)>; 3782} 3783 3784class BinaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3785 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m5 = 0, 3786 bits<4> m6 = 0, string fp_mnemonic = ""> 3787 : InstVRRc<opcode, (outs tr1.op:$V1), (ins tr2.op:$V2, tr2.op:$V3), 3788 mnemonic#"\t$V1, $V2, $V3", 3789 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 3790 (tr2.vt tr2.op:$V3)))]> { 3791 let M4 = type; 3792 let M5 = m5; 3793 let M6 = m6; 3794 let OpKey = fp_mnemonic#"MemFold"#!subst("VR", "FP", !cast<string>(tr1.op)); 3795 let OpType = "reg"; 3796} 3797 3798class BinaryVRRcGeneric<string mnemonic, bits<16> opcode, bits<4> m5 = 0, 3799 bits<4> m6 = 0> 3800 : InstVRRc<opcode, (outs VR128:$V1), 3801 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4), 3802 mnemonic#"\t$V1, $V2, $V3, $M4", []> { 3803 let M5 = m5; 3804 let M6 = m6; 3805} 3806 3807class BinaryVRRcFloatGeneric<string mnemonic, bits<16> opcode, bits<4> m6 = 0> 3808 : InstVRRc<opcode, (outs VR128:$V1), 3809 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5), 3810 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []> { 3811 let M6 = m6; 3812} 3813 3814// Declare a pair of instructions, one which sets CC and one which doesn't. 3815// The CC-setting form ends with "S" and sets the low bit of M5. 3816multiclass BinaryVRRcSPair<string mnemonic, bits<16> opcode, 3817 SDPatternOperator operator, 3818 SDPatternOperator operator_cc, TypedReg tr1, 3819 TypedReg tr2, bits<4> type, bits<4> m5, 3820 bits<4> modifier = 0> { 3821 def "" : BinaryVRRc<mnemonic, opcode, operator, tr1, tr2, type, 3822 m5, !and (modifier, 14)>; 3823 let Defs = [CC] in 3824 def S : BinaryVRRc<mnemonic#"s", opcode, operator_cc, tr1, tr2, type, 3825 m5, !add (!and (modifier, 14), 1)>; 3826} 3827 3828class BinaryVRRcSPairFloatGeneric<string mnemonic, bits<16> opcode> 3829 : InstVRRc<opcode, (outs VR128:$V1), 3830 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5, 3831 imm32zx4:$M6), 3832 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>; 3833 3834class BinaryVRRf<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3835 TypedReg tr> 3836 : InstVRRf<opcode, (outs tr.op:$V1), (ins GR64:$R2, GR64:$R3), 3837 mnemonic#"\t$V1, $R2, $R3", 3838 [(set (tr.vt tr.op:$V1), (operator GR64:$R2, GR64:$R3))]>; 3839 3840class BinaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls> 3841 : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2, imm32zx4:$M3), 3842 mnemonic#"\t$R1, $V2, $M3", []> { 3843 let M4 = 0; 3844} 3845 3846class BinaryVRRk<string mnemonic, bits<16> opcode> 3847 : InstVRRk<opcode, (outs VR128:$V1), (ins VR128:$V2, imm32zx4:$M3), 3848 mnemonic#"\t$V1, $V2, $M3", []>; 3849 3850class BinaryVRSa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3851 TypedReg tr1, TypedReg tr2, bits<4> type> 3852 : InstVRSa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V3, shift12only:$BD2), 3853 mnemonic#"\t$V1, $V3, $BD2", 3854 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V3), 3855 shift12only:$BD2))]> { 3856 let M4 = type; 3857} 3858 3859class BinaryVRSaGeneric<string mnemonic, bits<16> opcode> 3860 : InstVRSa<opcode, (outs VR128:$V1), 3861 (ins VR128:$V3, shift12only:$BD2, imm32zx4:$M4), 3862 mnemonic#"\t$V1, $V3, $BD2, $M4", []>; 3863 3864class BinaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3865 bits<5> bytes> 3866 : InstVRSb<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2), 3867 mnemonic#"\t$V1, $R3, $BD2", 3868 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> { 3869 let M4 = 0; 3870 let mayLoad = 1; 3871 let AccessBytes = bytes; 3872} 3873 3874class BinaryVRSc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3875 TypedReg tr, bits<4> type> 3876 : InstVRSc<opcode, (outs GR64:$R1), (ins tr.op:$V3, shift12only:$BD2), 3877 mnemonic#"\t$R1, $V3, $BD2", 3878 [(set GR64:$R1, (operator (tr.vt tr.op:$V3), shift12only:$BD2))]> { 3879 let M4 = type; 3880} 3881 3882class BinaryVRScGeneric<string mnemonic, bits<16> opcode> 3883 : InstVRSc<opcode, (outs GR64:$R1), 3884 (ins VR128:$V3, shift12only:$BD2, imm32zx4: $M4), 3885 mnemonic#"\t$R1, $V3, $BD2, $M4", []>; 3886 3887class BinaryVRSd<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3888 bits<5> bytes> 3889 : InstVRSd<opcode, (outs VR128:$V1), (ins GR32:$R3, bdaddr12only:$BD2), 3890 mnemonic#"\t$V1, $R3, $BD2", 3891 [(set VR128:$V1, (operator GR32:$R3, bdaddr12only:$BD2))]> { 3892 let mayLoad = 1; 3893 let AccessBytes = bytes; 3894} 3895 3896class BinaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3897 TypedReg tr, bits<5> bytes> 3898 : InstVRX<opcode, (outs VR128:$V1), (ins bdxaddr12only:$XBD2, imm32zx4:$M3), 3899 mnemonic#"\t$V1, $XBD2, $M3", 3900 [(set (tr.vt tr.op:$V1), (operator bdxaddr12only:$XBD2, 3901 imm32zx4_timm:$M3))]> { 3902 let mayLoad = 1; 3903 let AccessBytes = bytes; 3904} 3905 3906class StoreBinaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls, 3907 bits<5> bytes, AddressingMode mode = bdaddr12only> 3908 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2), 3909 mnemonic#"\t$R1, $M3, $BD2", []> { 3910 let mayStore = 1; 3911 let AccessBytes = bytes; 3912} 3913 3914class StoreBinaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls, 3915 bits<5> bytes, AddressingMode mode = bdaddr20only> 3916 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2), 3917 mnemonic#"\t$R1, $M3, $BD2", []> { 3918 let mayStore = 1; 3919 let AccessBytes = bytes; 3920} 3921 3922multiclass StoreBinaryRSPair<string mnemonic, bits<8> rsOpcode, 3923 bits<16> rsyOpcode, RegisterOperand cls, 3924 bits<5> bytes> { 3925 let DispKey = mnemonic # cls in { 3926 let DispSize = "12" in 3927 def "" : StoreBinaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>; 3928 let DispSize = "20" in 3929 def Y : StoreBinaryRSY<mnemonic#"y", rsyOpcode, cls, bytes, 3930 bdaddr20pair>; 3931 } 3932} 3933 3934class StoreBinaryRSL<string mnemonic, bits<16> opcode, RegisterOperand cls> 3935 : InstRSLb<opcode, (outs), 3936 (ins cls:$R1, bdladdr12onlylen8:$BDL2, imm32zx4:$M3), 3937 mnemonic#"\t$R1, $BDL2, $M3", []> { 3938 let mayStore = 1; 3939} 3940 3941class BinaryVSI<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3942 bits<5> bytes> 3943 : InstVSI<opcode, (outs VR128:$V1), (ins bdaddr12only:$BD2, imm32zx8:$I3), 3944 mnemonic#"\t$V1, $BD2, $I3", 3945 [(set VR128:$V1, (operator imm32zx8:$I3, bdaddr12only:$BD2))]> { 3946 let mayLoad = 1; 3947 let AccessBytes = bytes; 3948} 3949 3950class StoreBinaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes, 3951 ImmOpWithPattern index> 3952 : InstVRV<opcode, (outs), (ins VR128:$V1, bdvaddr12only:$VBD2, index:$M3), 3953 mnemonic#"\t$V1, $VBD2, $M3", []> { 3954 let mayStore = 1; 3955 let AccessBytes = bytes; 3956} 3957 3958class StoreBinaryVRX<string mnemonic, bits<16> opcode, 3959 SDPatternOperator operator, TypedReg tr, bits<5> bytes, 3960 ImmOpWithPattern index> 3961 : InstVRX<opcode, (outs), (ins tr.op:$V1, bdxaddr12only:$XBD2, index:$M3), 3962 mnemonic#"\t$V1, $XBD2, $M3", 3963 [(operator (tr.vt tr.op:$V1), bdxaddr12only:$XBD2, index:$M3)]> { 3964 let mayStore = 1; 3965 let AccessBytes = bytes; 3966} 3967 3968class MemoryBinarySSd<string mnemonic, bits<8> opcode, 3969 RegisterOperand cls> 3970 : InstSSd<opcode, (outs), 3971 (ins bdraddr12only:$RBD1, bdaddr12only:$BD2, cls:$R3), 3972 mnemonic#"\t$RBD1, $BD2, $R3", []>; 3973 3974class CompareRR<string mnemonic, bits<8> opcode, SDPatternOperator operator, 3975 RegisterOperand cls1, RegisterOperand cls2> 3976 : InstRR<opcode, (outs), (ins cls1:$R1, cls2:$R2), 3977 mnemonic#"\t$R1, $R2", 3978 [(set CC, (operator cls1:$R1, cls2:$R2))]> { 3979 let OpKey = mnemonic#cls1; 3980 let OpType = "reg"; 3981 let isCompare = 1; 3982} 3983 3984class CompareRRE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 3985 RegisterOperand cls1, RegisterOperand cls2> 3986 : InstRRE<opcode, (outs), (ins cls1:$R1, cls2:$R2), 3987 mnemonic#"\t$R1, $R2", 3988 [(set CC, (operator cls1:$R1, cls2:$R2))]> { 3989 let OpKey = mnemonic#cls1; 3990 let OpType = "reg"; 3991 let isCompare = 1; 3992} 3993 3994class CompareRI<string mnemonic, bits<12> opcode, SDPatternOperator operator, 3995 RegisterOperand cls, ImmOpWithPattern imm> 3996 : InstRIa<opcode, (outs), (ins cls:$R1, imm:$I2), 3997 mnemonic#"\t$R1, $I2", 3998 [(set CC, (operator cls:$R1, imm:$I2))]> { 3999 let isCompare = 1; 4000} 4001 4002class CompareRIL<string mnemonic, bits<12> opcode, SDPatternOperator operator, 4003 RegisterOperand cls, ImmOpWithPattern imm> 4004 : InstRILa<opcode, (outs), (ins cls:$R1, imm:$I2), 4005 mnemonic#"\t$R1, $I2", 4006 [(set CC, (operator cls:$R1, imm:$I2))]> { 4007 let isCompare = 1; 4008} 4009 4010class CompareRILPC<string mnemonic, bits<12> opcode, SDPatternOperator operator, 4011 RegisterOperand cls, SDPatternOperator load> 4012 : InstRILb<opcode, (outs), (ins cls:$R1, pcrel32:$RI2), 4013 mnemonic#"\t$R1, $RI2", 4014 [(set CC, (operator cls:$R1, (load pcrel32:$RI2)))]> { 4015 let isCompare = 1; 4016 let mayLoad = 1; 4017 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 4018 // However, BDXs have two extra operands and are therefore 6 units more 4019 // complex. 4020 let AddedComplexity = 7; 4021} 4022 4023class CompareRX<string mnemonic, bits<8> opcode, SDPatternOperator operator, 4024 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 4025 AddressingMode mode = bdxaddr12only> 4026 : InstRXa<opcode, (outs), (ins cls:$R1, mode:$XBD2), 4027 mnemonic#"\t$R1, $XBD2", 4028 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> { 4029 let OpKey = mnemonic#"r"#cls; 4030 let OpType = "mem"; 4031 let isCompare = 1; 4032 let mayLoad = 1; 4033 let AccessBytes = bytes; 4034} 4035 4036class CompareRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4037 RegisterOperand cls, SDPatternOperator load, bits<5> bytes> 4038 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2), 4039 mnemonic#"\t$R1, $XBD2", 4040 [(set CC, (operator cls:$R1, (load bdxaddr12only:$XBD2)))]> { 4041 let OpKey = mnemonic#"r"#cls; 4042 let OpType = "mem"; 4043 let isCompare = 1; 4044 let mayLoad = 1; 4045 let AccessBytes = bytes; 4046 let M3 = 0; 4047} 4048 4049class CompareRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4050 RegisterOperand cls, SDPatternOperator load, bits<5> bytes, 4051 AddressingMode mode = bdxaddr20only> 4052 : InstRXYa<opcode, (outs), (ins cls:$R1, mode:$XBD2), 4053 mnemonic#"\t$R1, $XBD2", 4054 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> { 4055 let OpKey = mnemonic#"r"#cls; 4056 let OpType = "mem"; 4057 let isCompare = 1; 4058 let mayLoad = 1; 4059 let AccessBytes = bytes; 4060} 4061 4062multiclass CompareRXPair<string mnemonic, bits<8> rxOpcode, bits<16> rxyOpcode, 4063 SDPatternOperator operator, RegisterOperand cls, 4064 SDPatternOperator load, bits<5> bytes> { 4065 let DispKey = mnemonic # cls in { 4066 let DispSize = "12" in 4067 def "" : CompareRX<mnemonic, rxOpcode, operator, cls, 4068 load, bytes, bdxaddr12pair>; 4069 let DispSize = "20" in 4070 def Y : CompareRXY<mnemonic#"y", rxyOpcode, operator, cls, 4071 load, bytes, bdxaddr20pair>; 4072 } 4073} 4074 4075class CompareRS<string mnemonic, bits<8> opcode, RegisterOperand cls, 4076 bits<5> bytes, AddressingMode mode = bdaddr12only> 4077 : InstRSb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2), 4078 mnemonic#"\t$R1, $M3, $BD2", []> { 4079 let mayLoad = 1; 4080 let AccessBytes = bytes; 4081} 4082 4083class CompareRSY<string mnemonic, bits<16> opcode, RegisterOperand cls, 4084 bits<5> bytes, AddressingMode mode = bdaddr20only> 4085 : InstRSYb<opcode, (outs), (ins cls:$R1, imm32zx4:$M3, mode:$BD2), 4086 mnemonic#"\t$R1, $M3, $BD2", []> { 4087 let mayLoad = 1; 4088 let AccessBytes = bytes; 4089} 4090 4091multiclass CompareRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode, 4092 RegisterOperand cls, bits<5> bytes> { 4093 let DispKey = mnemonic # cls in { 4094 let DispSize = "12" in 4095 def "" : CompareRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>; 4096 let DispSize = "20" in 4097 def Y : CompareRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>; 4098 } 4099} 4100 4101class CompareSSb<string mnemonic, bits<8> opcode> 4102 : InstSSb<opcode, 4103 (outs), (ins bdladdr12onlylen4:$BDL1, bdladdr12onlylen4:$BDL2), 4104 mnemonic#"\t$BDL1, $BDL2", []> { 4105 let isCompare = 1; 4106 let mayLoad = 1; 4107} 4108 4109class CompareSI<string mnemonic, bits<8> opcode, SDPatternOperator operator, 4110 SDPatternOperator load, ImmOpWithPattern imm, 4111 AddressingMode mode = bdaddr12only> 4112 : InstSI<opcode, (outs), (ins mode:$BD1, imm:$I2), 4113 mnemonic#"\t$BD1, $I2", 4114 [(set CC, (operator (load mode:$BD1), imm:$I2))]> { 4115 let isCompare = 1; 4116 let mayLoad = 1; 4117} 4118 4119class CompareSIL<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4120 SDPatternOperator load, ImmOpWithPattern imm> 4121 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2), 4122 mnemonic#"\t$BD1, $I2", 4123 [(set CC, (operator (load bdaddr12only:$BD1), imm:$I2))]> { 4124 let isCompare = 1; 4125 let mayLoad = 1; 4126} 4127 4128class CompareSIY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4129 SDPatternOperator load, ImmOpWithPattern imm, 4130 AddressingMode mode = bdaddr20only> 4131 : InstSIY<opcode, (outs), (ins mode:$BD1, imm:$I2), 4132 mnemonic#"\t$BD1, $I2", 4133 [(set CC, (operator (load mode:$BD1), imm:$I2))]> { 4134 let isCompare = 1; 4135 let mayLoad = 1; 4136} 4137 4138multiclass CompareSIPair<string mnemonic, bits<8> siOpcode, bits<16> siyOpcode, 4139 SDPatternOperator operator, SDPatternOperator load, 4140 ImmOpWithPattern imm> { 4141 let DispKey = mnemonic in { 4142 let DispSize = "12" in 4143 def "" : CompareSI<mnemonic, siOpcode, operator, load, imm, bdaddr12pair>; 4144 let DispSize = "20" in 4145 def Y : CompareSIY<mnemonic#"y", siyOpcode, operator, load, imm, 4146 bdaddr20pair>; 4147 } 4148} 4149 4150class CompareVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4151 TypedReg tr, bits<4> type, string fp_mnemonic = ""> 4152 : InstVRRa<opcode, (outs), (ins tr.op:$V1, tr.op:$V2), 4153 mnemonic#"\t$V1, $V2", 4154 [(set CC, (operator (tr.vt tr.op:$V1), (tr.vt tr.op:$V2)))]> { 4155 let isCompare = 1; 4156 let M3 = type; 4157 let M4 = 0; 4158 let M5 = 0; 4159 let OpKey = fp_mnemonic#!subst("VR", "FP", !cast<string>(tr.op)); 4160 let OpType = "reg"; 4161} 4162 4163class CompareVRRaGeneric<string mnemonic, bits<16> opcode> 4164 : InstVRRa<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3), 4165 mnemonic#"\t$V1, $V2, $M3", []> { 4166 let isCompare = 1; 4167 let M4 = 0; 4168 let M5 = 0; 4169} 4170 4171class CompareVRRaFloatGeneric<string mnemonic, bits<16> opcode> 4172 : InstVRRa<opcode, (outs), 4173 (ins VR64:$V1, VR64:$V2, imm32zx4:$M3, imm32zx4:$M4), 4174 mnemonic#"\t$V1, $V2, $M3, $M4", []> { 4175 let isCompare = 1; 4176 let M5 = 0; 4177} 4178 4179class CompareVRRh<string mnemonic, bits<16> opcode> 4180 : InstVRRh<opcode, (outs), (ins VR128:$V1, VR128:$V2, imm32zx4:$M3), 4181 mnemonic#"\t$V1, $V2, $M3", []> { 4182 let isCompare = 1; 4183} 4184 4185class TestInherentS<string mnemonic, bits<16> opcode, 4186 SDPatternOperator operator> 4187 : InstS<opcode, (outs), (ins), mnemonic, [(set CC, (operator))]> { 4188 let BD2 = 0; 4189} 4190 4191class TestRXE<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4192 RegisterOperand cls> 4193 : InstRXE<opcode, (outs), (ins cls:$R1, bdxaddr12only:$XBD2), 4194 mnemonic#"\t$R1, $XBD2", 4195 [(set CC, (operator cls:$R1, bdxaddr12only:$XBD2))]> { 4196 let M3 = 0; 4197} 4198 4199class TestBinarySIL<string mnemonic, bits<16> opcode, 4200 SDPatternOperator operator, ImmOpWithPattern imm> 4201 : InstSIL<opcode, (outs), (ins bdaddr12only:$BD1, imm:$I2), 4202 mnemonic#"\t$BD1, $I2", 4203 [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>; 4204 4205class TestRSL<string mnemonic, bits<16> opcode> 4206 : InstRSLa<opcode, (outs), (ins bdladdr12onlylen4:$BDL1), 4207 mnemonic#"\t$BDL1", []> { 4208 let mayLoad = 1; 4209} 4210 4211class TestVRRg<string mnemonic, bits<16> opcode> 4212 : InstVRRg<opcode, (outs), (ins VR128:$V1), 4213 mnemonic#"\t$V1", []>; 4214 4215class SideEffectTernarySSc<string mnemonic, bits<8> opcode> 4216 : InstSSc<opcode, (outs), (ins bdladdr12onlylen4:$BDL1, 4217 shift12only:$BD2, imm32zx4:$I3), 4218 mnemonic#"\t$BDL1, $BD2, $I3", []>; 4219 4220class SideEffectTernaryRRFa<string mnemonic, bits<16> opcode, 4221 RegisterOperand cls1, RegisterOperand cls2, 4222 RegisterOperand cls3> 4223 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3), 4224 mnemonic#"\t$R1, $R2, $R3", []> { 4225 let M4 = 0; 4226} 4227 4228class SideEffectTernaryMemMemRRFa<string mnemonic, bits<16> opcode, 4229 RegisterOperand cls1, RegisterOperand cls2, 4230 RegisterOperand cls3> 4231 : InstRRFa<opcode, (outs cls1:$R1, cls2:$R2), 4232 (ins cls1:$R1src, cls2:$R2src, cls3:$R3), 4233 mnemonic#"\t$R1, $R2, $R3", []> { 4234 let Constraints = "$R1 = $R1src, $R2 = $R2src"; 4235 let DisableEncoding = "$R1src, $R2src"; 4236 let M4 = 0; 4237} 4238 4239class SideEffectTernaryRRFb<string mnemonic, bits<16> opcode, 4240 RegisterOperand cls1, RegisterOperand cls2, 4241 RegisterOperand cls3> 4242 : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3), 4243 mnemonic#"\t$R1, $R3, $R2", []> { 4244 let M4 = 0; 4245} 4246 4247class SideEffectTernaryMemMemMemRRFb<string mnemonic, bits<16> opcode, 4248 RegisterOperand cls1, 4249 RegisterOperand cls2, 4250 RegisterOperand cls3> 4251 : InstRRFb<opcode, (outs cls1:$R1, cls2:$R2, cls3:$R3), 4252 (ins cls1:$R1src, cls2:$R2src, cls3:$R3src), 4253 mnemonic#"\t$R1, $R3, $R2", []> { 4254 let Constraints = "$R1 = $R1src, $R2 = $R2src, $R3 = $R3src"; 4255 let DisableEncoding = "$R1src, $R2src, $R3src"; 4256 let M4 = 0; 4257} 4258 4259class SideEffectTernaryRRFc<string mnemonic, bits<16> opcode, 4260 RegisterOperand cls1, RegisterOperand cls2, 4261 ImmOpWithPattern imm> 4262 : InstRRFc<opcode, (outs), (ins cls1:$R1, cls2:$R2, imm:$M3), 4263 mnemonic#"\t$R1, $R2, $M3", []>; 4264 4265multiclass SideEffectTernaryRRFcOpt<string mnemonic, bits<16> opcode, 4266 RegisterOperand cls1, 4267 RegisterOperand cls2> { 4268 def "" : SideEffectTernaryRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>; 4269 def Opt : SideEffectBinaryRRFc<mnemonic, opcode, cls1, cls2>; 4270} 4271 4272class SideEffectTernaryMemMemRRFc<string mnemonic, bits<16> opcode, 4273 RegisterOperand cls1, RegisterOperand cls2, 4274 ImmOpWithPattern imm> 4275 : InstRRFc<opcode, (outs cls1:$R1, cls2:$R2), 4276 (ins cls1:$R1src, cls2:$R2src, imm:$M3), 4277 mnemonic#"\t$R1, $R2, $M3", []> { 4278 let Constraints = "$R1 = $R1src, $R2 = $R2src"; 4279 let DisableEncoding = "$R1src, $R2src"; 4280} 4281 4282multiclass SideEffectTernaryMemMemRRFcOpt<string mnemonic, bits<16> opcode, 4283 RegisterOperand cls1, 4284 RegisterOperand cls2> { 4285 def "" : SideEffectTernaryMemMemRRFc<mnemonic, opcode, cls1, cls2, imm32zx4>; 4286 def Opt : SideEffectBinaryMemMemRRFc<mnemonic, opcode, cls1, cls2>; 4287} 4288 4289class SideEffectTernarySSF<string mnemonic, bits<12> opcode, 4290 RegisterOperand cls> 4291 : InstSSF<opcode, (outs), 4292 (ins bdaddr12only:$BD1, bdaddr12only:$BD2, cls:$R3), 4293 mnemonic#"\t$BD1, $BD2, $R3", []>; 4294 4295class TernaryRRFa<string mnemonic, bits<16> opcode, 4296 RegisterOperand cls1, RegisterOperand cls2, 4297 RegisterOperand cls3> 4298 : InstRRFa<opcode, (outs cls1:$R1), (ins cls2:$R2, cls3:$R3, imm32zx4:$M4), 4299 mnemonic#"\t$R1, $R2, $R3, $M4", []>; 4300 4301class TernaryRRFb<string mnemonic, bits<16> opcode, 4302 RegisterOperand cls1, RegisterOperand cls2, 4303 RegisterOperand cls3> 4304 : InstRRFb<opcode, (outs cls1:$R1, cls3:$R3), 4305 (ins cls1:$R1src, cls2:$R2, imm32zx4:$M4), 4306 mnemonic#"\t$R1, $R3, $R2, $M4", []> { 4307 let Constraints = "$R1 = $R1src"; 4308 let DisableEncoding = "$R1src"; 4309} 4310 4311class TernaryRRFe<string mnemonic, bits<16> opcode, RegisterOperand cls1, 4312 RegisterOperand cls2> 4313 : InstRRFe<opcode, (outs cls1:$R1), 4314 (ins imm32zx4:$M3, cls2:$R2, imm32zx4:$M4), 4315 mnemonic#"\t$R1, $M3, $R2, $M4", []>; 4316 4317class TernaryRRD<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4318 RegisterOperand cls1, RegisterOperand cls2> 4319 : InstRRD<opcode, (outs cls1:$R1), (ins cls2:$R1src, cls2:$R3, cls2:$R2), 4320 mnemonic#"\t$R1, $R3, $R2", 4321 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3, cls2:$R2))]> { 4322 let OpKey = mnemonic#cls; 4323 let OpType = "reg"; 4324 let Constraints = "$R1 = $R1src"; 4325 let DisableEncoding = "$R1src"; 4326} 4327 4328class TernaryRS<string mnemonic, bits<8> opcode, RegisterOperand cls, 4329 bits<5> bytes, AddressingMode mode = bdaddr12only> 4330 : InstRSb<opcode, (outs cls:$R1), 4331 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2), 4332 mnemonic#"\t$R1, $M3, $BD2", []> { 4333 4334 let Constraints = "$R1 = $R1src"; 4335 let DisableEncoding = "$R1src"; 4336 let mayLoad = 1; 4337 let AccessBytes = bytes; 4338} 4339 4340class TernaryRSY<string mnemonic, bits<16> opcode, RegisterOperand cls, 4341 bits<5> bytes, AddressingMode mode = bdaddr20only> 4342 : InstRSYb<opcode, (outs cls:$R1), 4343 (ins cls:$R1src, imm32zx4:$M3, mode:$BD2), 4344 mnemonic#"\t$R1, $M3, $BD2", []> { 4345 4346 let Constraints = "$R1 = $R1src"; 4347 let DisableEncoding = "$R1src"; 4348 let mayLoad = 1; 4349 let AccessBytes = bytes; 4350} 4351 4352multiclass TernaryRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode, 4353 RegisterOperand cls, bits<5> bytes> { 4354 let DispKey = mnemonic # cls in { 4355 let DispSize = "12" in 4356 def "" : TernaryRS<mnemonic, rsOpcode, cls, bytes, bdaddr12pair>; 4357 let DispSize = "20" in 4358 def Y : TernaryRSY<mnemonic#"y", rsyOpcode, cls, bytes, bdaddr20pair>; 4359 } 4360} 4361 4362class SideEffectTernaryRS<string mnemonic, bits<8> opcode, 4363 RegisterOperand cls1, RegisterOperand cls2> 4364 : InstRSa<opcode, (outs), 4365 (ins cls1:$R1, cls2:$R3, bdaddr12only:$BD2), 4366 mnemonic#"\t$R1, $R3, $BD2", []>; 4367 4368class SideEffectTernaryRSY<string mnemonic, bits<16> opcode, 4369 RegisterOperand cls1, RegisterOperand cls2> 4370 : InstRSYa<opcode, (outs), 4371 (ins cls1:$R1, cls2:$R3, bdaddr20only:$BD2), 4372 mnemonic#"\t$R1, $R3, $BD2", []>; 4373 4374class SideEffectTernaryMemMemRS<string mnemonic, bits<8> opcode, 4375 RegisterOperand cls1, RegisterOperand cls2> 4376 : InstRSa<opcode, (outs cls1:$R1, cls2:$R3), 4377 (ins cls1:$R1src, cls2:$R3src, shift12only:$BD2), 4378 mnemonic#"\t$R1, $R3, $BD2", []> { 4379 let Constraints = "$R1 = $R1src, $R3 = $R3src"; 4380 let DisableEncoding = "$R1src, $R3src"; 4381} 4382 4383class SideEffectTernaryMemMemRSY<string mnemonic, bits<16> opcode, 4384 RegisterOperand cls1, RegisterOperand cls2> 4385 : InstRSYa<opcode, (outs cls1:$R1, cls2:$R3), 4386 (ins cls1:$R1src, cls2:$R3src, shift20only:$BD2), 4387 mnemonic#"\t$R1, $R3, $BD2", []> { 4388 let Constraints = "$R1 = $R1src, $R3 = $R3src"; 4389 let DisableEncoding = "$R1src, $R3src"; 4390} 4391 4392class TernaryRXF<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4393 RegisterOperand cls1, RegisterOperand cls2, 4394 SDPatternOperator load, bits<5> bytes> 4395 : InstRXF<opcode, (outs cls1:$R1), 4396 (ins cls2:$R1src, cls2:$R3, bdxaddr12only:$XBD2), 4397 mnemonic#"\t$R1, $R3, $XBD2", 4398 [(set cls1:$R1, (operator cls2:$R1src, cls2:$R3, 4399 (load bdxaddr12only:$XBD2)))]> { 4400 let OpKey = mnemonic#"r"#cls; 4401 let OpType = "mem"; 4402 let Constraints = "$R1 = $R1src"; 4403 let DisableEncoding = "$R1src"; 4404 let mayLoad = 1; 4405 let AccessBytes = bytes; 4406} 4407 4408class TernaryVRIa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4409 TypedReg tr1, TypedReg tr2, ImmOpWithPattern imm, ImmOpWithPattern index> 4410 : InstVRIa<opcode, (outs tr1.op:$V1), (ins tr2.op:$V1src, imm:$I2, index:$M3), 4411 mnemonic#"\t$V1, $I2, $M3", 4412 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src), 4413 imm:$I2, index:$M3))]> { 4414 let Constraints = "$V1 = $V1src"; 4415 let DisableEncoding = "$V1src"; 4416} 4417 4418class TernaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4419 TypedReg tr1, TypedReg tr2, bits<4> type> 4420 : InstVRId<opcode, (outs tr1.op:$V1), 4421 (ins tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4), 4422 mnemonic#"\t$V1, $V2, $V3, $I4", 4423 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 4424 (tr2.vt tr2.op:$V3), 4425 imm32zx8_timm:$I4))]> { 4426 let M5 = type; 4427} 4428 4429class TernaryVRIi<string mnemonic, bits<16> opcode, RegisterOperand cls> 4430 : InstVRIi<opcode, (outs VR128:$V1), 4431 (ins cls:$R2, imm32zx8:$I3, imm32zx4:$M4), 4432 mnemonic#"\t$V1, $R2, $I3, $M4", []>; 4433 4434class TernaryVRRa<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4435 TypedReg tr1, TypedReg tr2, bits<4> type, bits<4> m4or> 4436 : InstVRRa<opcode, (outs tr1.op:$V1), 4437 (ins tr2.op:$V2, imm32zx4:$M4, imm32zx4:$M5), 4438 mnemonic#"\t$V1, $V2, $M4, $M5", 4439 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 4440 imm32zx4_timm:$M4, 4441 imm32zx4_timm:$M5))], 4442 m4or> { 4443 let M3 = type; 4444} 4445 4446class TernaryVRRaFloatGeneric<string mnemonic, bits<16> opcode> 4447 : InstVRRa<opcode, (outs VR128:$V1), 4448 (ins VR128:$V2, imm32zx4:$M3, imm32zx4:$M4, imm32zx4:$M5), 4449 mnemonic#"\t$V1, $V2, $M3, $M4, $M5", []>; 4450 4451class TernaryVRRb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4452 TypedReg tr1, TypedReg tr2, bits<4> type, 4453 SDPatternOperator m5mask, bits<4> m5or> 4454 : InstVRRb<opcode, (outs tr1.op:$V1), 4455 (ins tr2.op:$V2, tr2.op:$V3, m5mask:$M5), 4456 mnemonic#"\t$V1, $V2, $V3, $M5", 4457 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 4458 (tr2.vt tr2.op:$V3), 4459 m5mask:$M5))], 4460 m5or> { 4461 let M4 = type; 4462} 4463 4464// Declare a pair of instructions, one which sets CC and one which doesn't. 4465// The CC-setting form ends with "S" and sets the low bit of M5. 4466// Also create aliases to make use of M5 operand optional in assembler. 4467multiclass TernaryOptVRRbSPair<string mnemonic, bits<16> opcode, 4468 SDPatternOperator operator, 4469 SDPatternOperator operator_cc, 4470 TypedReg tr1, TypedReg tr2, bits<4> type, 4471 bits<4> modifier = 0> { 4472 def "" : TernaryVRRb<mnemonic, opcode, operator, tr1, tr2, type, 4473 imm32zx4even_timm, !and (modifier, 14)>; 4474 def : InstAlias<mnemonic#"\t$V1, $V2, $V3", 4475 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 4476 tr2.op:$V3, 0)>; 4477 let Defs = [CC] in 4478 def S : TernaryVRRb<mnemonic#"s", opcode, operator_cc, tr1, tr2, type, 4479 imm32zx4even_timm, !add(!and (modifier, 14), 1)>; 4480 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3", 4481 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2, 4482 tr2.op:$V3, 0)>; 4483} 4484 4485multiclass TernaryOptVRRbSPairGeneric<string mnemonic, bits<16> opcode> { 4486 let Defs = [CC] in 4487 def "" : InstVRRb<opcode, (outs VR128:$V1), 4488 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5), 4489 mnemonic#"\t$V1, $V2, $V3, $M4, $M5", []>; 4490 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $M4", 4491 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3, 4492 imm32zx4:$M4, 0)>; 4493} 4494 4495class TernaryVRRc<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4496 TypedReg tr1, TypedReg tr2> 4497 : InstVRRc<opcode, (outs tr1.op:$V1), 4498 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M4), 4499 mnemonic#"\t$V1, $V2, $V3, $M4", 4500 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 4501 (tr2.vt tr2.op:$V3), 4502 imm32zx4_timm:$M4))]> { 4503 let M5 = 0; 4504 let M6 = 0; 4505} 4506 4507class TernaryVRRcFloat<string mnemonic, bits<16> opcode, 4508 SDPatternOperator operator, TypedReg tr1, TypedReg tr2, 4509 bits<4> type = 0, bits<4> m5 = 0> 4510 : InstVRRc<opcode, (outs tr1.op:$V1), 4511 (ins tr2.op:$V2, tr2.op:$V3, imm32zx4:$M6), 4512 mnemonic#"\t$V1, $V2, $V3, $M6", 4513 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 4514 (tr2.vt tr2.op:$V3), 4515 imm32zx4_timm:$M6))]> { 4516 let M4 = type; 4517 let M5 = m5; 4518} 4519 4520class TernaryVRRcFloatGeneric<string mnemonic, bits<16> opcode> 4521 : InstVRRc<opcode, (outs VR128:$V1), 4522 (ins VR128:$V2, VR128:$V3, imm32zx4:$M4, imm32zx4:$M5, 4523 imm32zx4:$M6), 4524 mnemonic#"\t$V1, $V2, $V3, $M4, $M5, $M6", []>; 4525 4526class TernaryVRRd<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4527 TypedReg tr1, TypedReg tr2, bits<4> type = 0, bits<4> m6 = 0> 4528 : InstVRRd<opcode, (outs tr1.op:$V1), 4529 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4), 4530 mnemonic#"\t$V1, $V2, $V3, $V4", 4531 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 4532 (tr2.vt tr2.op:$V3), 4533 (tr1.vt tr1.op:$V4)))]> { 4534 let M5 = type; 4535 let M6 = m6; 4536} 4537 4538class TernaryVRRdGeneric<string mnemonic, bits<16> opcode> 4539 : InstVRRd<opcode, (outs VR128:$V1), 4540 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5), 4541 mnemonic#"\t$V1, $V2, $V3, $V4, $M5", []> { 4542 let M6 = 0; 4543} 4544 4545// Ternary operation where the assembler mnemonic has an extra operand to 4546// optionally allow specifying arbitrary M6 values. 4547multiclass TernaryExtraVRRd<string mnemonic, bits<16> opcode, 4548 SDPatternOperator operator, 4549 TypedReg tr1, TypedReg tr2, bits<4> type> { 4550 let M5 = type, Defs = [CC] in 4551 def "" : InstVRRd<opcode, (outs tr1.op:$V1), 4552 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, imm32zx4:$M6), 4553 mnemonic#"\t$V1, $V2, $V3, $V4, $M6", []>; 4554 def : Pat<(operator (tr2.vt tr2.op:$V2), (tr2.vt tr2.op:$V3), 4555 (tr1.vt tr1.op:$V4)), 4556 (!cast<Instruction>(NAME) tr2.op:$V2, tr2.op:$V3, tr1.op:$V4, 0)>; 4557 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4", 4558 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 4559 tr2.op:$V3, tr1.op:$V4, 0)>; 4560} 4561 4562multiclass TernaryExtraVRRdGeneric<string mnemonic, bits<16> opcode> { 4563 let Defs = [CC] in 4564 def "" : InstVRRd<opcode, (outs VR128:$V1), 4565 (ins VR128:$V2, VR128:$V3, VR128:$V4, 4566 imm32zx4:$M5, imm32zx4:$M6), 4567 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>; 4568 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5", 4569 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3, 4570 VR128:$V4, imm32zx4:$M5, 0)>; 4571} 4572 4573class TernaryVRRe<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4574 TypedReg tr1, TypedReg tr2, bits<4> m5 = 0, bits<4> type = 0, 4575 string fp_mnemonic = ""> 4576 : InstVRRe<opcode, (outs tr1.op:$V1), 4577 (ins tr2.op:$V2, tr2.op:$V3, tr1.op:$V4), 4578 mnemonic#"\t$V1, $V2, $V3, $V4", 4579 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 4580 (tr2.vt tr2.op:$V3), 4581 (tr1.vt tr1.op:$V4)))]> { 4582 let M5 = m5; 4583 let M6 = type; 4584 let OpKey = fp_mnemonic#"MemFold"#!subst("VR", "FP", !cast<string>(tr1.op)); 4585 let OpType = "reg"; 4586} 4587 4588class TernaryVRReFloatGeneric<string mnemonic, bits<16> opcode> 4589 : InstVRRe<opcode, (outs VR128:$V1), 4590 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6), 4591 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>; 4592 4593class TernaryVRSb<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4594 TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type> 4595 : InstVRSb<opcode, (outs tr1.op:$V1), 4596 (ins tr2.op:$V1src, cls:$R3, shift12only:$BD2), 4597 mnemonic#"\t$V1, $R3, $BD2", 4598 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src), 4599 cls:$R3, 4600 shift12only:$BD2))]> { 4601 let Constraints = "$V1 = $V1src"; 4602 let DisableEncoding = "$V1src"; 4603 let M4 = type; 4604} 4605 4606class TernaryVRRi<string mnemonic, bits<16> opcode, RegisterOperand cls> 4607 : InstVRRi<opcode, (outs cls:$R1), (ins VR128:$V2, 4608 imm32zx4:$M3, imm32zx4:$M4), 4609 mnemonic#"\t$R1, $V2, $M3, $M4", []>; 4610 4611class TernaryVRRj<string mnemonic, bits<16> opcode> 4612 : InstVRRj<opcode, (outs VR128:$V1), (ins VR128:$V2, 4613 VR128:$V3, imm32zx4:$M4), 4614 mnemonic#"\t$V1, $V2, $V3, $M4", []>; 4615 4616class TernaryVRSbGeneric<string mnemonic, bits<16> opcode> 4617 : InstVRSb<opcode, (outs VR128:$V1), 4618 (ins VR128:$V1src, GR64:$R3, shift12only:$BD2, imm32zx4:$M4), 4619 mnemonic#"\t$V1, $R3, $BD2, $M4", []> { 4620 let Constraints = "$V1 = $V1src"; 4621 let DisableEncoding = "$V1src"; 4622} 4623 4624class TernaryVRV<string mnemonic, bits<16> opcode, bits<5> bytes, 4625 ImmOpWithPattern index> 4626 : InstVRV<opcode, (outs VR128:$V1), 4627 (ins VR128:$V1src, bdvaddr12only:$VBD2, index:$M3), 4628 mnemonic#"\t$V1, $VBD2, $M3", []> { 4629 let Constraints = "$V1 = $V1src"; 4630 let DisableEncoding = "$V1src"; 4631 let mayLoad = 1; 4632 let AccessBytes = bytes; 4633} 4634 4635class TernaryVRX<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4636 TypedReg tr1, TypedReg tr2, bits<5> bytes, ImmOpWithPattern index> 4637 : InstVRX<opcode, (outs tr1.op:$V1), 4638 (ins tr2.op:$V1src, bdxaddr12only:$XBD2, index:$M3), 4639 mnemonic#"\t$V1, $XBD2, $M3", 4640 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src), 4641 bdxaddr12only:$XBD2, 4642 index:$M3))]> { 4643 let Constraints = "$V1 = $V1src"; 4644 let DisableEncoding = "$V1src"; 4645 let mayLoad = 1; 4646 let AccessBytes = bytes; 4647} 4648 4649class QuaternaryVRId<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4650 TypedReg tr1, TypedReg tr2, bits<4> type> 4651 : InstVRId<opcode, (outs tr1.op:$V1), 4652 (ins tr2.op:$V1src, tr2.op:$V2, tr2.op:$V3, imm32zx8:$I4), 4653 mnemonic#"\t$V1, $V2, $V3, $I4", 4654 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V1src), 4655 (tr2.vt tr2.op:$V2), 4656 (tr2.vt tr2.op:$V3), 4657 imm32zx8_timm:$I4))]> { 4658 let Constraints = "$V1 = $V1src"; 4659 let DisableEncoding = "$V1src"; 4660 let M5 = type; 4661} 4662 4663class QuaternaryVRIdGeneric<string mnemonic, bits<16> opcode> 4664 : InstVRId<opcode, (outs VR128:$V1), 4665 (ins VR128:$V1src, VR128:$V2, VR128:$V3, 4666 imm32zx8:$I4, imm32zx4:$M5), 4667 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []> { 4668 let Constraints = "$V1 = $V1src"; 4669 let DisableEncoding = "$V1src"; 4670} 4671 4672class QuaternaryVRIf<string mnemonic, bits<16> opcode> 4673 : InstVRIf<opcode, (outs VR128:$V1), 4674 (ins VR128:$V2, VR128:$V3, 4675 imm32zx8:$I4, imm32zx4:$M5), 4676 mnemonic#"\t$V1, $V2, $V3, $I4, $M5", []>; 4677 4678class QuaternaryVRIg<string mnemonic, bits<16> opcode> 4679 : InstVRIg<opcode, (outs VR128:$V1), 4680 (ins VR128:$V2, imm32zx8:$I3, 4681 imm32zx8:$I4, imm32zx4:$M5), 4682 mnemonic#"\t$V1, $V2, $I3, $I4, $M5", []>; 4683 4684class QuaternaryVRRd<string mnemonic, bits<16> opcode, 4685 SDPatternOperator operator, TypedReg tr1, TypedReg tr2, 4686 TypedReg tr3, TypedReg tr4, bits<4> type, 4687 SDPatternOperator m6mask = imm32zx4_timm, bits<4> m6or = 0> 4688 : InstVRRd<opcode, (outs tr1.op:$V1), 4689 (ins tr2.op:$V2, tr3.op:$V3, tr4.op:$V4, m6mask:$M6), 4690 mnemonic#"\t$V1, $V2, $V3, $V4, $M6", 4691 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2), 4692 (tr3.vt tr3.op:$V3), 4693 (tr4.vt tr4.op:$V4), 4694 m6mask:$M6))], 4695 m6or> { 4696 let M5 = type; 4697} 4698 4699class QuaternaryVRRdGeneric<string mnemonic, bits<16> opcode> 4700 : InstVRRd<opcode, (outs VR128:$V1), 4701 (ins VR128:$V2, VR128:$V3, VR128:$V4, imm32zx4:$M5, imm32zx4:$M6), 4702 mnemonic#"\t$V1, $V2, $V3, $V4, $M5, $M6", []>; 4703 4704// Declare a pair of instructions, one which sets CC and one which doesn't. 4705// The CC-setting form ends with "S" and sets the low bit of M6. 4706// Also create aliases to make use of M6 operand optional in assembler. 4707multiclass QuaternaryOptVRRdSPair<string mnemonic, bits<16> opcode, 4708 SDPatternOperator operator, 4709 SDPatternOperator operator_cc, 4710 TypedReg tr1, TypedReg tr2, bits<4> type, 4711 bits<4> modifier = 0> { 4712 def "" : QuaternaryVRRd<mnemonic, opcode, operator, 4713 tr1, tr2, tr2, tr2, type, 4714 imm32zx4even_timm, !and (modifier, 14)>; 4715 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4", 4716 (!cast<Instruction>(NAME) tr1.op:$V1, tr2.op:$V2, 4717 tr2.op:$V3, tr2.op:$V4, 0)>; 4718 let Defs = [CC] in 4719 def S : QuaternaryVRRd<mnemonic#"s", opcode, operator_cc, 4720 tr1, tr2, tr2, tr2, type, 4721 imm32zx4even_timm, !add (!and (modifier, 14), 1)>; 4722 def : InstAlias<mnemonic#"s\t$V1, $V2, $V3, $V4", 4723 (!cast<Instruction>(NAME#"S") tr1.op:$V1, tr2.op:$V2, 4724 tr2.op:$V3, tr2.op:$V4, 0)>; 4725} 4726 4727multiclass QuaternaryOptVRRdSPairGeneric<string mnemonic, bits<16> opcode> { 4728 let Defs = [CC] in 4729 def "" : QuaternaryVRRdGeneric<mnemonic, opcode>; 4730 def : InstAlias<mnemonic#"\t$V1, $V2, $V3, $V4, $M5", 4731 (!cast<Instruction>(NAME) VR128:$V1, VR128:$V2, VR128:$V3, 4732 VR128:$V4, imm32zx4_timm:$M5, 0)>; 4733} 4734 4735class SideEffectQuaternaryRRFa<string mnemonic, bits<16> opcode, 4736 RegisterOperand cls1, RegisterOperand cls2, 4737 RegisterOperand cls3> 4738 : InstRRFa<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4), 4739 mnemonic#"\t$R1, $R2, $R3, $M4", []>; 4740 4741multiclass SideEffectQuaternaryRRFaOptOpt<string mnemonic, bits<16> opcode, 4742 RegisterOperand cls1, 4743 RegisterOperand cls2, 4744 RegisterOperand cls3> { 4745 def "" : SideEffectQuaternaryRRFa<mnemonic, opcode, cls1, cls2, cls3>; 4746 def Opt : SideEffectTernaryRRFa<mnemonic, opcode, cls1, cls2, cls3>; 4747 def OptOpt : SideEffectBinaryRRFa<mnemonic, opcode, cls1, cls2>; 4748} 4749 4750class SideEffectQuaternaryRRFb<string mnemonic, bits<16> opcode, 4751 RegisterOperand cls1, RegisterOperand cls2, 4752 RegisterOperand cls3> 4753 : InstRRFb<opcode, (outs), (ins cls1:$R1, cls2:$R2, cls3:$R3, imm32zx4:$M4), 4754 mnemonic#"\t$R1, $R3, $R2, $M4", []>; 4755 4756multiclass SideEffectQuaternaryRRFbOpt<string mnemonic, bits<16> opcode, 4757 RegisterOperand cls1, 4758 RegisterOperand cls2, 4759 RegisterOperand cls3> { 4760 def "" : SideEffectQuaternaryRRFb<mnemonic, opcode, cls1, cls2, cls3>; 4761 def Opt : SideEffectTernaryRRFb<mnemonic, opcode, cls1, cls2, cls3>; 4762} 4763 4764class SideEffectQuaternarySSe<string mnemonic, bits<8> opcode, 4765 RegisterOperand cls> 4766 : InstSSe<opcode, (outs), 4767 (ins cls:$R1, bdaddr12only:$BD2, cls:$R3, bdaddr12only:$BD4), 4768 mnemonic#"\t$R1, $BD2, $R3, $BD4", []>; 4769 4770class LoadAndOpRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4771 RegisterOperand cls, AddressingMode mode = bdaddr20only> 4772 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R3, mode:$BD2), 4773 mnemonic#"\t$R1, $R3, $BD2", 4774 [(set cls:$R1, (operator mode:$BD2, cls:$R3))]> { 4775 let mayLoad = 1; 4776 let mayStore = 1; 4777} 4778 4779class CmpSwapRRE<string mnemonic, bits<16> opcode, 4780 RegisterOperand cls1, RegisterOperand cls2> 4781 : InstRRE<opcode, (outs cls1:$R1), (ins cls1:$R1src, cls2:$R2), 4782 mnemonic#"\t$R1, $R2", []> { 4783 let Constraints = "$R1 = $R1src"; 4784 let DisableEncoding = "$R1src"; 4785 let mayLoad = 1; 4786 let mayStore = 1; 4787} 4788 4789class CmpSwapRS<string mnemonic, bits<8> opcode, SDPatternOperator operator, 4790 RegisterOperand cls, AddressingMode mode = bdaddr12only> 4791 : InstRSa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2), 4792 mnemonic#"\t$R1, $R3, $BD2", 4793 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> { 4794 let Constraints = "$R1 = $R1src"; 4795 let DisableEncoding = "$R1src"; 4796 let mayLoad = 1; 4797 let mayStore = 1; 4798} 4799 4800class CmpSwapRSY<string mnemonic, bits<16> opcode, SDPatternOperator operator, 4801 RegisterOperand cls, AddressingMode mode = bdaddr20only> 4802 : InstRSYa<opcode, (outs cls:$R1), (ins cls:$R1src, cls:$R3, mode:$BD2), 4803 mnemonic#"\t$R1, $R3, $BD2", 4804 [(set cls:$R1, (operator mode:$BD2, cls:$R1src, cls:$R3))]> { 4805 let Constraints = "$R1 = $R1src"; 4806 let DisableEncoding = "$R1src"; 4807 let mayLoad = 1; 4808 let mayStore = 1; 4809} 4810 4811multiclass CmpSwapRSPair<string mnemonic, bits<8> rsOpcode, bits<16> rsyOpcode, 4812 SDPatternOperator operator, RegisterOperand cls> { 4813 let DispKey = mnemonic # cls in { 4814 let DispSize = "12" in 4815 def "" : CmpSwapRS<mnemonic, rsOpcode, operator, cls, bdaddr12pair>; 4816 let DispSize = "20" in 4817 def Y : CmpSwapRSY<mnemonic#"y", rsyOpcode, operator, cls, bdaddr20pair>; 4818 } 4819} 4820 4821class RotateSelectRIEf<string mnemonic, bits<16> opcode, RegisterOperand cls1, 4822 RegisterOperand cls2> 4823 : InstRIEf<opcode, (outs cls1:$R1), 4824 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, 4825 imm32zx6:$I5), 4826 mnemonic#"\t$R1, $R2, $I3, $I4, $I5", []> { 4827 let Constraints = "$R1 = $R1src"; 4828 let DisableEncoding = "$R1src"; 4829} 4830 4831class PrefetchRXY<string mnemonic, bits<16> opcode, SDPatternOperator operator> 4832 : InstRXYb<opcode, (outs), (ins imm32zx4:$M1, bdxaddr20only:$XBD2), 4833 mnemonic#"\t$M1, $XBD2", 4834 [(operator imm32zx4_timm:$M1, bdxaddr20only:$XBD2)]>; 4835 4836class PrefetchRILPC<string mnemonic, bits<12> opcode, 4837 SDPatternOperator operator> 4838 : InstRILc<opcode, (outs), (ins imm32zx4_timm:$M1, pcrel32:$RI2), 4839 mnemonic#"\t$M1, $RI2", 4840 [(operator imm32zx4_timm:$M1, pcrel32:$RI2)]> { 4841 // We want PC-relative addresses to be tried ahead of BD and BDX addresses. 4842 // However, BDXs have two extra operands and are therefore 6 units more 4843 // complex. 4844 let AddedComplexity = 7; 4845} 4846 4847class BranchPreloadSMI<string mnemonic, bits<8> opcode> 4848 : InstSMI<opcode, (outs), 4849 (ins imm32zx4:$M1, brtarget16bpp:$RI2, bdxaddr12only:$BD3), 4850 mnemonic#"\t$M1, $RI2, $BD3", []>; 4851 4852class BranchPreloadMII<string mnemonic, bits<8> opcode> 4853 : InstMII<opcode, (outs), 4854 (ins imm32zx4:$M1, brtarget12bpp:$RI2, brtarget24bpp:$RI3), 4855 mnemonic#"\t$M1, $RI2, $RI3", []>; 4856 4857// A floating-point load-and test operation. Create both a normal unary 4858// operation and one that acts as a comparison against zero. 4859// Note that the comparison against zero operation is not available if we 4860// have vector support, since load-and-test instructions will partially 4861// clobber the target (vector) register. 4862multiclass LoadAndTestRRE<string mnemonic, bits<16> opcode, 4863 RegisterOperand cls> { 4864 def "" : UnaryRRE<mnemonic, opcode, null_frag, cls, cls>; 4865 let isCodeGenOnly = 1, Predicates = [FeatureNoVector] in 4866 def Compare : CompareRRE<mnemonic, opcode, null_frag, cls, cls>; 4867} 4868 4869//===----------------------------------------------------------------------===// 4870// Pseudo instructions 4871//===----------------------------------------------------------------------===// 4872// 4873// Convenience instructions that get lowered to real instructions 4874// by either SystemZTargetLowering::EmitInstrWithCustomInserter() 4875// or SystemZInstrInfo::expandPostRAPseudo(). 4876// 4877//===----------------------------------------------------------------------===// 4878 4879class Pseudo<dag outs, dag ins, list<dag> pattern> 4880 : InstSystemZ<0, outs, ins, "", pattern> { 4881 let isPseudo = 1; 4882 let isCodeGenOnly = 1; 4883} 4884 4885// Like UnaryRI, but expanded after RA depending on the choice of register. 4886class UnaryRIPseudo<SDPatternOperator operator, RegisterOperand cls, 4887 ImmOpWithPattern imm> 4888 : Pseudo<(outs cls:$R1), (ins imm:$I2), 4889 [(set cls:$R1, (operator imm:$I2))]>; 4890 4891// Like UnaryRXY, but expanded after RA depending on the choice of register. 4892class UnaryRXYPseudo<string key, SDPatternOperator operator, 4893 RegisterOperand cls, bits<5> bytes, 4894 AddressingMode mode = bdxaddr20only> 4895 : Pseudo<(outs cls:$R1), (ins mode:$XBD2), 4896 [(set cls:$R1, (operator mode:$XBD2))]> { 4897 let OpKey = key#"r"#cls; 4898 let OpType = "mem"; 4899 let mayLoad = 1; 4900 let Has20BitOffset = 1; 4901 let HasIndex = 1; 4902 let AccessBytes = bytes; 4903} 4904 4905// Like UnaryRR, but expanded after RA depending on the choice of registers. 4906class UnaryRRPseudo<string key, SDPatternOperator operator, 4907 RegisterOperand cls1, RegisterOperand cls2> 4908 : Pseudo<(outs cls1:$R1), (ins cls2:$R2), 4909 [(set cls1:$R1, (operator cls2:$R2))]> { 4910 let OpKey = key#cls1; 4911 let OpType = "reg"; 4912} 4913 4914// Like BinaryRI, but expanded after RA depending on the choice of register. 4915class BinaryRIPseudo<SDPatternOperator operator, RegisterOperand cls, 4916 ImmOpWithPattern imm> 4917 : Pseudo<(outs cls:$R1), (ins cls:$R1src, imm:$I2), 4918 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 4919 let Constraints = "$R1 = $R1src"; 4920} 4921 4922// Like BinaryRIE, but expanded after RA depending on the choice of register. 4923class BinaryRIEPseudo<SDPatternOperator operator, RegisterOperand cls, 4924 ImmOpWithPattern imm> 4925 : Pseudo<(outs cls:$R1), (ins cls:$R3, imm:$I2), 4926 [(set cls:$R1, (operator cls:$R3, imm:$I2))]>; 4927 4928// Like BinaryRIAndK, but expanded after RA depending on the choice of register. 4929multiclass BinaryRIAndKPseudo<string key, SDPatternOperator operator, 4930 RegisterOperand cls, ImmOpWithPattern imm> { 4931 let NumOpsKey = key in { 4932 let NumOpsValue = "3" in 4933 def K : BinaryRIEPseudo<operator, cls, imm>, 4934 Requires<[FeatureHighWord, FeatureDistinctOps]>; 4935 let NumOpsValue = "2" in 4936 def "" : BinaryRIPseudo<operator, cls, imm>, 4937 Requires<[FeatureHighWord]>; 4938 } 4939} 4940 4941// A pseudo that is used during register allocation when folding a memory 4942// operand. The 3-address register instruction with a spilled source cannot 4943// be converted directly to a target 2-address reg/mem instruction. 4944// Mapping: <INSN>R -> MemFoldPseudo -> <INSN> 4945class MemFoldPseudo<string mnemonic, RegisterOperand cls, bits<5> bytes, 4946 AddressingMode mode> 4947 : Pseudo<(outs cls:$R1), (ins cls:$R2, mode:$XBD2), []> { 4948 let OpKey = !subst("mscrk", "msrkc", 4949 !subst("msgcrk", "msgrkc", 4950 mnemonic#"rk"#cls)); 4951 let OpType = "mem"; 4952 let MemKey = mnemonic#cls; 4953 let MemType = "pseudo"; 4954 let mayLoad = 1; 4955 let AccessBytes = bytes; 4956 let HasIndex = 1; 4957 let hasNoSchedulingInfo = 1; 4958} 4959 4960// Same as MemFoldPseudo but for mapping a W... vector instruction 4961class MemFoldPseudo_FP<string mnemonic, RegisterOperand cls, bits<5> bytes, 4962 AddressingMode mode> 4963 : MemFoldPseudo<mnemonic, cls, bytes, mode> { 4964 let OpKey = mnemonic#"r"#"MemFold"#cls; 4965} 4966 4967class MemFoldPseudo_FPTern<string mnemonic, RegisterOperand cls, bits<5> bytes, 4968 AddressingMode mode> 4969 : Pseudo<(outs cls:$R1), (ins cls:$R2, cls:$R3, mode:$XBD2), []> { 4970 let OpKey = mnemonic#"r"#"MemFold"#cls; 4971 let OpType = "mem"; 4972 let MemKey = mnemonic#cls; 4973 let MemType = "pseudo"; 4974 let mayLoad = 1; 4975 let AccessBytes = bytes; 4976 let HasIndex = 1; 4977 let hasNoSchedulingInfo = 1; 4978} 4979 4980// Same as MemFoldPseudo but for Load On Condition with CC operands. 4981class MemFoldPseudo_CondMove<string mnemonic, RegisterOperand cls, bits<5> bytes, 4982 AddressingMode mode> 4983 : Pseudo<(outs cls:$R1), 4984 (ins cls:$R2, mode:$XBD2, cond4:$valid, cond4:$M3), []> { 4985 let OpKey = !subst("loc", "sel", mnemonic)#"r"#cls; 4986 let OpType = "mem"; 4987 let MemKey = mnemonic#cls; 4988 let MemType = "pseudo"; 4989 let mayLoad = 1; 4990 let AccessBytes = bytes; 4991 let hasNoSchedulingInfo = 1; 4992} 4993 4994// Like CompareRI, but expanded after RA depending on the choice of register. 4995class CompareRIPseudo<SDPatternOperator operator, RegisterOperand cls, 4996 ImmOpWithPattern imm> 4997 : Pseudo<(outs), (ins cls:$R1, imm:$I2), 4998 [(set CC, (operator cls:$R1, imm:$I2))]> { 4999 let isCompare = 1; 5000} 5001 5002// Like CompareRXY, but expanded after RA depending on the choice of register. 5003class CompareRXYPseudo<SDPatternOperator operator, RegisterOperand cls, 5004 SDPatternOperator load, bits<5> bytes, 5005 AddressingMode mode = bdxaddr20only> 5006 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2), 5007 [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> { 5008 let mayLoad = 1; 5009 let Has20BitOffset = 1; 5010 let HasIndex = 1; 5011 let AccessBytes = bytes; 5012} 5013 5014// Like TestBinarySIL, but expanded later. 5015class TestBinarySILPseudo<SDPatternOperator operator, ImmOpWithPattern imm> 5016 : Pseudo<(outs), (ins bdaddr12only:$BD1, imm:$I2), 5017 [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>; 5018 5019// Like CondBinaryRRF, but expanded after RA depending on the choice of 5020// register. 5021class CondBinaryRRFPseudo<string mnemonic, RegisterOperand cls1, 5022 RegisterOperand cls2> 5023 : Pseudo<(outs cls1:$R1), 5024 (ins cls1:$R1src, cls2:$R2, cond4:$valid, cond4:$M3), 5025 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls1:$R1src, 5026 cond4:$valid, cond4:$M3))]> { 5027 let Constraints = "$R1 = $R1src"; 5028 let DisableEncoding = "$R1src"; 5029 let CCMaskLast = 1; 5030 let NumOpsKey = !subst("loc", "sel", mnemonic); 5031 let NumOpsValue = "2"; 5032 let OpKey = mnemonic#cls1; 5033 let OpType = "reg"; 5034} 5035 5036// Like CondBinaryRRFa, but expanded after RA depending on the choice of 5037// register. 5038class CondBinaryRRFaPseudo<string mnemonic, RegisterOperand cls1, 5039 RegisterOperand cls2, RegisterOperand cls3> 5040 : Pseudo<(outs cls1:$R1), 5041 (ins cls3:$R3, cls2:$R2, cond4:$valid, cond4:$M4), 5042 [(set cls1:$R1, (z_select_ccmask cls2:$R2, cls3:$R3, 5043 cond4:$valid, cond4:$M4))]> { 5044 let CCMaskLast = 1; 5045 let NumOpsKey = mnemonic; 5046 let NumOpsValue = "3"; 5047 let OpKey = mnemonic#cls1; 5048 let OpType = "reg"; 5049} 5050 5051// Like CondBinaryRIE, but expanded after RA depending on the choice of 5052// register. 5053class CondBinaryRIEPseudo<RegisterOperand cls, ImmOpWithPattern imm> 5054 : Pseudo<(outs cls:$R1), 5055 (ins cls:$R1src, imm:$I2, cond4:$valid, cond4:$M3), 5056 [(set cls:$R1, (z_select_ccmask imm:$I2, cls:$R1src, 5057 cond4:$valid, cond4:$M3))]> { 5058 let Constraints = "$R1 = $R1src"; 5059 let DisableEncoding = "$R1src"; 5060 let CCMaskLast = 1; 5061} 5062 5063// Like CondUnaryRSY, but expanded after RA depending on the choice of 5064// register. 5065class CondUnaryRSYPseudo<string mnemonic, SDPatternOperator operator, 5066 RegisterOperand cls, bits<5> bytes, 5067 AddressingMode mode = bdaddr20only> 5068 : Pseudo<(outs cls:$R1), 5069 (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$R3), 5070 [(set cls:$R1, 5071 (z_select_ccmask (operator mode:$BD2), cls:$R1src, 5072 cond4:$valid, cond4:$R3))]> { 5073 let Constraints = "$R1 = $R1src"; 5074 let DisableEncoding = "$R1src"; 5075 let mayLoad = 1; 5076 let AccessBytes = bytes; 5077 let CCMaskLast = 1; 5078 let OpKey = mnemonic#"r"#cls; 5079 let OpType = "mem"; 5080 let MemKey = mnemonic#cls; 5081 let MemType = "target"; 5082} 5083 5084// Like CondStoreRSY, but expanded after RA depending on the choice of 5085// register. 5086class CondStoreRSYPseudo<RegisterOperand cls, bits<5> bytes, 5087 AddressingMode mode = bdaddr20only> 5088 : Pseudo<(outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$R3), []> { 5089 let mayStore = 1; 5090 let AccessBytes = bytes; 5091 let CCMaskLast = 1; 5092} 5093 5094// Like StoreRXY, but expanded after RA depending on the choice of register. 5095class StoreRXYPseudo<SDPatternOperator operator, RegisterOperand cls, 5096 bits<5> bytes, AddressingMode mode = bdxaddr20only> 5097 : Pseudo<(outs), (ins cls:$R1, mode:$XBD2), 5098 [(operator cls:$R1, mode:$XBD2)]> { 5099 let mayStore = 1; 5100 let Has20BitOffset = 1; 5101 let HasIndex = 1; 5102 let AccessBytes = bytes; 5103} 5104 5105// Like RotateSelectRIEf, but expanded after RA depending on the choice 5106// of registers. 5107class RotateSelectRIEfPseudo<RegisterOperand cls1, RegisterOperand cls2> 5108 : Pseudo<(outs cls1:$R1), 5109 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, 5110 imm32zx6:$I5), 5111 []> { 5112 let Constraints = "$R1 = $R1src"; 5113 let DisableEncoding = "$R1src"; 5114} 5115 5116// Implements "$dst = $cc & (8 >> CC) ? $src1 : $src2", where CC is 5117// the value of the PSW's 2-bit condition code field. 5118class SelectWrapper<ValueType vt, RegisterOperand cls> 5119 : Pseudo<(outs cls:$dst), 5120 (ins cls:$src1, cls:$src2, imm32zx4:$valid, imm32zx4:$cc), 5121 [(set (vt cls:$dst), (z_select_ccmask cls:$src1, cls:$src2, 5122 imm32zx4_timm:$valid, imm32zx4_timm:$cc))]> { 5123 let usesCustomInserter = 1; 5124 let hasNoSchedulingInfo = 1; 5125 let Uses = [CC]; 5126} 5127 5128// Stores $new to $addr if $cc is true ("" case) or false (Inv case). 5129multiclass CondStores<RegisterOperand cls, SDPatternOperator store, 5130 SDPatternOperator load, AddressingMode mode> { 5131 let Uses = [CC], usesCustomInserter = 1, hasNoSchedulingInfo = 1, 5132 mayLoad = 1, mayStore = 1 in { 5133 def "" : Pseudo<(outs), 5134 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc), 5135 [(store (z_select_ccmask cls:$new, (load mode:$addr), 5136 imm32zx4_timm:$valid, imm32zx4_timm:$cc), 5137 mode:$addr)]>; 5138 def Inv : Pseudo<(outs), 5139 (ins cls:$new, mode:$addr, imm32zx4:$valid, imm32zx4:$cc), 5140 [(store (z_select_ccmask (load mode:$addr), cls:$new, 5141 imm32zx4_timm:$valid, imm32zx4_timm:$cc), 5142 mode:$addr)]>; 5143 } 5144} 5145 5146// OPERATOR is ATOMIC_SWAP or an ATOMIC_LOAD_* operation. PAT and OPERAND 5147// describe the second (non-memory) operand. 5148class AtomicLoadBinary<SDPatternOperator operator, RegisterOperand cls, 5149 dag pat, DAGOperand operand> 5150 : Pseudo<(outs cls:$dst), (ins bdaddr20only:$ptr, operand:$src2), 5151 [(set cls:$dst, (operator bdaddr20only:$ptr, pat))]> { 5152 let Defs = [CC]; 5153 let Has20BitOffset = 1; 5154 let mayLoad = 1; 5155 let mayStore = 1; 5156 let usesCustomInserter = 1; 5157 let hasNoSchedulingInfo = 1; 5158} 5159 5160// Specializations of AtomicLoadWBinary. 5161class AtomicLoadBinaryReg32<SDPatternOperator operator> 5162 : AtomicLoadBinary<operator, GR32, (i32 GR32:$src2), GR32>; 5163class AtomicLoadBinaryImm32<SDPatternOperator operator, ImmOpWithPattern imm> 5164 : AtomicLoadBinary<operator, GR32, (i32 imm:$src2), imm>; 5165class AtomicLoadBinaryReg64<SDPatternOperator operator> 5166 : AtomicLoadBinary<operator, GR64, (i64 GR64:$src2), GR64>; 5167class AtomicLoadBinaryImm64<SDPatternOperator operator, ImmOpWithPattern imm> 5168 : AtomicLoadBinary<operator, GR64, (i64 imm:$src2), imm>; 5169 5170// OPERATOR is ATOMIC_SWAPW or an ATOMIC_LOADW_* operation. PAT and OPERAND 5171// describe the second (non-memory) operand. 5172class AtomicLoadWBinary<SDPatternOperator operator, dag pat, 5173 DAGOperand operand> 5174 : Pseudo<(outs GR32:$dst), 5175 (ins bdaddr20only:$ptr, operand:$src2, ADDR32:$bitshift, 5176 ADDR32:$negbitshift, uimm32:$bitsize), 5177 [(set GR32:$dst, (operator bdaddr20only:$ptr, pat, ADDR32:$bitshift, 5178 ADDR32:$negbitshift, uimm32:$bitsize))]> { 5179 let Defs = [CC]; 5180 let Has20BitOffset = 1; 5181 let mayLoad = 1; 5182 let mayStore = 1; 5183 let usesCustomInserter = 1; 5184 let hasNoSchedulingInfo = 1; 5185} 5186 5187// Specializations of AtomicLoadWBinary. 5188class AtomicLoadWBinaryReg<SDPatternOperator operator> 5189 : AtomicLoadWBinary<operator, (i32 GR32:$src2), GR32>; 5190class AtomicLoadWBinaryImm<SDPatternOperator operator, ImmOpWithPattern imm> 5191 : AtomicLoadWBinary<operator, (i32 imm:$src2), imm>; 5192 5193// A pseudo instruction that is a direct alias of a real instruction. 5194// These aliases are used in cases where a particular register operand is 5195// fixed or where the same instruction is used with different register sizes. 5196// The size parameter is the size in bytes of the associated real instruction. 5197class Alias<int size, dag outs, dag ins, list<dag> pattern> 5198 : InstSystemZ<size, outs, ins, "", pattern> { 5199 let isPseudo = 1; 5200 let isCodeGenOnly = 1; 5201} 5202 5203class UnaryAliasVRS<RegisterOperand cls1, RegisterOperand cls2> 5204 : Alias<6, (outs cls1:$src1), (ins cls2:$src2), []>; 5205 5206// An alias of a UnaryVRR*, but with different register sizes. 5207class UnaryAliasVRR<SDPatternOperator operator, TypedReg tr1, TypedReg tr2> 5208 : Alias<6, (outs tr1.op:$V1), (ins tr2.op:$V2), 5209 [(set (tr1.vt tr1.op:$V1), (operator (tr2.vt tr2.op:$V2)))]>; 5210 5211// An alias of a UnaryVRX, but with different register sizes. 5212class UnaryAliasVRX<SDPatternOperator operator, TypedReg tr, 5213 AddressingMode mode = bdxaddr12only> 5214 : Alias<6, (outs tr.op:$V1), (ins mode:$XBD2), 5215 [(set (tr.vt tr.op:$V1), (operator mode:$XBD2))]>; 5216 5217// An alias of a StoreVRX, but with different register sizes. 5218class StoreAliasVRX<SDPatternOperator operator, TypedReg tr, 5219 AddressingMode mode = bdxaddr12only> 5220 : Alias<6, (outs), (ins tr.op:$V1, mode:$XBD2), 5221 [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>; 5222 5223// An alias of a BinaryRI, but with different register sizes. 5224class BinaryAliasRI<SDPatternOperator operator, RegisterOperand cls, 5225 ImmOpWithPattern imm> 5226 : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 5227 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 5228 let Constraints = "$R1 = $R1src"; 5229} 5230 5231// An alias of a BinaryRIL, but with different register sizes. 5232class BinaryAliasRIL<SDPatternOperator operator, RegisterOperand cls, 5233 ImmOpWithPattern imm> 5234 : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2), 5235 [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { 5236 let Constraints = "$R1 = $R1src"; 5237} 5238 5239// An alias of a BinaryVRRf, but with different register sizes. 5240class BinaryAliasVRRf<RegisterOperand cls> 5241 : Alias<6, (outs VR128:$V1), (ins cls:$R2, cls:$R3), []>; 5242 5243// An alias of a CompareRI, but with different register sizes. 5244class CompareAliasRI<SDPatternOperator operator, RegisterOperand cls, 5245 ImmOpWithPattern imm> 5246 : Alias<4, (outs), (ins cls:$R1, imm:$I2), 5247 [(set CC, (operator cls:$R1, imm:$I2))]> { 5248 let isCompare = 1; 5249} 5250 5251// An alias of a RotateSelectRIEf, but with different register sizes. 5252class RotateSelectAliasRIEf<RegisterOperand cls1, RegisterOperand cls2> 5253 : Alias<6, (outs cls1:$R1), 5254 (ins cls1:$R1src, cls2:$R2, imm32zx8:$I3, imm32zx8:$I4, 5255 imm32zx6:$I5), []> { 5256 let Constraints = "$R1 = $R1src"; 5257} 5258 5259//===----------------------------------------------------------------------===// 5260// Multiclasses that emit both real and pseudo instructions 5261//===----------------------------------------------------------------------===// 5262 5263multiclass BinaryRXYAndPseudo<string mnemonic, bits<16> opcode, 5264 SDPatternOperator operator, RegisterOperand cls, 5265 SDPatternOperator load, bits<5> bytes, 5266 AddressingMode mode = bdxaddr20only> { 5267 def "" : BinaryRXY<mnemonic, opcode, operator, cls, load, bytes, mode> { 5268 let MemKey = mnemonic#cls; 5269 let MemType = "target"; 5270 } 5271 let Has20BitOffset = 1 in 5272 def _MemFoldPseudo : MemFoldPseudo<mnemonic, cls, bytes, mode>; 5273} 5274 5275multiclass BinaryRXPairAndPseudo<string mnemonic, bits<8> rxOpcode, 5276 bits<16> rxyOpcode, SDPatternOperator operator, 5277 RegisterOperand cls, 5278 SDPatternOperator load, bits<5> bytes> { 5279 let DispKey = mnemonic # cls in { 5280 def "" : BinaryRX<mnemonic, rxOpcode, operator, cls, load, bytes, 5281 bdxaddr12pair> { 5282 let DispSize = "12"; 5283 let MemKey = mnemonic#cls; 5284 let MemType = "target"; 5285 } 5286 let DispSize = "20" in 5287 def Y : BinaryRXY<mnemonic#"y", rxyOpcode, operator, cls, load, 5288 bytes, bdxaddr20pair>; 5289 } 5290 def _MemFoldPseudo : MemFoldPseudo<mnemonic, cls, bytes, bdxaddr12pair>; 5291} 5292 5293multiclass BinaryRXEAndPseudo<string mnemonic, bits<16> opcode, 5294 SDPatternOperator operator, RegisterOperand cls, 5295 SDPatternOperator load, bits<5> bytes> { 5296 def "" : BinaryRXE<mnemonic, opcode, operator, cls, load, bytes> { 5297 let MemKey = mnemonic#cls; 5298 let MemType = "target"; 5299 } 5300 def _MemFoldPseudo : MemFoldPseudo_FP<mnemonic, cls, bytes, bdxaddr12pair>; 5301} 5302 5303multiclass TernaryRXFAndPseudo<string mnemonic, bits<16> opcode, 5304 SDPatternOperator operator, RegisterOperand cls1, 5305 RegisterOperand cls2, SDPatternOperator load, 5306 bits<5> bytes> { 5307 def "" : TernaryRXF<mnemonic, opcode, operator, cls1, cls2, load, bytes> { 5308 let MemKey = mnemonic#cls1; 5309 let MemType = "target"; 5310 } 5311 def _MemFoldPseudo : MemFoldPseudo_FPTern<mnemonic, cls1, bytes, bdxaddr12pair>; 5312} 5313 5314multiclass CondUnaryRSYPairAndMemFold<string mnemonic, bits<16> opcode, 5315 SDPatternOperator operator, 5316 RegisterOperand cls, bits<5> bytes, 5317 AddressingMode mode = bdaddr20only> { 5318 defm "" : CondUnaryRSYPair<mnemonic, opcode, operator, cls, bytes, mode>; 5319 def _MemFoldPseudo : MemFoldPseudo_CondMove<mnemonic, cls, bytes, mode>; 5320} 5321 5322multiclass CondUnaryRSYPseudoAndMemFold<string mnemonic, 5323 SDPatternOperator operator, 5324 RegisterOperand cls, bits<5> bytes, 5325 AddressingMode mode = bdaddr20only> { 5326 def "" : CondUnaryRSYPseudo<mnemonic, operator, cls, bytes, mode>; 5327 def _MemFoldPseudo : MemFoldPseudo_CondMove<mnemonic, cls, bytes, mode>; 5328} 5329 5330// Define an instruction that operates on two fixed-length blocks of memory, 5331// and associated pseudo instructions for operating on blocks of any size. 5332// The Sequence form uses a straight-line sequence of instructions and 5333// the Loop form uses a loop of length-256 instructions followed by 5334// another instruction to handle the excess. 5335// The LoopVarLen form is for a loop with a non-constant length parameter. 5336multiclass MemorySS<string mnemonic, bits<8> opcode, 5337 SDPatternOperator sequence, SDPatternOperator loop> { 5338 def "" : SideEffectBinarySSa<mnemonic, opcode>; 5339 let usesCustomInserter = 1, hasNoSchedulingInfo = 1, Defs = [CC] in { 5340 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, 5341 imm64:$length), 5342 [(sequence bdaddr12only:$dest, bdaddr12only:$src, 5343 imm64:$length)]>; 5344 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, 5345 imm64:$length, GR64:$count256), 5346 [(loop bdaddr12only:$dest, bdaddr12only:$src, 5347 imm64:$length, GR64:$count256)]>; 5348 def LoopVarLen : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, 5349 GR64:$length, GR64:$count256), 5350 [(loop bdaddr12only:$dest, bdaddr12only:$src, 5351 GR64:$length, GR64:$count256)]>; 5352 } 5353} 5354 5355// The same, but setting a CC result as comparison operator. 5356multiclass CompareMemorySS<string mnemonic, bits<8> opcode, 5357 SDPatternOperator sequence, SDPatternOperator loop> { 5358 def "" : SideEffectBinarySSa<mnemonic, opcode>; 5359 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in { 5360 def Sequence : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, 5361 imm64:$length), 5362 [(set CC, (sequence bdaddr12only:$dest, bdaddr12only:$src, 5363 imm64:$length))]>; 5364 def Loop : Pseudo<(outs), (ins bdaddr12only:$dest, bdaddr12only:$src, 5365 imm64:$length, GR64:$count256), 5366 [(set CC, (loop bdaddr12only:$dest, bdaddr12only:$src, 5367 imm64:$length, GR64:$count256))]>; 5368 } 5369} 5370 5371// Define an instruction that operates on two strings, both terminated 5372// by the character in R0. The instruction processes a CPU-determinated 5373// number of bytes at a time and sets CC to 3 if the instruction needs 5374// to be repeated. Also define a pseudo instruction that represents 5375// the full loop (the main instruction plus the branch on CC==3). 5376multiclass StringRRE<string mnemonic, bits<16> opcode, 5377 SDPatternOperator operator> { 5378 let Uses = [R0L] in 5379 def "" : SideEffectBinaryMemMemRRE<mnemonic, opcode, GR64, GR64>; 5380 let usesCustomInserter = 1, hasNoSchedulingInfo = 1 in 5381 def Loop : Pseudo<(outs GR64:$end), 5382 (ins GR64:$start1, GR64:$start2, GR32:$char), 5383 [(set GR64:$end, (operator GR64:$start1, GR64:$start2, 5384 GR32:$char))]>; 5385} 5386