1// Copyright (c) 2018-2019 ARM Limited 2// All rights reserved 3// 4// The license below extends only to copyright in the software and shall 5// not be construed as granting a license to any other intellectual 6// property including but not limited to intellectual property relating 7// to a hardware implementation of the functionality of the software 8// licensed hereunder. You may use the software subject to the license 9// terms below provided that you ensure that this notice is replicated 10// unmodified and in its entirety in all distributions of the software, 11// modified or unmodified, in source code or in binary form. 12// 13// Redistribution and use in source and binary forms, with or without 14// modification, are permitted provided that the following conditions are 15// met: redistributions of source code must retain the above copyright 16// notice, this list of conditions and the following disclaimer; 17// redistributions in binary form must reproduce the above copyright 18// notice, this list of conditions and the following disclaimer in the 19// documentation and/or other materials provided with the distribution; 20// neither the name of the copyright holders nor the names of its 21// contributors may be used to endorse or promote products derived from 22// this software without specific prior written permission. 23// 24// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35// 36// Authors: Giacomo Gabrielli 37 38let {{ 39 sveEnabledCheckCode = ''' 40 if (FullSystem) { 41 fault = this->checkSveEnabled(xc->tcBase(), Cpsr, Cpacr64); 42 if (fault != NoFault) { 43 return fault; 44 } 45 } 46 ''' 47}}; 48 49def template SveWideningUnaryPredOpDeclare {{ 50template <class _SElement, class _DElement> 51class %(class_name)s : public %(base_class)s 52{ 53 protected: 54 typedef _SElement Element; 55 typedef _SElement SElement; 56 typedef _DElement DElement; 57 typedef _SElement TPSElem; 58 typedef _DElement TPDElem; 59 public: 60 // Constructor 61 %(class_name)s(ExtMachInst machInst, 62 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _gp) 63 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 64 _dest, _op1, _gp) 65 { 66 %(constructor)s; 67 } 68 69 Fault execute(ExecContext *, Trace::InstRecord *) const; 70}; 71}}; 72 73def template SveUnaryPredOpDeclare {{ 74template <class _Element> 75class %(class_name)s : public %(base_class)s 76{ 77 protected: 78 typedef _Element Element; 79 typedef _Element TPElem; 80 public: 81 // Constructor 82 %(class_name)s(ExtMachInst machInst, 83 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _gp) 84 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 85 _dest, _op1, _gp) 86 { 87 %(constructor)s; 88 } 89 90 Fault execute(ExecContext *, Trace::InstRecord *) const; 91}; 92}}; 93 94def template SveUnaryUnpredOpDeclare {{ 95template <class _Element> 96class %(class_name)s : public %(base_class)s 97{ 98 protected: 99 typedef _Element Element; 100 typedef _Element TPElem; 101 public: 102 // Constructor 103 %(class_name)s(ExtMachInst machInst, 104 IntRegIndex _dest, IntRegIndex _op1) 105 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 106 _dest, _op1) 107 { 108 %(constructor)s; 109 } 110 111 Fault execute(ExecContext *, Trace::InstRecord *) const; 112}; 113}}; 114 115def template SveShiftAndInsertOpDeclare {{ 116template <class _Element> 117class %(class_name)s : public %(base_class)s 118{ 119 protected: 120 typedef _Element Element; 121 typedef _Element TPElem; 122 public: 123 // Constructor 124 %(class_name)s(ExtMachInst machInst, 125 IntRegIndex _dest, IntRegIndex _op1) 126 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 127 _dest, _op1, %(isSimdFp)s) 128 { 129 %(constructor)s; 130 } 131 132 Fault execute(ExecContext *, Trace::InstRecord *) const; 133}; 134}}; 135 136def template SveWideImmUnpredOpDeclare {{ 137template <class _Element> 138class %(class_name)s : public %(base_class)s 139{ 140 protected: 141 typedef _Element Element; 142 typedef _Element TPElem; 143 public: 144 // Constructor 145 %(class_name)s(ExtMachInst machInst, 146 IntRegIndex _dest, uint64_t _imm) 147 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 148 _dest, _imm) 149 { 150 %(constructor)s; 151 } 152 153 Fault execute(ExecContext *, Trace::InstRecord *) const; 154}; 155}}; 156 157def template SveWideImmPredOpDeclare {{ 158template <class _Element> 159class %(class_name)s : public %(base_class)s 160{ 161 protected: 162 typedef _Element Element; 163 typedef _Element TPElem; 164 public: 165 // Constructor 166 %(class_name)s(ExtMachInst machInst, 167 IntRegIndex _dest, uint64_t _imm, IntRegIndex _gp, 168 bool _isMerging = true) 169 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 170 _dest, _imm, _gp, _isMerging) 171 { 172 %(constructor)s; 173 } 174 175 Fault execute(ExecContext *, Trace::InstRecord *) const; 176}; 177}}; 178 179def template SveBinImmUnpredOpDeclare {{ 180template <class _Element> 181class %(class_name)s : public %(base_class)s 182{ 183 protected: 184 typedef _Element Element; 185 typedef _Element TPElem; 186 public: 187 // Constructor 188 %(class_name)s(ExtMachInst machInst, 189 IntRegIndex _dest, IntRegIndex _op1, uint64_t _imm) 190 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 191 _dest, _op1, _imm) 192 { 193 %(constructor)s; 194 } 195 196 Fault execute(ExecContext *, Trace::InstRecord *) const; 197}; 198}}; 199 200def template SveBinImmPredOpDeclare {{ 201template <class _Element> 202class %(class_name)s : public %(base_class)s 203{ 204 protected: 205 typedef _Element Element; 206 typedef _Element TPElem; 207 public: 208 // Constructor 209 %(class_name)s(ExtMachInst machInst, 210 IntRegIndex _dest, uint64_t _imm, IntRegIndex _gp) 211 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 212 _dest, _imm, _gp) 213 { 214 %(constructor)s; 215 } 216 217 Fault execute(ExecContext *, Trace::InstRecord *) const; 218}; 219}}; 220 221def template SveBinDestrPredOpDeclare {{ 222template <class _Element> 223class %(class_name)s : public %(base_class)s 224{ 225 protected: 226 typedef _Element Element; 227 typedef _Element TPElem; 228 public: 229 // Constructor 230 %(class_name)s(ExtMachInst machInst, 231 IntRegIndex _dest, IntRegIndex _op2, IntRegIndex _gp) 232 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 233 _dest, _op2, _gp) 234 { 235 %(constructor)s; 236 } 237 238 Fault execute(ExecContext *, Trace::InstRecord *) const; 239}; 240}}; 241 242def template SveBinConstrPredOpDeclare {{ 243template <class _Element> 244class %(class_name)s : public %(base_class)s 245{ 246 protected: 247 typedef _Element Element; 248 typedef _Element TPElem; 249 public: 250 // Constructor 251 %(class_name)s(ExtMachInst machInst, 252 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, 253 IntRegIndex _gp, SvePredType _predType) 254 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 255 _dest, _op1, _op2, _gp, _predType) 256 { 257 %(constructor)s; 258 } 259 260 Fault execute(ExecContext *, Trace::InstRecord *) const; 261}; 262}}; 263 264def template SveBinUnpredOpDeclare {{ 265template <class _Element> 266class %(class_name)s : public %(base_class)s 267{ 268 protected: 269 typedef _Element Element; 270 typedef _Element TPElem; 271 public: 272 // Constructor 273 %(class_name)s(ExtMachInst machInst, 274 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2) 275 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 276 _dest, _op1, _op2) 277 { 278 %(constructor)s; 279 } 280 281 Fault execute(ExecContext *, Trace::InstRecord *) const; 282}; 283}}; 284 285def template SveBinIdxUnpredOpDeclare {{ 286template <class _Element> 287class %(class_name)s : public %(base_class)s 288{ 289 protected: 290 typedef _Element Element; 291 typedef _Element TPElem; 292 public: 293 // Constructor 294 %(class_name)s(ExtMachInst machInst, 295 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, 296 uint8_t _index) 297 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 298 _dest, _op1, _op2, _index) 299 { 300 %(constructor)s; 301 } 302 303 Fault execute(ExecContext *, Trace::InstRecord *) const; 304}; 305}}; 306 307def template SvePredLogicalOpDeclare {{ 308template <class _Element> 309class %(class_name)s : public %(base_class)s 310{ 311 protected: 312 typedef _Element Element; 313 typedef _Element TPElem; 314 public: 315 // Constructor 316 %(class_name)s(ExtMachInst machInst, 317 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, 318 IntRegIndex _gp, bool _isSel = false) 319 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 320 _dest, _op1, _op2, _gp, _isSel) 321 { 322 %(constructor)s; 323 } 324 325 Fault execute(ExecContext *, Trace::InstRecord *) const; 326}; 327}}; 328 329def template SveCmpOpDeclare {{ 330template <class _Element> 331class %(class_name)s : public %(base_class)s 332{ 333 protected: 334 typedef _Element Element; 335 typedef _Element TPElem; 336 public: 337 // Constructor 338 %(class_name)s(ExtMachInst machInst, 339 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, 340 IntRegIndex _gp) 341 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 342 _dest, _op1, _op2, _gp) 343 { 344 %(constructor)s; 345 } 346 347 Fault execute(ExecContext *, Trace::InstRecord *) const; 348}; 349}}; 350 351def template SveIntCmpOpDeclare {{ 352template <class _Element> 353class %(class_name)s : public %(base_class)s 354{ 355 protected: 356 typedef _Element Element; 357 typedef _Element TPElem; 358 public: 359 // Constructor 360 %(class_name)s(ExtMachInst machInst, 361 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, 362 IntRegIndex _gp) 363 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 364 _dest, _op1, _op2, _gp, %(op2IsWide)s) 365 { 366 %(constructor)s; 367 } 368 369 Fault execute(ExecContext *, Trace::InstRecord *) const; 370}; 371}}; 372 373def template SveCmpImmOpDeclare {{ 374template <class _Element> 375class %(class_name)s : public %(base_class)s 376{ 377 protected: 378 typedef _Element Element; 379 typedef _Element TPElem; 380 public: 381 // Constructor 382 %(class_name)s(ExtMachInst machInst, 383 IntRegIndex _dest, IntRegIndex _op1, uint64_t _imm, 384 IntRegIndex _gp) 385 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 386 _dest, _op1, _imm, _gp) 387 { 388 %(constructor)s; 389 } 390 391 Fault execute(ExecContext *, Trace::InstRecord *) const; 392}; 393}}; 394 395def template SveTerPredOpDeclare {{ 396template <class _Element> 397class %(class_name)s : public %(base_class)s 398{ 399 protected: 400 typedef _Element Element; 401 typedef _Element TPElem; 402 public: 403 // Constructor 404 %(class_name)s(ExtMachInst machInst, 405 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, 406 IntRegIndex _gp) 407 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 408 _dest, _op1, _op2, _gp) 409 { 410 %(constructor)s; 411 } 412 413 Fault execute(ExecContext *, Trace::InstRecord *) const; 414}; 415}}; 416 417def template SveTerImmUnpredOpDeclare {{ 418template <class _Element> 419class %(class_name)s : public %(base_class)s 420{ 421 protected: 422 typedef _Element Element; 423 typedef _Element TPElem; 424 public: 425 // Constructor 426 %(class_name)s(ExtMachInst machInst, 427 IntRegIndex _dest, IntRegIndex _op1, uint64_t _imm) 428 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 429 _dest, _op1, _imm) 430 { 431 %(constructor)s; 432 } 433 434 Fault execute(ExecContext *, Trace::InstRecord *) const; 435}; 436}}; 437 438def template SveReducOpDeclare {{ 439template <class _Element> 440class %(class_name)s : public %(base_class)s 441{ 442 protected: 443 typedef _Element Element; 444 typedef _Element TPElem; 445 public: 446 // Constructor 447 %(class_name)s(ExtMachInst machInst, 448 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _gp) 449 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 450 _dest, _op1, _gp) 451 { 452 %(constructor)s; 453 } 454 455 Fault execute(ExecContext *, Trace::InstRecord *) const; 456}; 457}}; 458 459def template SveWideningReducOpDeclare {{ 460template <class _SElement, class _DElement> 461class %(class_name)s : public %(base_class)s 462{ 463 protected: 464 typedef _SElement Element; 465 typedef _SElement SElement; 466 typedef _DElement DElement; 467 typedef _SElement TPSElem; 468 typedef _DElement TPDElem; 469 470 public: 471 // Constructor 472 %(class_name)s(ExtMachInst machInst, 473 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _gp) 474 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 475 _dest, _op1, _gp) 476 { 477 %(constructor)s; 478 } 479 480 Fault execute(ExecContext *, Trace::InstRecord *) const; 481}; 482}}; 483 484def template SveIndexIIOpDeclare {{ 485template <class _Element> 486class SveIndexII : public SveIndexIIOp 487{ 488 protected: 489 typedef _Element Element; 490 typedef _Element TPElem; 491 public: 492 // Constructor 493 SveIndexII(ExtMachInst machInst, 494 IntRegIndex _dest, int8_t _imm1, int8_t _imm2) 495 : SveIndexIIOp("%(mnemonic)s", machInst, %(op_class)s, 496 _dest, _imm1, _imm2) 497 { 498 %(constructor)s; 499 } 500 501 Fault execute(ExecContext *, Trace::InstRecord *) const; 502}; 503}}; 504 505def template SveIndexIROpDeclare {{ 506template <class _Element> 507class SveIndexIR : public SveIndexIROp 508{ 509 protected: 510 typedef _Element Element; 511 typedef _Element TPElem; 512 public: 513 // Constructor 514 SveIndexIR(ExtMachInst machInst, 515 IntRegIndex _dest, int8_t _imm, IntRegIndex _op) 516 : SveIndexIROp("%(mnemonic)s", machInst, %(op_class)s, 517 _dest, _imm, _op) 518 { 519 %(constructor)s; 520 } 521 522 Fault execute(ExecContext *, Trace::InstRecord *) const; 523}; 524}}; 525 526def template SveIndexRIOpDeclare {{ 527template <class _Element> 528class SveIndexRI : public SveIndexRIOp 529{ 530 protected: 531 typedef _Element Element; 532 typedef _Element TPElem; 533 public: 534 // Constructor 535 SveIndexRI(ExtMachInst machInst, 536 IntRegIndex _dest, IntRegIndex _op, int8_t _imm) 537 : SveIndexRIOp("%(mnemonic)s", machInst, %(op_class)s, 538 _dest, _op, _imm) 539 { 540 %(constructor)s; 541 } 542 543 Fault execute(ExecContext *, Trace::InstRecord *) const; 544}; 545}}; 546 547def template SveIndexRROpDeclare {{ 548template <class _Element> 549class SveIndexRR : public SveIndexRROp 550{ 551 protected: 552 typedef _Element Element; 553 typedef _Element TPElem; 554 public: 555 // Constructor 556 SveIndexRR(ExtMachInst machInst, 557 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2) 558 : SveIndexRROp("%(mnemonic)s", machInst, %(op_class)s, 559 _dest, _op1, _op2) 560 { 561 %(constructor)s; 562 } 563 564 Fault execute(ExecContext *, Trace::InstRecord *) const; 565}; 566}}; 567 568def template SvePredCountOpDeclare {{ 569template <class _Element> 570class %(class_name)s : public %(base_class)s 571{ 572 protected: 573 typedef _Element Element; 574 typedef _Element TPElem; 575 public: 576 %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, 577 IntRegIndex _op1) 578 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 579 _dest, _op1, %(srcIs32b)s, %(destIsVec)s) 580 { 581 %(constructor)s; 582 } 583 584 Fault execute(ExecContext *, Trace::InstRecord *) const; 585}; 586}}; 587 588def template SvePredCountPredOpDeclare {{ 589template <class _Element> 590class %(class_name)s : public %(base_class)s 591{ 592 protected: 593 typedef _Element Element; 594 typedef _Element TPElem; 595 public: 596 %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, 597 IntRegIndex _op1, IntRegIndex _gp) 598 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 599 _dest, _op1, _gp) 600 { 601 %(constructor)s; 602 } 603 604 Fault execute(ExecContext *, Trace::InstRecord *) const; 605}; 606 607}}; 608 609def template SvePtrueOpDeclare {{ 610template <class _Element> 611class %(class_name)s : public %(base_class)s 612{ 613 protected: 614 typedef _Element Element; 615 typedef _Element TPElem; 616 public: 617 // Constructor 618 %(class_name)s(ExtMachInst machInst, 619 IntRegIndex _dest, uint8_t _imm) 620 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 621 _dest, _imm) 622 { 623 %(constructor)s; 624 } 625 626 Fault execute(ExecContext *, Trace::InstRecord *) const; 627}; 628}}; 629 630def template SveAdrOpDeclare {{ 631template <class _Element> 632class %(class_name)s : public %(base_class)s 633{ 634 protected: 635 typedef _Element Element; 636 typedef _Element TPElem; 637 public: 638 // Constructor 639 %(class_name)s(ExtMachInst machInst, 640 IntRegIndex _dest, IntRegIndex _base, IntRegIndex _offset, 641 uint8_t _mult, SveAdrOffsetFormat _offsetFormat) 642 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 643 _dest, _base, _offset, _mult, _offsetFormat) 644 { 645 %(constructor)s; 646 } 647 648 Fault execute(ExecContext *, Trace::InstRecord *) const; 649}; 650}}; 651 652def template SveWhileOpDeclare {{ 653template <class _Element> 654class %(class_name)s : public %(base_class)s 655{ 656 protected: 657 typedef _Element Element; 658 typedef _Element TPElem; 659 public: 660 %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, 661 IntRegIndex _op1, IntRegIndex _op2) 662 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 663 _dest, _op1, _op2, %(srcIs32b)s) 664 { 665 %(constructor)s; 666 } 667 668 Fault execute(ExecContext *, Trace::InstRecord *) const; 669}; 670}}; 671 672def template SveCompTermOpDeclare {{ 673template <class _Element> 674class %(class_name)s : public %(base_class)s 675{ 676 protected: 677 typedef _Element Element; 678 typedef _Element TPElem; 679 public: 680 %(class_name)s(ExtMachInst machInst, IntRegIndex _op1, IntRegIndex _op2) 681 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _op1, _op2) 682 { 683 %(constructor)s; 684 } 685 686 Fault execute(ExecContext *, Trace::InstRecord *) const; 687}; 688}}; 689 690def template SveIntCmpImmOpDeclare {{ 691template <class _Element> 692class %(class_name)s : public %(base_class)s 693{ 694 protected: 695 typedef _Element Element; 696 typedef _Element TPElem; 697 public: 698 %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, IntRegIndex _op1, 699 int64_t _op2, IntRegIndex _gp) 700 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest, _op1, 701 _op2, _gp) 702 { 703 %(constructor)s; 704 } 705 706 Fault execute(ExecContext *, Trace::InstRecord *) const; 707}; 708}}; 709 710def template SveElemCountOpDeclare {{ 711template <class _Element> 712class %(class_name)s : public %(base_class)s 713{ 714 protected: 715 typedef _Element Element; 716 typedef _Element TPElem; 717 public: 718 %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, 719 uint8_t _pattern, uint8_t _imm) 720 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest, 721 _pattern, _imm, %(dstIsVec)s, %(dstIs32b)s) 722 { 723 %(constructor)s; 724 esize = sizeof(Element); 725 } 726 727 Fault execute(ExecContext *, Trace::InstRecord *) const; 728}; 729}}; 730 731def template SvePartBrkOpDeclare {{ 732class %(class_name)s : public %(base_class)s 733{ 734 public: 735 %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, IntRegIndex _gp, 736 IntRegIndex _op1) 737 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest, 738 _gp, _op1, %(isMerging)s) 739 { 740 %(constructor)s; 741 } 742 743 Fault execute(ExecContext *, Trace::InstRecord *) const; 744}; 745}}; 746 747def template SvePartBrkPropOpDeclare {{ 748// XXX: Might be done with SveTerPredOpDeclare and 749// instantiating with uint8_t 750class %(class_name)s : public %(base_class)s 751{ 752 public: 753 %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, 754 IntRegIndex _op1, IntRegIndex _op2, IntRegIndex _gp) 755 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest, 756 _op1, _op2, _gp) 757 { 758 %(constructor)s; 759 } 760 761 Fault execute(ExecContext *, Trace::InstRecord *) const; 762}; 763}}; 764 765def template SveSelectOpDeclare {{ 766template <class _Element> 767class %(class_name)s : public %(base_class)s 768{ 769 protected: 770 typedef _Element Element; 771 typedef _Element TPElem; 772 public: 773 %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, 774 IntRegIndex _op1, IntRegIndex _gp) 775 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest, 776 _op1, _gp, %(isCond)s, %(isScalar)s, %(isSimdFp)s) 777 { 778 %(constructor)s; 779 scalar_width = (sizeof(Element) == 8) ? 64 : 32; 780 } 781 782 Fault execute(ExecContext *, Trace::InstRecord *) const; 783}; 784}}; 785 786def template SveUnpackOpDeclare {{ 787template <class _SElement, class _DElement> 788class %(class_name)s : public %(base_class)s 789{ 790 protected: 791 typedef _SElement Element; 792 typedef _SElement SElement; 793 typedef _DElement DElement; 794 typedef _SElement TPSElem; 795 typedef _DElement TPDElem; 796 public: 797 %(class_name)s(ExtMachInst machInst, 798 IntRegIndex _dest, IntRegIndex _op1) 799 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 800 _dest, _op1) 801 { 802 %(constructor)s; 803 } 804 805 Fault execute(ExecContext *, Trace::InstRecord *) const; 806}; 807}}; 808 809def template SvePredicateTestOpDeclare {{ 810class %(class_name)s : public %(base_class)s 811{ 812 public: 813 %(class_name)s(ExtMachInst machInst, IntRegIndex _op1, IntRegIndex _gp) 814 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _op1, _gp) 815 { 816 %(constructor)s; 817 } 818 819 Fault execute(ExecContext *, Trace::InstRecord *) const; 820}; 821}}; 822 823def template SvePredUnaryOpWImplicitSrcDeclare {{ 824class %(class_name)s : public %(base_class)s 825{ 826 public: 827 %(class_name)s(ExtMachInst machInst, IntRegIndex _dest) 828 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest) 829 { 830 %(constructor)s; 831 } 832 833 Fault execute(ExecContext *, Trace::InstRecord *) const; 834}; 835}}; 836 837def template SvePredUnaryPredOpWImplicitSrcDeclare {{ 838class %(class_name)s : public %(base_class)s 839{ 840 public: 841 %(class_name)s(ExtMachInst machInst, IntRegIndex _dest, IntRegIndex _gp) 842 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _dest, _gp) 843 { 844 %(constructor)s; 845 } 846 847 Fault execute(ExecContext *, Trace::InstRecord *) const; 848}; 849}}; 850 851def template SvePredUnaryOpWImplicitDstDeclare {{ 852class %(class_name)s : public %(base_class)s 853{ 854 public: 855 %(class_name)s(ExtMachInst machInst, IntRegIndex _op1) 856 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, _op1) 857 { 858 %(constructor)s; 859 } 860 861 Fault execute(ExecContext *, Trace::InstRecord *) const; 862}; 863}}; 864 865def template SveOpWImplicitSrcDstDeclare {{ 866class %(class_name)s : public %(base_class)s 867{ 868 public: 869 %(class_name)s(ExtMachInst machInst) 870 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s) 871 { 872 %(constructor)s; 873 } 874 875 Fault execute(ExecContext *, Trace::InstRecord *) const; 876}; 877}}; 878 879def template SveWideningTerImmOpDeclare {{ 880template <class _SElement, class _DElement> 881class %(class_name)s : public %(base_class)s 882{ 883 protected: 884 typedef _DElement Element; 885 typedef _SElement SElement; 886 typedef _DElement DElement; 887 typedef _SElement TPSElem; 888 typedef _DElement TPDElem; 889 890 public: 891 %(class_name)s(ExtMachInst machInst, 892 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, 893 uint64_t _imm) 894 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 895 _dest, _op1, _op2, _imm) 896 { 897 %(constructor)s; 898 esize = sizeof(Element); 899 } 900 901 Fault execute(ExecContext *, Trace::InstRecord *) const; 902}; 903}}; 904 905def template SveWideningTerOpDeclare {{ 906template <class _SElement, class _DElement> 907class %(class_name)s : public %(base_class)s 908{ 909 protected: 910 typedef _DElement Element; 911 typedef _SElement SElement; 912 typedef _DElement DElement; 913 typedef _SElement TPSElem; 914 typedef _DElement TPDElem; 915 916 public: 917 %(class_name)s(ExtMachInst machInst, 918 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2) 919 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 920 _dest, _op1, _op2) 921 { 922 %(constructor)s; 923 esize = sizeof(Element); 924 } 925 926 Fault execute(ExecContext *, Trace::InstRecord *) const; 927}; 928}}; 929 930def template SveComplexOpDeclare {{ 931template <class _Element> 932class %(class_name)s : public %(base_class)s 933{ 934 protected: 935 typedef _Element Element; 936 typedef _Element TPElem; 937 public: 938 // Constructor 939 %(class_name)s(ExtMachInst machInst, 940 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, 941 IntRegIndex _gp, uint8_t _rot) 942 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 943 _dest, _op1, _op2, _gp, _rot) 944 { 945 %(constructor)s; 946 } 947 948 Fault execute(ExecContext *, Trace::InstRecord *) const; 949}; 950}}; 951 952def template SveComplexIndexOpDeclare {{ 953template <class _Element> 954class %(class_name)s : public %(base_class)s 955{ 956 protected: 957 typedef _Element Element; 958 typedef _Element TPElem; 959 public: 960 // Constructor 961 %(class_name)s(ExtMachInst machInst, 962 IntRegIndex _dest, IntRegIndex _op1, IntRegIndex _op2, 963 uint8_t _rot, uint8_t _imm) 964 : %(base_class)s("%(mnemonic)s", machInst, %(op_class)s, 965 _dest, _op1, _op2, _rot, _imm) 966 { 967 %(constructor)s; 968 } 969 970 Fault execute(ExecContext *, Trace::InstRecord *) const; 971}; 972}}; 973 974def template SveWideningOpExecute {{ 975 template <class SElement, class DElement> 976 Fault %(class_name)s<SElement, DElement>::execute(ExecContext *xc, 977 Trace::InstRecord *traceData) const 978 { 979 Fault fault = NoFault; 980 %(op_decl)s; 981 %(op_rd)s; 982 983 %(code)s; 984 if (fault == NoFault) 985 { 986 %(op_wb)s; 987 } 988 989 return fault; 990 } 991}}; 992 993def template SveNonTemplatedOpExecute {{ 994 Fault %(class_name)s::execute(ExecContext *xc, 995 Trace::InstRecord *traceData) const 996 { 997 Fault fault = NoFault; 998 %(op_decl)s; 999 %(op_rd)s; 1000 1001 %(code)s; 1002 if (fault == NoFault) 1003 { 1004 %(op_wb)s; 1005 } 1006 1007 return fault; 1008 } 1009}}; 1010 1011def template SveOpExecute {{ 1012 template <class Element> 1013 Fault %(class_name)s<Element>::execute(ExecContext *xc, 1014 Trace::InstRecord *traceData) const 1015 { 1016 Fault fault = NoFault; 1017 %(op_decl)s; 1018 %(op_rd)s; 1019 1020 %(code)s; 1021 if (fault == NoFault) 1022 { 1023 %(op_wb)s; 1024 } 1025 1026 return fault; 1027 } 1028}}; 1029 1030def template SveOpExecDeclare {{ 1031 template 1032 Fault %(class_name)s<%(targs)s>::execute( 1033 ExecContext *, Trace::InstRecord *) const; 1034}}; 1035