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