2 * QEMU RISC-V Disassembler
4 * Copyright (c) 2016-2017 Michael Clark <michaeljclark@mac.com>
5 * Copyright (c) 2017-2018 SiFive, Inc.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2 or later, as published by the Free Software Foundation.
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "qemu/osdep.h"
21 #include "disas/dis-asm.h"
22 #include "target/riscv/cpu_cfg.h"
23 #include "disas/riscv.h"
25 /* Vendor extensions */
26 #include "disas/riscv-xventana.h"
29 /* 0 is reserved for rv_op_illegal. */
113 rv_op_amoswap_w
= 84,
120 rv_op_amominu_w
= 91,
121 rv_op_amomaxu_w
= 92,
124 rv_op_amoswap_d
= 95,
129 rv_op_amomin_d
= 100,
130 rv_op_amomax_d
= 101,
131 rv_op_amominu_d
= 102,
132 rv_op_amomaxu_d
= 103,
135 rv_op_amoswap_q
= 106,
136 rv_op_amoadd_q
= 107,
137 rv_op_amoxor_q
= 108,
139 rv_op_amoand_q
= 110,
140 rv_op_amomin_q
= 111,
141 rv_op_amomax_q
= 112,
142 rv_op_amominu_q
= 113,
143 rv_op_amomaxu_q
= 114,
151 rv_op_sfence_vm
= 122,
152 rv_op_sfence_vma
= 123,
164 rv_op_fnmsub_s
= 135,
165 rv_op_fnmadd_s
= 136,
171 rv_op_fsgnjn_s
= 142,
172 rv_op_fsgnjx_s
= 143,
179 rv_op_fcvt_w_s
= 150,
180 rv_op_fcvt_wu_s
= 151,
181 rv_op_fcvt_s_w
= 152,
182 rv_op_fcvt_s_wu
= 153,
184 rv_op_fclass_s
= 155,
186 rv_op_fcvt_l_s
= 157,
187 rv_op_fcvt_lu_s
= 158,
188 rv_op_fcvt_s_l
= 159,
189 rv_op_fcvt_s_lu
= 160,
194 rv_op_fnmsub_d
= 165,
195 rv_op_fnmadd_d
= 166,
201 rv_op_fsgnjn_d
= 172,
202 rv_op_fsgnjx_d
= 173,
205 rv_op_fcvt_s_d
= 176,
206 rv_op_fcvt_d_s
= 177,
211 rv_op_fcvt_w_d
= 182,
212 rv_op_fcvt_wu_d
= 183,
213 rv_op_fcvt_d_w
= 184,
214 rv_op_fcvt_d_wu
= 185,
215 rv_op_fclass_d
= 186,
216 rv_op_fcvt_l_d
= 187,
217 rv_op_fcvt_lu_d
= 188,
219 rv_op_fcvt_d_l
= 190,
220 rv_op_fcvt_d_lu
= 191,
226 rv_op_fnmsub_q
= 197,
227 rv_op_fnmadd_q
= 198,
233 rv_op_fsgnjn_q
= 204,
234 rv_op_fsgnjx_q
= 205,
237 rv_op_fcvt_s_q
= 208,
238 rv_op_fcvt_q_s
= 209,
239 rv_op_fcvt_d_q
= 210,
240 rv_op_fcvt_q_d
= 211,
245 rv_op_fcvt_w_q
= 216,
246 rv_op_fcvt_wu_q
= 217,
247 rv_op_fcvt_q_w
= 218,
248 rv_op_fcvt_q_wu
= 219,
249 rv_op_fclass_q
= 220,
250 rv_op_fcvt_l_q
= 221,
251 rv_op_fcvt_lu_q
= 222,
252 rv_op_fcvt_q_l
= 223,
253 rv_op_fcvt_q_lu
= 224,
256 rv_op_c_addi4spn
= 227,
267 rv_op_c_addi16sp
= 238,
287 rv_op_c_ebreak
= 258,
336 rv_op_rdinstret
= 307,
337 rv_op_rdcycleh
= 308,
339 rv_op_rdinstreth
= 310,
347 rv_op_fsflagsi
= 318,
366 rv_op_sh1add_uw
= 337,
367 rv_op_sh2add_uw
= 338,
368 rv_op_sh3add_uw
= 339,
391 rv_op_aes32esmi
= 362,
392 rv_op_aes32esi
= 363,
393 rv_op_aes32dsmi
= 364,
394 rv_op_aes32dsi
= 365,
395 rv_op_aes64ks1i
= 366,
396 rv_op_aes64ks2
= 367,
398 rv_op_aes64esm
= 369,
400 rv_op_aes64dsm
= 371,
402 rv_op_sha256sig0
= 373,
403 rv_op_sha256sig1
= 374,
404 rv_op_sha256sum0
= 375,
405 rv_op_sha256sum1
= 376,
406 rv_op_sha512sig0
= 377,
407 rv_op_sha512sig1
= 378,
408 rv_op_sha512sum0
= 379,
409 rv_op_sha512sum1
= 380,
410 rv_op_sha512sum0r
= 381,
411 rv_op_sha512sum1r
= 382,
412 rv_op_sha512sig0l
= 383,
413 rv_op_sha512sig0h
= 384,
414 rv_op_sha512sig1l
= 385,
415 rv_op_sha512sig1h
= 386,
439 rv_op_vlse16_v
= 410,
440 rv_op_vlse32_v
= 411,
441 rv_op_vlse64_v
= 412,
443 rv_op_vsse16_v
= 414,
444 rv_op_vsse32_v
= 415,
445 rv_op_vsse64_v
= 416,
446 rv_op_vluxei8_v
= 417,
447 rv_op_vluxei16_v
= 418,
448 rv_op_vluxei32_v
= 419,
449 rv_op_vluxei64_v
= 420,
450 rv_op_vloxei8_v
= 421,
451 rv_op_vloxei16_v
= 422,
452 rv_op_vloxei32_v
= 423,
453 rv_op_vloxei64_v
= 424,
454 rv_op_vsuxei8_v
= 425,
455 rv_op_vsuxei16_v
= 426,
456 rv_op_vsuxei32_v
= 427,
457 rv_op_vsuxei64_v
= 428,
458 rv_op_vsoxei8_v
= 429,
459 rv_op_vsoxei16_v
= 430,
460 rv_op_vsoxei32_v
= 431,
461 rv_op_vsoxei64_v
= 432,
462 rv_op_vle8ff_v
= 433,
463 rv_op_vle16ff_v
= 434,
464 rv_op_vle32ff_v
= 435,
465 rv_op_vle64ff_v
= 436,
466 rv_op_vl1re8_v
= 437,
467 rv_op_vl1re16_v
= 438,
468 rv_op_vl1re32_v
= 439,
469 rv_op_vl1re64_v
= 440,
470 rv_op_vl2re8_v
= 441,
471 rv_op_vl2re16_v
= 442,
472 rv_op_vl2re32_v
= 443,
473 rv_op_vl2re64_v
= 444,
474 rv_op_vl4re8_v
= 445,
475 rv_op_vl4re16_v
= 446,
476 rv_op_vl4re32_v
= 447,
477 rv_op_vl4re64_v
= 448,
478 rv_op_vl8re8_v
= 449,
479 rv_op_vl8re16_v
= 450,
480 rv_op_vl8re32_v
= 451,
481 rv_op_vl8re64_v
= 452,
491 rv_op_vrsub_vx
= 462,
492 rv_op_vrsub_vi
= 463,
493 rv_op_vwaddu_vv
= 464,
494 rv_op_vwaddu_vx
= 465,
495 rv_op_vwadd_vv
= 466,
496 rv_op_vwadd_vx
= 467,
497 rv_op_vwsubu_vv
= 468,
498 rv_op_vwsubu_vx
= 469,
499 rv_op_vwsub_vv
= 470,
500 rv_op_vwsub_vx
= 471,
501 rv_op_vwaddu_wv
= 472,
502 rv_op_vwaddu_wx
= 473,
503 rv_op_vwadd_wv
= 474,
504 rv_op_vwadd_wx
= 475,
505 rv_op_vwsubu_wv
= 476,
506 rv_op_vwsubu_wx
= 477,
507 rv_op_vwsub_wv
= 478,
508 rv_op_vwsub_wx
= 479,
509 rv_op_vadc_vvm
= 480,
510 rv_op_vadc_vxm
= 481,
511 rv_op_vadc_vim
= 482,
512 rv_op_vmadc_vvm
= 483,
513 rv_op_vmadc_vxm
= 484,
514 rv_op_vmadc_vim
= 485,
515 rv_op_vsbc_vvm
= 486,
516 rv_op_vsbc_vxm
= 487,
517 rv_op_vmsbc_vvm
= 488,
518 rv_op_vmsbc_vxm
= 489,
537 rv_op_vnsrl_wv
= 508,
538 rv_op_vnsrl_wx
= 509,
539 rv_op_vnsrl_wi
= 510,
540 rv_op_vnsra_wv
= 511,
541 rv_op_vnsra_wx
= 512,
542 rv_op_vnsra_wi
= 513,
543 rv_op_vmseq_vv
= 514,
544 rv_op_vmseq_vx
= 515,
545 rv_op_vmseq_vi
= 516,
546 rv_op_vmsne_vv
= 517,
547 rv_op_vmsne_vx
= 518,
548 rv_op_vmsne_vi
= 519,
549 rv_op_vmsltu_vv
= 520,
550 rv_op_vmsltu_vx
= 521,
551 rv_op_vmslt_vv
= 522,
552 rv_op_vmslt_vx
= 523,
553 rv_op_vmsleu_vv
= 524,
554 rv_op_vmsleu_vx
= 525,
555 rv_op_vmsleu_vi
= 526,
556 rv_op_vmsle_vv
= 527,
557 rv_op_vmsle_vx
= 528,
558 rv_op_vmsle_vi
= 529,
559 rv_op_vmsgtu_vx
= 530,
560 rv_op_vmsgtu_vi
= 531,
561 rv_op_vmsgt_vx
= 532,
562 rv_op_vmsgt_vi
= 533,
563 rv_op_vminu_vv
= 534,
564 rv_op_vminu_vx
= 535,
567 rv_op_vmaxu_vv
= 538,
568 rv_op_vmaxu_vx
= 539,
573 rv_op_vmulh_vv
= 544,
574 rv_op_vmulh_vx
= 545,
575 rv_op_vmulhu_vv
= 546,
576 rv_op_vmulhu_vx
= 547,
577 rv_op_vmulhsu_vv
= 548,
578 rv_op_vmulhsu_vx
= 549,
579 rv_op_vdivu_vv
= 550,
580 rv_op_vdivu_vx
= 551,
583 rv_op_vremu_vv
= 554,
584 rv_op_vremu_vx
= 555,
587 rv_op_vwmulu_vv
= 558,
588 rv_op_vwmulu_vx
= 559,
589 rv_op_vwmulsu_vv
= 560,
590 rv_op_vwmulsu_vx
= 561,
591 rv_op_vwmul_vv
= 562,
592 rv_op_vwmul_vx
= 563,
593 rv_op_vmacc_vv
= 564,
594 rv_op_vmacc_vx
= 565,
595 rv_op_vnmsac_vv
= 566,
596 rv_op_vnmsac_vx
= 567,
597 rv_op_vmadd_vv
= 568,
598 rv_op_vmadd_vx
= 569,
599 rv_op_vnmsub_vv
= 570,
600 rv_op_vnmsub_vx
= 571,
601 rv_op_vwmaccu_vv
= 572,
602 rv_op_vwmaccu_vx
= 573,
603 rv_op_vwmacc_vv
= 574,
604 rv_op_vwmacc_vx
= 575,
605 rv_op_vwmaccsu_vv
= 576,
606 rv_op_vwmaccsu_vx
= 577,
607 rv_op_vwmaccus_vx
= 578,
611 rv_op_vmerge_vvm
= 582,
612 rv_op_vmerge_vxm
= 583,
613 rv_op_vmerge_vim
= 584,
614 rv_op_vsaddu_vv
= 585,
615 rv_op_vsaddu_vx
= 586,
616 rv_op_vsaddu_vi
= 587,
617 rv_op_vsadd_vv
= 588,
618 rv_op_vsadd_vx
= 589,
619 rv_op_vsadd_vi
= 590,
620 rv_op_vssubu_vv
= 591,
621 rv_op_vssubu_vx
= 592,
622 rv_op_vssub_vv
= 593,
623 rv_op_vssub_vx
= 594,
624 rv_op_vaadd_vv
= 595,
625 rv_op_vaadd_vx
= 596,
626 rv_op_vaaddu_vv
= 597,
627 rv_op_vaaddu_vx
= 598,
628 rv_op_vasub_vv
= 599,
629 rv_op_vasub_vx
= 600,
630 rv_op_vasubu_vv
= 601,
631 rv_op_vasubu_vx
= 602,
632 rv_op_vsmul_vv
= 603,
633 rv_op_vsmul_vx
= 604,
634 rv_op_vssrl_vv
= 605,
635 rv_op_vssrl_vx
= 606,
636 rv_op_vssrl_vi
= 607,
637 rv_op_vssra_vv
= 608,
638 rv_op_vssra_vx
= 609,
639 rv_op_vssra_vi
= 610,
640 rv_op_vnclipu_wv
= 611,
641 rv_op_vnclipu_wx
= 612,
642 rv_op_vnclipu_wi
= 613,
643 rv_op_vnclip_wv
= 614,
644 rv_op_vnclip_wx
= 615,
645 rv_op_vnclip_wi
= 616,
646 rv_op_vfadd_vv
= 617,
647 rv_op_vfadd_vf
= 618,
648 rv_op_vfsub_vv
= 619,
649 rv_op_vfsub_vf
= 620,
650 rv_op_vfrsub_vf
= 621,
651 rv_op_vfwadd_vv
= 622,
652 rv_op_vfwadd_vf
= 623,
653 rv_op_vfwadd_wv
= 624,
654 rv_op_vfwadd_wf
= 625,
655 rv_op_vfwsub_vv
= 626,
656 rv_op_vfwsub_vf
= 627,
657 rv_op_vfwsub_wv
= 628,
658 rv_op_vfwsub_wf
= 629,
659 rv_op_vfmul_vv
= 630,
660 rv_op_vfmul_vf
= 631,
661 rv_op_vfdiv_vv
= 632,
662 rv_op_vfdiv_vf
= 633,
663 rv_op_vfrdiv_vf
= 634,
664 rv_op_vfwmul_vv
= 635,
665 rv_op_vfwmul_vf
= 636,
666 rv_op_vfmacc_vv
= 637,
667 rv_op_vfmacc_vf
= 638,
668 rv_op_vfnmacc_vv
= 639,
669 rv_op_vfnmacc_vf
= 640,
670 rv_op_vfmsac_vv
= 641,
671 rv_op_vfmsac_vf
= 642,
672 rv_op_vfnmsac_vv
= 643,
673 rv_op_vfnmsac_vf
= 644,
674 rv_op_vfmadd_vv
= 645,
675 rv_op_vfmadd_vf
= 646,
676 rv_op_vfnmadd_vv
= 647,
677 rv_op_vfnmadd_vf
= 648,
678 rv_op_vfmsub_vv
= 649,
679 rv_op_vfmsub_vf
= 650,
680 rv_op_vfnmsub_vv
= 651,
681 rv_op_vfnmsub_vf
= 652,
682 rv_op_vfwmacc_vv
= 653,
683 rv_op_vfwmacc_vf
= 654,
684 rv_op_vfwnmacc_vv
= 655,
685 rv_op_vfwnmacc_vf
= 656,
686 rv_op_vfwmsac_vv
= 657,
687 rv_op_vfwmsac_vf
= 658,
688 rv_op_vfwnmsac_vv
= 659,
689 rv_op_vfwnmsac_vf
= 660,
690 rv_op_vfsqrt_v
= 661,
691 rv_op_vfrsqrt7_v
= 662,
692 rv_op_vfrec7_v
= 663,
693 rv_op_vfmin_vv
= 664,
694 rv_op_vfmin_vf
= 665,
695 rv_op_vfmax_vv
= 666,
696 rv_op_vfmax_vf
= 667,
697 rv_op_vfsgnj_vv
= 668,
698 rv_op_vfsgnj_vf
= 669,
699 rv_op_vfsgnjn_vv
= 670,
700 rv_op_vfsgnjn_vf
= 671,
701 rv_op_vfsgnjx_vv
= 672,
702 rv_op_vfsgnjx_vf
= 673,
703 rv_op_vfslide1up_vf
= 674,
704 rv_op_vfslide1down_vf
= 675,
705 rv_op_vmfeq_vv
= 676,
706 rv_op_vmfeq_vf
= 677,
707 rv_op_vmfne_vv
= 678,
708 rv_op_vmfne_vf
= 679,
709 rv_op_vmflt_vv
= 680,
710 rv_op_vmflt_vf
= 681,
711 rv_op_vmfle_vv
= 682,
712 rv_op_vmfle_vf
= 683,
713 rv_op_vmfgt_vf
= 684,
714 rv_op_vmfge_vf
= 685,
715 rv_op_vfclass_v
= 686,
716 rv_op_vfmerge_vfm
= 687,
717 rv_op_vfmv_v_f
= 688,
718 rv_op_vfcvt_xu_f_v
= 689,
719 rv_op_vfcvt_x_f_v
= 690,
720 rv_op_vfcvt_f_xu_v
= 691,
721 rv_op_vfcvt_f_x_v
= 692,
722 rv_op_vfcvt_rtz_xu_f_v
= 693,
723 rv_op_vfcvt_rtz_x_f_v
= 694,
724 rv_op_vfwcvt_xu_f_v
= 695,
725 rv_op_vfwcvt_x_f_v
= 696,
726 rv_op_vfwcvt_f_xu_v
= 697,
727 rv_op_vfwcvt_f_x_v
= 698,
728 rv_op_vfwcvt_f_f_v
= 699,
729 rv_op_vfwcvt_rtz_xu_f_v
= 700,
730 rv_op_vfwcvt_rtz_x_f_v
= 701,
731 rv_op_vfncvt_xu_f_w
= 702,
732 rv_op_vfncvt_x_f_w
= 703,
733 rv_op_vfncvt_f_xu_w
= 704,
734 rv_op_vfncvt_f_x_w
= 705,
735 rv_op_vfncvt_f_f_w
= 706,
736 rv_op_vfncvt_rod_f_f_w
= 707,
737 rv_op_vfncvt_rtz_xu_f_w
= 708,
738 rv_op_vfncvt_rtz_x_f_w
= 709,
739 rv_op_vredsum_vs
= 710,
740 rv_op_vredand_vs
= 711,
741 rv_op_vredor_vs
= 712,
742 rv_op_vredxor_vs
= 713,
743 rv_op_vredminu_vs
= 714,
744 rv_op_vredmin_vs
= 715,
745 rv_op_vredmaxu_vs
= 716,
746 rv_op_vredmax_vs
= 717,
747 rv_op_vwredsumu_vs
= 718,
748 rv_op_vwredsum_vs
= 719,
749 rv_op_vfredusum_vs
= 720,
750 rv_op_vfredosum_vs
= 721,
751 rv_op_vfredmin_vs
= 722,
752 rv_op_vfredmax_vs
= 723,
753 rv_op_vfwredusum_vs
= 724,
754 rv_op_vfwredosum_vs
= 725,
755 rv_op_vmand_mm
= 726,
756 rv_op_vmnand_mm
= 727,
757 rv_op_vmandn_mm
= 728,
758 rv_op_vmxor_mm
= 729,
760 rv_op_vmnor_mm
= 731,
761 rv_op_vmorn_mm
= 732,
762 rv_op_vmxnor_mm
= 733,
764 rv_op_vfirst_m
= 735,
772 rv_op_vfmv_f_s
= 743,
773 rv_op_vfmv_s_f
= 744,
774 rv_op_vslideup_vx
= 745,
775 rv_op_vslideup_vi
= 746,
776 rv_op_vslide1up_vx
= 747,
777 rv_op_vslidedown_vx
= 748,
778 rv_op_vslidedown_vi
= 749,
779 rv_op_vslide1down_vx
= 750,
780 rv_op_vrgather_vv
= 751,
781 rv_op_vrgatherei16_vv
= 752,
782 rv_op_vrgather_vx
= 753,
783 rv_op_vrgather_vi
= 754,
784 rv_op_vcompress_vm
= 755,
789 rv_op_vzext_vf2
= 760,
790 rv_op_vzext_vf4
= 761,
791 rv_op_vzext_vf8
= 762,
792 rv_op_vsext_vf2
= 763,
793 rv_op_vsext_vf4
= 764,
794 rv_op_vsext_vf8
= 765,
796 rv_op_vsetivli
= 767,
798 rv_op_c_zext_b
= 769,
799 rv_op_c_sext_b
= 770,
800 rv_op_c_zext_h
= 771,
801 rv_op_c_sext_h
= 772,
802 rv_op_c_zext_w
= 773,
812 rv_op_cm_popret
= 783,
813 rv_op_cm_popretz
= 784,
814 rv_op_cm_mva01s
= 785,
815 rv_op_cm_mvsa01
= 786,
818 rv_op_czero_eqz
= 789,
819 rv_op_czero_nez
= 790,
824 static const char rv_ireg_name_sym
[32][5] = {
825 "zero", "ra", "sp", "gp", "tp", "t0", "t1", "t2",
826 "s0", "s1", "a0", "a1", "a2", "a3", "a4", "a5",
827 "a6", "a7", "s2", "s3", "s4", "s5", "s6", "s7",
828 "s8", "s9", "s10", "s11", "t3", "t4", "t5", "t6",
831 static const char rv_freg_name_sym
[32][5] = {
832 "ft0", "ft1", "ft2", "ft3", "ft4", "ft5", "ft6", "ft7",
833 "fs0", "fs1", "fa0", "fa1", "fa2", "fa3", "fa4", "fa5",
834 "fa6", "fa7", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7",
835 "fs8", "fs9", "fs10", "fs11", "ft8", "ft9", "ft10", "ft11",
838 static const char rv_vreg_name_sym
[32][4] = {
839 "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
840 "v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15",
841 "v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
842 "v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
845 /* pseudo-instruction constraints */
847 static const rvc_constraint rvcc_jal
[] = { rvc_rd_eq_ra
, rvc_end
};
848 static const rvc_constraint rvcc_jalr
[] = { rvc_rd_eq_ra
, rvc_imm_eq_zero
,
850 static const rvc_constraint rvcc_nop
[] = { rvc_rd_eq_x0
, rvc_rs1_eq_x0
,
851 rvc_imm_eq_zero
, rvc_end
};
852 static const rvc_constraint rvcc_mv
[] = { rvc_imm_eq_zero
, rvc_end
};
853 static const rvc_constraint rvcc_not
[] = { rvc_imm_eq_n1
, rvc_end
};
854 static const rvc_constraint rvcc_neg
[] = { rvc_rs1_eq_x0
, rvc_end
};
855 static const rvc_constraint rvcc_negw
[] = { rvc_rs1_eq_x0
, rvc_end
};
856 static const rvc_constraint rvcc_sext_w
[] = { rvc_imm_eq_zero
, rvc_end
};
857 static const rvc_constraint rvcc_seqz
[] = { rvc_imm_eq_p1
, rvc_end
};
858 static const rvc_constraint rvcc_snez
[] = { rvc_rs1_eq_x0
, rvc_end
};
859 static const rvc_constraint rvcc_sltz
[] = { rvc_rs2_eq_x0
, rvc_end
};
860 static const rvc_constraint rvcc_sgtz
[] = { rvc_rs1_eq_x0
, rvc_end
};
861 static const rvc_constraint rvcc_fmv_s
[] = { rvc_rs2_eq_rs1
, rvc_end
};
862 static const rvc_constraint rvcc_fabs_s
[] = { rvc_rs2_eq_rs1
, rvc_end
};
863 static const rvc_constraint rvcc_fneg_s
[] = { rvc_rs2_eq_rs1
, rvc_end
};
864 static const rvc_constraint rvcc_fmv_d
[] = { rvc_rs2_eq_rs1
, rvc_end
};
865 static const rvc_constraint rvcc_fabs_d
[] = { rvc_rs2_eq_rs1
, rvc_end
};
866 static const rvc_constraint rvcc_fneg_d
[] = { rvc_rs2_eq_rs1
, rvc_end
};
867 static const rvc_constraint rvcc_fmv_q
[] = { rvc_rs2_eq_rs1
, rvc_end
};
868 static const rvc_constraint rvcc_fabs_q
[] = { rvc_rs2_eq_rs1
, rvc_end
};
869 static const rvc_constraint rvcc_fneg_q
[] = { rvc_rs2_eq_rs1
, rvc_end
};
870 static const rvc_constraint rvcc_beqz
[] = { rvc_rs2_eq_x0
, rvc_end
};
871 static const rvc_constraint rvcc_bnez
[] = { rvc_rs2_eq_x0
, rvc_end
};
872 static const rvc_constraint rvcc_blez
[] = { rvc_rs1_eq_x0
, rvc_end
};
873 static const rvc_constraint rvcc_bgez
[] = { rvc_rs2_eq_x0
, rvc_end
};
874 static const rvc_constraint rvcc_bltz
[] = { rvc_rs2_eq_x0
, rvc_end
};
875 static const rvc_constraint rvcc_bgtz
[] = { rvc_rs1_eq_x0
, rvc_end
};
876 static const rvc_constraint rvcc_ble
[] = { rvc_end
};
877 static const rvc_constraint rvcc_bleu
[] = { rvc_end
};
878 static const rvc_constraint rvcc_bgt
[] = { rvc_end
};
879 static const rvc_constraint rvcc_bgtu
[] = { rvc_end
};
880 static const rvc_constraint rvcc_j
[] = { rvc_rd_eq_x0
, rvc_end
};
881 static const rvc_constraint rvcc_ret
[] = { rvc_rd_eq_x0
, rvc_rs1_eq_ra
,
883 static const rvc_constraint rvcc_jr
[] = { rvc_rd_eq_x0
, rvc_imm_eq_zero
,
885 static const rvc_constraint rvcc_rdcycle
[] = { rvc_rs1_eq_x0
, rvc_csr_eq_0xc00
,
887 static const rvc_constraint rvcc_rdtime
[] = { rvc_rs1_eq_x0
, rvc_csr_eq_0xc01
,
889 static const rvc_constraint rvcc_rdinstret
[] = { rvc_rs1_eq_x0
,
890 rvc_csr_eq_0xc02
, rvc_end
};
891 static const rvc_constraint rvcc_rdcycleh
[] = { rvc_rs1_eq_x0
,
892 rvc_csr_eq_0xc80
, rvc_end
};
893 static const rvc_constraint rvcc_rdtimeh
[] = { rvc_rs1_eq_x0
, rvc_csr_eq_0xc81
,
895 static const rvc_constraint rvcc_rdinstreth
[] = { rvc_rs1_eq_x0
,
896 rvc_csr_eq_0xc82
, rvc_end
};
897 static const rvc_constraint rvcc_frcsr
[] = { rvc_rs1_eq_x0
, rvc_csr_eq_0x003
,
899 static const rvc_constraint rvcc_frrm
[] = { rvc_rs1_eq_x0
, rvc_csr_eq_0x002
,
901 static const rvc_constraint rvcc_frflags
[] = { rvc_rs1_eq_x0
, rvc_csr_eq_0x001
,
903 static const rvc_constraint rvcc_fscsr
[] = { rvc_csr_eq_0x003
, rvc_end
};
904 static const rvc_constraint rvcc_fsrm
[] = { rvc_csr_eq_0x002
, rvc_end
};
905 static const rvc_constraint rvcc_fsflags
[] = { rvc_csr_eq_0x001
, rvc_end
};
906 static const rvc_constraint rvcc_fsrmi
[] = { rvc_csr_eq_0x002
, rvc_end
};
907 static const rvc_constraint rvcc_fsflagsi
[] = { rvc_csr_eq_0x001
, rvc_end
};
909 /* pseudo-instruction metadata */
911 static const rv_comp_data rvcp_jal
[] = {
913 { rv_op_jal
, rvcc_jal
},
914 { rv_op_illegal
, NULL
}
917 static const rv_comp_data rvcp_jalr
[] = {
918 { rv_op_ret
, rvcc_ret
},
919 { rv_op_jr
, rvcc_jr
},
920 { rv_op_jalr
, rvcc_jalr
},
921 { rv_op_illegal
, NULL
}
924 static const rv_comp_data rvcp_beq
[] = {
925 { rv_op_beqz
, rvcc_beqz
},
926 { rv_op_illegal
, NULL
}
929 static const rv_comp_data rvcp_bne
[] = {
930 { rv_op_bnez
, rvcc_bnez
},
931 { rv_op_illegal
, NULL
}
934 static const rv_comp_data rvcp_blt
[] = {
935 { rv_op_bltz
, rvcc_bltz
},
936 { rv_op_bgtz
, rvcc_bgtz
},
937 { rv_op_bgt
, rvcc_bgt
},
938 { rv_op_illegal
, NULL
}
941 static const rv_comp_data rvcp_bge
[] = {
942 { rv_op_blez
, rvcc_blez
},
943 { rv_op_bgez
, rvcc_bgez
},
944 { rv_op_ble
, rvcc_ble
},
945 { rv_op_illegal
, NULL
}
948 static const rv_comp_data rvcp_bltu
[] = {
949 { rv_op_bgtu
, rvcc_bgtu
},
950 { rv_op_illegal
, NULL
}
953 static const rv_comp_data rvcp_bgeu
[] = {
954 { rv_op_bleu
, rvcc_bleu
},
955 { rv_op_illegal
, NULL
}
958 static const rv_comp_data rvcp_addi
[] = {
959 { rv_op_nop
, rvcc_nop
},
960 { rv_op_mv
, rvcc_mv
},
961 { rv_op_illegal
, NULL
}
964 static const rv_comp_data rvcp_sltiu
[] = {
965 { rv_op_seqz
, rvcc_seqz
},
966 { rv_op_illegal
, NULL
}
969 static const rv_comp_data rvcp_xori
[] = {
970 { rv_op_not
, rvcc_not
},
971 { rv_op_illegal
, NULL
}
974 static const rv_comp_data rvcp_sub
[] = {
975 { rv_op_neg
, rvcc_neg
},
976 { rv_op_illegal
, NULL
}
979 static const rv_comp_data rvcp_slt
[] = {
980 { rv_op_sltz
, rvcc_sltz
},
981 { rv_op_sgtz
, rvcc_sgtz
},
982 { rv_op_illegal
, NULL
}
985 static const rv_comp_data rvcp_sltu
[] = {
986 { rv_op_snez
, rvcc_snez
},
987 { rv_op_illegal
, NULL
}
990 static const rv_comp_data rvcp_addiw
[] = {
991 { rv_op_sext_w
, rvcc_sext_w
},
992 { rv_op_illegal
, NULL
}
995 static const rv_comp_data rvcp_subw
[] = {
996 { rv_op_negw
, rvcc_negw
},
997 { rv_op_illegal
, NULL
}
1000 static const rv_comp_data rvcp_csrrw
[] = {
1001 { rv_op_fscsr
, rvcc_fscsr
},
1002 { rv_op_fsrm
, rvcc_fsrm
},
1003 { rv_op_fsflags
, rvcc_fsflags
},
1004 { rv_op_illegal
, NULL
}
1008 static const rv_comp_data rvcp_csrrs
[] = {
1009 { rv_op_rdcycle
, rvcc_rdcycle
},
1010 { rv_op_rdtime
, rvcc_rdtime
},
1011 { rv_op_rdinstret
, rvcc_rdinstret
},
1012 { rv_op_rdcycleh
, rvcc_rdcycleh
},
1013 { rv_op_rdtimeh
, rvcc_rdtimeh
},
1014 { rv_op_rdinstreth
, rvcc_rdinstreth
},
1015 { rv_op_frcsr
, rvcc_frcsr
},
1016 { rv_op_frrm
, rvcc_frrm
},
1017 { rv_op_frflags
, rvcc_frflags
},
1018 { rv_op_illegal
, NULL
}
1021 static const rv_comp_data rvcp_csrrwi
[] = {
1022 { rv_op_fsrmi
, rvcc_fsrmi
},
1023 { rv_op_fsflagsi
, rvcc_fsflagsi
},
1024 { rv_op_illegal
, NULL
}
1027 static const rv_comp_data rvcp_fsgnj_s
[] = {
1028 { rv_op_fmv_s
, rvcc_fmv_s
},
1029 { rv_op_illegal
, NULL
}
1032 static const rv_comp_data rvcp_fsgnjn_s
[] = {
1033 { rv_op_fneg_s
, rvcc_fneg_s
},
1034 { rv_op_illegal
, NULL
}
1037 static const rv_comp_data rvcp_fsgnjx_s
[] = {
1038 { rv_op_fabs_s
, rvcc_fabs_s
},
1039 { rv_op_illegal
, NULL
}
1042 static const rv_comp_data rvcp_fsgnj_d
[] = {
1043 { rv_op_fmv_d
, rvcc_fmv_d
},
1044 { rv_op_illegal
, NULL
}
1047 static const rv_comp_data rvcp_fsgnjn_d
[] = {
1048 { rv_op_fneg_d
, rvcc_fneg_d
},
1049 { rv_op_illegal
, NULL
}
1052 static const rv_comp_data rvcp_fsgnjx_d
[] = {
1053 { rv_op_fabs_d
, rvcc_fabs_d
},
1054 { rv_op_illegal
, NULL
}
1057 static const rv_comp_data rvcp_fsgnj_q
[] = {
1058 { rv_op_fmv_q
, rvcc_fmv_q
},
1059 { rv_op_illegal
, NULL
}
1062 static const rv_comp_data rvcp_fsgnjn_q
[] = {
1063 { rv_op_fneg_q
, rvcc_fneg_q
},
1064 { rv_op_illegal
, NULL
}
1067 static const rv_comp_data rvcp_fsgnjx_q
[] = {
1068 { rv_op_fabs_q
, rvcc_fabs_q
},
1069 { rv_op_illegal
, NULL
}
1072 /* instruction metadata */
1074 const rv_opcode_data rvi_opcode_data
[] = {
1075 { "illegal", rv_codec_illegal
, rv_fmt_none
, NULL
, 0, 0, 0 },
1076 { "lui", rv_codec_u
, rv_fmt_rd_imm
, NULL
, 0, 0, 0 },
1077 { "auipc", rv_codec_u
, rv_fmt_rd_offset
, NULL
, 0, 0, 0 },
1078 { "jal", rv_codec_uj
, rv_fmt_rd_offset
, rvcp_jal
, 0, 0, 0 },
1079 { "jalr", rv_codec_i
, rv_fmt_rd_rs1_offset
, rvcp_jalr
, 0, 0, 0 },
1080 { "beq", rv_codec_sb
, rv_fmt_rs1_rs2_offset
, rvcp_beq
, 0, 0, 0 },
1081 { "bne", rv_codec_sb
, rv_fmt_rs1_rs2_offset
, rvcp_bne
, 0, 0, 0 },
1082 { "blt", rv_codec_sb
, rv_fmt_rs1_rs2_offset
, rvcp_blt
, 0, 0, 0 },
1083 { "bge", rv_codec_sb
, rv_fmt_rs1_rs2_offset
, rvcp_bge
, 0, 0, 0 },
1084 { "bltu", rv_codec_sb
, rv_fmt_rs1_rs2_offset
, rvcp_bltu
, 0, 0, 0 },
1085 { "bgeu", rv_codec_sb
, rv_fmt_rs1_rs2_offset
, rvcp_bgeu
, 0, 0, 0 },
1086 { "lb", rv_codec_i
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, 0 },
1087 { "lh", rv_codec_i
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, 0 },
1088 { "lw", rv_codec_i
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, 0 },
1089 { "lbu", rv_codec_i
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, 0 },
1090 { "lhu", rv_codec_i
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, 0 },
1091 { "sb", rv_codec_s
, rv_fmt_rs2_offset_rs1
, NULL
, 0, 0, 0 },
1092 { "sh", rv_codec_s
, rv_fmt_rs2_offset_rs1
, NULL
, 0, 0, 0 },
1093 { "sw", rv_codec_s
, rv_fmt_rs2_offset_rs1
, NULL
, 0, 0, 0 },
1094 { "addi", rv_codec_i
, rv_fmt_rd_rs1_imm
, rvcp_addi
, 0, 0, 0 },
1095 { "slti", rv_codec_i
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1096 { "sltiu", rv_codec_i
, rv_fmt_rd_rs1_imm
, rvcp_sltiu
, 0, 0, 0 },
1097 { "xori", rv_codec_i
, rv_fmt_rd_rs1_imm
, rvcp_xori
, 0, 0, 0 },
1098 { "ori", rv_codec_i
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1099 { "andi", rv_codec_i
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1100 { "slli", rv_codec_i_sh7
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1101 { "srli", rv_codec_i_sh7
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1102 { "srai", rv_codec_i_sh7
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1103 { "add", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1104 { "sub", rv_codec_r
, rv_fmt_rd_rs1_rs2
, rvcp_sub
, 0, 0, 0 },
1105 { "sll", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1106 { "slt", rv_codec_r
, rv_fmt_rd_rs1_rs2
, rvcp_slt
, 0, 0, 0 },
1107 { "sltu", rv_codec_r
, rv_fmt_rd_rs1_rs2
, rvcp_sltu
, 0, 0, 0 },
1108 { "xor", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1109 { "srl", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1110 { "sra", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1111 { "or", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1112 { "and", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1113 { "fence", rv_codec_r_f
, rv_fmt_pred_succ
, NULL
, 0, 0, 0 },
1114 { "fence.i", rv_codec_none
, rv_fmt_none
, NULL
, 0, 0, 0 },
1115 { "lwu", rv_codec_i
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, 0 },
1116 { "ld", rv_codec_i
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, 0 },
1117 { "sd", rv_codec_s
, rv_fmt_rs2_offset_rs1
, NULL
, 0, 0, 0 },
1118 { "addiw", rv_codec_i
, rv_fmt_rd_rs1_imm
, rvcp_addiw
, 0, 0, 0 },
1119 { "slliw", rv_codec_i_sh5
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1120 { "srliw", rv_codec_i_sh5
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1121 { "sraiw", rv_codec_i_sh5
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1122 { "addw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1123 { "subw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, rvcp_subw
, 0, 0, 0 },
1124 { "sllw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1125 { "srlw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1126 { "sraw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1127 { "ldu", rv_codec_i
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, 0 },
1128 { "lq", rv_codec_i
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, 0 },
1129 { "sq", rv_codec_s
, rv_fmt_rs2_offset_rs1
, NULL
, 0, 0, 0 },
1130 { "addid", rv_codec_i
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1131 { "sllid", rv_codec_i_sh6
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1132 { "srlid", rv_codec_i_sh6
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1133 { "sraid", rv_codec_i_sh6
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1134 { "addd", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1135 { "subd", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1136 { "slld", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1137 { "srld", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1138 { "srad", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1139 { "mul", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1140 { "mulh", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1141 { "mulhsu", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1142 { "mulhu", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1143 { "div", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1144 { "divu", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1145 { "rem", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1146 { "remu", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1147 { "mulw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1148 { "divw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1149 { "divuw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1150 { "remw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1151 { "remuw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1152 { "muld", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1153 { "divd", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1154 { "divud", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1155 { "remd", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1156 { "remud", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1157 { "lr.w", rv_codec_r_l
, rv_fmt_aqrl_rd_rs1
, NULL
, 0, 0, 0 },
1158 { "sc.w", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1159 { "amoswap.w", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1160 { "amoadd.w", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1161 { "amoxor.w", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1162 { "amoor.w", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1163 { "amoand.w", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1164 { "amomin.w", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1165 { "amomax.w", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1166 { "amominu.w", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1167 { "amomaxu.w", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1168 { "lr.d", rv_codec_r_l
, rv_fmt_aqrl_rd_rs1
, NULL
, 0, 0, 0 },
1169 { "sc.d", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1170 { "amoswap.d", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1171 { "amoadd.d", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1172 { "amoxor.d", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1173 { "amoor.d", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1174 { "amoand.d", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1175 { "amomin.d", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1176 { "amomax.d", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1177 { "amominu.d", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1178 { "amomaxu.d", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1179 { "lr.q", rv_codec_r_l
, rv_fmt_aqrl_rd_rs1
, NULL
, 0, 0, 0 },
1180 { "sc.q", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1181 { "amoswap.q", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1182 { "amoadd.q", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1183 { "amoxor.q", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1184 { "amoor.q", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1185 { "amoand.q", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1186 { "amomin.q", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1187 { "amomax.q", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1188 { "amominu.q", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1189 { "amomaxu.q", rv_codec_r_a
, rv_fmt_aqrl_rd_rs2_rs1
, NULL
, 0, 0, 0 },
1190 { "ecall", rv_codec_none
, rv_fmt_none
, NULL
, 0, 0, 0 },
1191 { "ebreak", rv_codec_none
, rv_fmt_none
, NULL
, 0, 0, 0 },
1192 { "uret", rv_codec_none
, rv_fmt_none
, NULL
, 0, 0, 0 },
1193 { "sret", rv_codec_none
, rv_fmt_none
, NULL
, 0, 0, 0 },
1194 { "hret", rv_codec_none
, rv_fmt_none
, NULL
, 0, 0, 0 },
1195 { "mret", rv_codec_none
, rv_fmt_none
, NULL
, 0, 0, 0 },
1196 { "dret", rv_codec_none
, rv_fmt_none
, NULL
, 0, 0, 0 },
1197 { "sfence.vm", rv_codec_r
, rv_fmt_rs1
, NULL
, 0, 0, 0 },
1198 { "sfence.vma", rv_codec_r
, rv_fmt_rs1_rs2
, NULL
, 0, 0, 0 },
1199 { "wfi", rv_codec_none
, rv_fmt_none
, NULL
, 0, 0, 0 },
1200 { "csrrw", rv_codec_i_csr
, rv_fmt_rd_csr_rs1
, rvcp_csrrw
, 0, 0, 0 },
1201 { "csrrs", rv_codec_i_csr
, rv_fmt_rd_csr_rs1
, rvcp_csrrs
, 0, 0, 0 },
1202 { "csrrc", rv_codec_i_csr
, rv_fmt_rd_csr_rs1
, NULL
, 0, 0, 0 },
1203 { "csrrwi", rv_codec_i_csr
, rv_fmt_rd_csr_zimm
, rvcp_csrrwi
, 0, 0, 0 },
1204 { "csrrsi", rv_codec_i_csr
, rv_fmt_rd_csr_zimm
, NULL
, 0, 0, 0 },
1205 { "csrrci", rv_codec_i_csr
, rv_fmt_rd_csr_zimm
, NULL
, 0, 0, 0 },
1206 { "flw", rv_codec_i
, rv_fmt_frd_offset_rs1
, NULL
, 0, 0, 0 },
1207 { "fsw", rv_codec_s
, rv_fmt_frs2_offset_rs1
, NULL
, 0, 0, 0 },
1208 { "fmadd.s", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1209 { "fmsub.s", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1210 { "fnmsub.s", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1211 { "fnmadd.s", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1212 { "fadd.s", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1213 { "fsub.s", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1214 { "fmul.s", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1215 { "fdiv.s", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1216 { "fsgnj.s", rv_codec_r
, rv_fmt_frd_frs1_frs2
, rvcp_fsgnj_s
, 0, 0, 0 },
1217 { "fsgnjn.s", rv_codec_r
, rv_fmt_frd_frs1_frs2
, rvcp_fsgnjn_s
, 0, 0, 0 },
1218 { "fsgnjx.s", rv_codec_r
, rv_fmt_frd_frs1_frs2
, rvcp_fsgnjx_s
, 0, 0, 0 },
1219 { "fmin.s", rv_codec_r
, rv_fmt_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1220 { "fmax.s", rv_codec_r
, rv_fmt_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1221 { "fsqrt.s", rv_codec_r_m
, rv_fmt_rm_frd_frs1
, NULL
, 0, 0, 0 },
1222 { "fle.s", rv_codec_r
, rv_fmt_rd_frs1_frs2
, NULL
, 0, 0, 0 },
1223 { "flt.s", rv_codec_r
, rv_fmt_rd_frs1_frs2
, NULL
, 0, 0, 0 },
1224 { "feq.s", rv_codec_r
, rv_fmt_rd_frs1_frs2
, NULL
, 0, 0, 0 },
1225 { "fcvt.w.s", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1226 { "fcvt.wu.s", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1227 { "fcvt.s.w", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1228 { "fcvt.s.wu", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1229 { "fmv.x.s", rv_codec_r
, rv_fmt_rd_frs1
, NULL
, 0, 0, 0 },
1230 { "fclass.s", rv_codec_r
, rv_fmt_rd_frs1
, NULL
, 0, 0, 0 },
1231 { "fmv.s.x", rv_codec_r
, rv_fmt_frd_rs1
, NULL
, 0, 0, 0 },
1232 { "fcvt.l.s", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1233 { "fcvt.lu.s", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1234 { "fcvt.s.l", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1235 { "fcvt.s.lu", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1236 { "fld", rv_codec_i
, rv_fmt_frd_offset_rs1
, NULL
, 0, 0, 0 },
1237 { "fsd", rv_codec_s
, rv_fmt_frs2_offset_rs1
, NULL
, 0, 0, 0 },
1238 { "fmadd.d", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1239 { "fmsub.d", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1240 { "fnmsub.d", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1241 { "fnmadd.d", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1242 { "fadd.d", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1243 { "fsub.d", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1244 { "fmul.d", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1245 { "fdiv.d", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1246 { "fsgnj.d", rv_codec_r
, rv_fmt_frd_frs1_frs2
, rvcp_fsgnj_d
, 0, 0, 0 },
1247 { "fsgnjn.d", rv_codec_r
, rv_fmt_frd_frs1_frs2
, rvcp_fsgnjn_d
, 0, 0, 0 },
1248 { "fsgnjx.d", rv_codec_r
, rv_fmt_frd_frs1_frs2
, rvcp_fsgnjx_d
, 0, 0, 0 },
1249 { "fmin.d", rv_codec_r
, rv_fmt_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1250 { "fmax.d", rv_codec_r
, rv_fmt_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1251 { "fcvt.s.d", rv_codec_r_m
, rv_fmt_rm_frd_frs1
, NULL
, 0, 0, 0 },
1252 { "fcvt.d.s", rv_codec_r_m
, rv_fmt_rm_frd_frs1
, NULL
, 0, 0, 0 },
1253 { "fsqrt.d", rv_codec_r_m
, rv_fmt_rm_frd_frs1
, NULL
, 0, 0, 0 },
1254 { "fle.d", rv_codec_r
, rv_fmt_rd_frs1_frs2
, NULL
, 0, 0, 0 },
1255 { "flt.d", rv_codec_r
, rv_fmt_rd_frs1_frs2
, NULL
, 0, 0, 0 },
1256 { "feq.d", rv_codec_r
, rv_fmt_rd_frs1_frs2
, NULL
, 0, 0, 0 },
1257 { "fcvt.w.d", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1258 { "fcvt.wu.d", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1259 { "fcvt.d.w", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1260 { "fcvt.d.wu", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1261 { "fclass.d", rv_codec_r
, rv_fmt_rd_frs1
, NULL
, 0, 0, 0 },
1262 { "fcvt.l.d", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1263 { "fcvt.lu.d", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1264 { "fmv.x.d", rv_codec_r
, rv_fmt_rd_frs1
, NULL
, 0, 0, 0 },
1265 { "fcvt.d.l", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1266 { "fcvt.d.lu", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1267 { "fmv.d.x", rv_codec_r
, rv_fmt_frd_rs1
, NULL
, 0, 0, 0 },
1268 { "flq", rv_codec_i
, rv_fmt_frd_offset_rs1
, NULL
, 0, 0, 0 },
1269 { "fsq", rv_codec_s
, rv_fmt_frs2_offset_rs1
, NULL
, 0, 0, 0 },
1270 { "fmadd.q", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1271 { "fmsub.q", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1272 { "fnmsub.q", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1273 { "fnmadd.q", rv_codec_r4_m
, rv_fmt_rm_frd_frs1_frs2_frs3
, NULL
, 0, 0, 0 },
1274 { "fadd.q", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1275 { "fsub.q", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1276 { "fmul.q", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1277 { "fdiv.q", rv_codec_r_m
, rv_fmt_rm_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1278 { "fsgnj.q", rv_codec_r
, rv_fmt_frd_frs1_frs2
, rvcp_fsgnj_q
, 0, 0, 0 },
1279 { "fsgnjn.q", rv_codec_r
, rv_fmt_frd_frs1_frs2
, rvcp_fsgnjn_q
, 0, 0, 0 },
1280 { "fsgnjx.q", rv_codec_r
, rv_fmt_frd_frs1_frs2
, rvcp_fsgnjx_q
, 0, 0, 0 },
1281 { "fmin.q", rv_codec_r
, rv_fmt_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1282 { "fmax.q", rv_codec_r
, rv_fmt_frd_frs1_frs2
, NULL
, 0, 0, 0 },
1283 { "fcvt.s.q", rv_codec_r_m
, rv_fmt_rm_frd_frs1
, NULL
, 0, 0, 0 },
1284 { "fcvt.q.s", rv_codec_r_m
, rv_fmt_rm_frd_frs1
, NULL
, 0, 0, 0 },
1285 { "fcvt.d.q", rv_codec_r_m
, rv_fmt_rm_frd_frs1
, NULL
, 0, 0, 0 },
1286 { "fcvt.q.d", rv_codec_r_m
, rv_fmt_rm_frd_frs1
, NULL
, 0, 0, 0 },
1287 { "fsqrt.q", rv_codec_r_m
, rv_fmt_rm_frd_frs1
, NULL
, 0, 0, 0 },
1288 { "fle.q", rv_codec_r
, rv_fmt_rd_frs1_frs2
, NULL
, 0, 0, 0 },
1289 { "flt.q", rv_codec_r
, rv_fmt_rd_frs1_frs2
, NULL
, 0, 0, 0 },
1290 { "feq.q", rv_codec_r
, rv_fmt_rd_frs1_frs2
, NULL
, 0, 0, 0 },
1291 { "fcvt.w.q", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1292 { "fcvt.wu.q", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1293 { "fcvt.q.w", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1294 { "fcvt.q.wu", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1295 { "fclass.q", rv_codec_r
, rv_fmt_rd_frs1
, NULL
, 0, 0, 0 },
1296 { "fcvt.l.q", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1297 { "fcvt.lu.q", rv_codec_r_m
, rv_fmt_rm_rd_frs1
, NULL
, 0, 0, 0 },
1298 { "fcvt.q.l", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1299 { "fcvt.q.lu", rv_codec_r_m
, rv_fmt_rm_frd_rs1
, NULL
, 0, 0, 0 },
1300 { "fmv.x.q", rv_codec_r
, rv_fmt_rd_frs1
, NULL
, 0, 0, 0 },
1301 { "fmv.q.x", rv_codec_r
, rv_fmt_frd_rs1
, NULL
, 0, 0, 0 },
1302 { "c.addi4spn", rv_codec_ciw_4spn
, rv_fmt_rd_rs1_imm
, NULL
, rv_op_addi
,
1303 rv_op_addi
, rv_op_addi
, rvcd_imm_nz
},
1304 { "c.fld", rv_codec_cl_ld
, rv_fmt_frd_offset_rs1
, NULL
, rv_op_fld
,
1306 { "c.lw", rv_codec_cl_lw
, rv_fmt_rd_offset_rs1
, NULL
, rv_op_lw
, rv_op_lw
,
1308 { "c.flw", rv_codec_cl_lw
, rv_fmt_frd_offset_rs1
, NULL
, rv_op_flw
, 0, 0 },
1309 { "c.fsd", rv_codec_cs_sd
, rv_fmt_frs2_offset_rs1
, NULL
, rv_op_fsd
,
1311 { "c.sw", rv_codec_cs_sw
, rv_fmt_rs2_offset_rs1
, NULL
, rv_op_sw
, rv_op_sw
,
1313 { "c.fsw", rv_codec_cs_sw
, rv_fmt_frs2_offset_rs1
, NULL
, rv_op_fsw
, 0, 0 },
1314 { "c.nop", rv_codec_ci_none
, rv_fmt_none
, NULL
, rv_op_addi
, rv_op_addi
,
1316 { "c.addi", rv_codec_ci
, rv_fmt_rd_rs1_imm
, NULL
, rv_op_addi
, rv_op_addi
,
1317 rv_op_addi
, rvcd_imm_nz
},
1318 { "c.jal", rv_codec_cj_jal
, rv_fmt_rd_offset
, NULL
, rv_op_jal
, 0, 0 },
1319 { "c.li", rv_codec_ci_li
, rv_fmt_rd_rs1_imm
, NULL
, rv_op_addi
, rv_op_addi
,
1321 { "c.addi16sp", rv_codec_ci_16sp
, rv_fmt_rd_rs1_imm
, NULL
, rv_op_addi
,
1322 rv_op_addi
, rv_op_addi
, rvcd_imm_nz
},
1323 { "c.lui", rv_codec_ci_lui
, rv_fmt_rd_imm
, NULL
, rv_op_lui
, rv_op_lui
,
1324 rv_op_lui
, rvcd_imm_nz
},
1325 { "c.srli", rv_codec_cb_sh6
, rv_fmt_rd_rs1_imm
, NULL
, rv_op_srli
,
1326 rv_op_srli
, rv_op_srli
, rvcd_imm_nz
},
1327 { "c.srai", rv_codec_cb_sh6
, rv_fmt_rd_rs1_imm
, NULL
, rv_op_srai
,
1328 rv_op_srai
, rv_op_srai
, rvcd_imm_nz
},
1329 { "c.andi", rv_codec_cb_imm
, rv_fmt_rd_rs1_imm
, NULL
, rv_op_andi
,
1330 rv_op_andi
, rv_op_andi
},
1331 { "c.sub", rv_codec_cs
, rv_fmt_rd_rs1_rs2
, NULL
, rv_op_sub
, rv_op_sub
,
1333 { "c.xor", rv_codec_cs
, rv_fmt_rd_rs1_rs2
, NULL
, rv_op_xor
, rv_op_xor
,
1335 { "c.or", rv_codec_cs
, rv_fmt_rd_rs1_rs2
, NULL
, rv_op_or
, rv_op_or
,
1337 { "c.and", rv_codec_cs
, rv_fmt_rd_rs1_rs2
, NULL
, rv_op_and
, rv_op_and
,
1339 { "c.subw", rv_codec_cs
, rv_fmt_rd_rs1_rs2
, NULL
, rv_op_subw
, rv_op_subw
,
1341 { "c.addw", rv_codec_cs
, rv_fmt_rd_rs1_rs2
, NULL
, rv_op_addw
, rv_op_addw
,
1343 { "c.j", rv_codec_cj
, rv_fmt_rd_offset
, NULL
, rv_op_jal
, rv_op_jal
,
1345 { "c.beqz", rv_codec_cb
, rv_fmt_rs1_rs2_offset
, NULL
, rv_op_beq
, rv_op_beq
,
1347 { "c.bnez", rv_codec_cb
, rv_fmt_rs1_rs2_offset
, NULL
, rv_op_bne
, rv_op_bne
,
1349 { "c.slli", rv_codec_ci_sh6
, rv_fmt_rd_rs1_imm
, NULL
, rv_op_slli
,
1350 rv_op_slli
, rv_op_slli
, rvcd_imm_nz
},
1351 { "c.fldsp", rv_codec_ci_ldsp
, rv_fmt_frd_offset_rs1
, NULL
, rv_op_fld
,
1352 rv_op_fld
, rv_op_fld
},
1353 { "c.lwsp", rv_codec_ci_lwsp
, rv_fmt_rd_offset_rs1
, NULL
, rv_op_lw
,
1354 rv_op_lw
, rv_op_lw
},
1355 { "c.flwsp", rv_codec_ci_lwsp
, rv_fmt_frd_offset_rs1
, NULL
, rv_op_flw
, 0,
1357 { "c.jr", rv_codec_cr_jr
, rv_fmt_rd_rs1_offset
, NULL
, rv_op_jalr
,
1358 rv_op_jalr
, rv_op_jalr
},
1359 { "c.mv", rv_codec_cr_mv
, rv_fmt_rd_rs1_rs2
, NULL
, rv_op_addi
, rv_op_addi
,
1361 { "c.ebreak", rv_codec_ci_none
, rv_fmt_none
, NULL
, rv_op_ebreak
,
1362 rv_op_ebreak
, rv_op_ebreak
},
1363 { "c.jalr", rv_codec_cr_jalr
, rv_fmt_rd_rs1_offset
, NULL
, rv_op_jalr
,
1364 rv_op_jalr
, rv_op_jalr
},
1365 { "c.add", rv_codec_cr
, rv_fmt_rd_rs1_rs2
, NULL
, rv_op_add
, rv_op_add
,
1367 { "c.fsdsp", rv_codec_css_sdsp
, rv_fmt_frs2_offset_rs1
, NULL
, rv_op_fsd
,
1368 rv_op_fsd
, rv_op_fsd
},
1369 { "c.swsp", rv_codec_css_swsp
, rv_fmt_rs2_offset_rs1
, NULL
, rv_op_sw
,
1370 rv_op_sw
, rv_op_sw
},
1371 { "c.fswsp", rv_codec_css_swsp
, rv_fmt_frs2_offset_rs1
, NULL
, rv_op_fsw
, 0,
1373 { "c.ld", rv_codec_cl_ld
, rv_fmt_rd_offset_rs1
, NULL
, 0, rv_op_ld
,
1375 { "c.sd", rv_codec_cs_sd
, rv_fmt_rs2_offset_rs1
, NULL
, 0, rv_op_sd
,
1377 { "c.addiw", rv_codec_ci
, rv_fmt_rd_rs1_imm
, NULL
, 0, rv_op_addiw
,
1379 { "c.ldsp", rv_codec_ci_ldsp
, rv_fmt_rd_offset_rs1
, NULL
, 0, rv_op_ld
,
1381 { "c.sdsp", rv_codec_css_sdsp
, rv_fmt_rs2_offset_rs1
, NULL
, 0, rv_op_sd
,
1383 { "c.lq", rv_codec_cl_lq
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, rv_op_lq
},
1384 { "c.sq", rv_codec_cs_sq
, rv_fmt_rs2_offset_rs1
, NULL
, 0, 0, rv_op_sq
},
1385 { "c.lqsp", rv_codec_ci_lqsp
, rv_fmt_rd_offset_rs1
, NULL
, 0, 0, rv_op_lq
},
1386 { "c.sqsp", rv_codec_css_sqsp
, rv_fmt_rs2_offset_rs1
, NULL
, 0, 0,
1388 { "nop", rv_codec_i
, rv_fmt_none
, NULL
, 0, 0, 0 },
1389 { "mv", rv_codec_i
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1390 { "not", rv_codec_i
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1391 { "neg", rv_codec_r
, rv_fmt_rd_rs2
, NULL
, 0, 0, 0 },
1392 { "negw", rv_codec_r
, rv_fmt_rd_rs2
, NULL
, 0, 0, 0 },
1393 { "sext.w", rv_codec_i
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1394 { "seqz", rv_codec_i
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1395 { "snez", rv_codec_r
, rv_fmt_rd_rs2
, NULL
, 0, 0, 0 },
1396 { "sltz", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1397 { "sgtz", rv_codec_r
, rv_fmt_rd_rs2
, NULL
, 0, 0, 0 },
1398 { "fmv.s", rv_codec_r
, rv_fmt_frd_frs1
, NULL
, 0, 0, 0 },
1399 { "fabs.s", rv_codec_r
, rv_fmt_frd_frs1
, NULL
, 0, 0, 0 },
1400 { "fneg.s", rv_codec_r
, rv_fmt_frd_frs1
, NULL
, 0, 0, 0 },
1401 { "fmv.d", rv_codec_r
, rv_fmt_frd_frs1
, NULL
, 0, 0, 0 },
1402 { "fabs.d", rv_codec_r
, rv_fmt_frd_frs1
, NULL
, 0, 0, 0 },
1403 { "fneg.d", rv_codec_r
, rv_fmt_frd_frs1
, NULL
, 0, 0, 0 },
1404 { "fmv.q", rv_codec_r
, rv_fmt_frd_frs1
, NULL
, 0, 0, 0 },
1405 { "fabs.q", rv_codec_r
, rv_fmt_frd_frs1
, NULL
, 0, 0, 0 },
1406 { "fneg.q", rv_codec_r
, rv_fmt_frd_frs1
, NULL
, 0, 0, 0 },
1407 { "beqz", rv_codec_sb
, rv_fmt_rs1_offset
, NULL
, 0, 0, 0 },
1408 { "bnez", rv_codec_sb
, rv_fmt_rs1_offset
, NULL
, 0, 0, 0 },
1409 { "blez", rv_codec_sb
, rv_fmt_rs2_offset
, NULL
, 0, 0, 0 },
1410 { "bgez", rv_codec_sb
, rv_fmt_rs1_offset
, NULL
, 0, 0, 0 },
1411 { "bltz", rv_codec_sb
, rv_fmt_rs1_offset
, NULL
, 0, 0, 0 },
1412 { "bgtz", rv_codec_sb
, rv_fmt_rs2_offset
, NULL
, 0, 0, 0 },
1413 { "ble", rv_codec_sb
, rv_fmt_rs2_rs1_offset
, NULL
, 0, 0, 0 },
1414 { "bleu", rv_codec_sb
, rv_fmt_rs2_rs1_offset
, NULL
, 0, 0, 0 },
1415 { "bgt", rv_codec_sb
, rv_fmt_rs2_rs1_offset
, NULL
, 0, 0, 0 },
1416 { "bgtu", rv_codec_sb
, rv_fmt_rs2_rs1_offset
, NULL
, 0, 0, 0 },
1417 { "j", rv_codec_uj
, rv_fmt_offset
, NULL
, 0, 0, 0 },
1418 { "ret", rv_codec_i
, rv_fmt_none
, NULL
, 0, 0, 0 },
1419 { "jr", rv_codec_i
, rv_fmt_rs1
, NULL
, 0, 0, 0 },
1420 { "rdcycle", rv_codec_i_csr
, rv_fmt_rd
, NULL
, 0, 0, 0 },
1421 { "rdtime", rv_codec_i_csr
, rv_fmt_rd
, NULL
, 0, 0, 0 },
1422 { "rdinstret", rv_codec_i_csr
, rv_fmt_rd
, NULL
, 0, 0, 0 },
1423 { "rdcycleh", rv_codec_i_csr
, rv_fmt_rd
, NULL
, 0, 0, 0 },
1424 { "rdtimeh", rv_codec_i_csr
, rv_fmt_rd
, NULL
, 0, 0, 0 },
1425 { "rdinstreth", rv_codec_i_csr
, rv_fmt_rd
, NULL
, 0, 0, 0 },
1426 { "frcsr", rv_codec_i_csr
, rv_fmt_rd
, NULL
, 0, 0, 0 },
1427 { "frrm", rv_codec_i_csr
, rv_fmt_rd
, NULL
, 0, 0, 0 },
1428 { "frflags", rv_codec_i_csr
, rv_fmt_rd
, NULL
, 0, 0, 0 },
1429 { "fscsr", rv_codec_i_csr
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1430 { "fsrm", rv_codec_i_csr
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1431 { "fsflags", rv_codec_i_csr
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1432 { "fsrmi", rv_codec_i_csr
, rv_fmt_rd_zimm
, NULL
, 0, 0, 0 },
1433 { "fsflagsi", rv_codec_i_csr
, rv_fmt_rd_zimm
, NULL
, 0, 0, 0 },
1434 { "bseti", rv_codec_i_sh7
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1435 { "bclri", rv_codec_i_sh7
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1436 { "binvi", rv_codec_i_sh7
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1437 { "bexti", rv_codec_i_sh7
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1438 { "rori", rv_codec_i_sh7
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1439 { "clz", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1440 { "ctz", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1441 { "cpop", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1442 { "sext.h", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1443 { "sext.b", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1444 { "xnor", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1445 { "orn", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1446 { "andn", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1447 { "rol", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1448 { "ror", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1449 { "sh1add", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1450 { "sh2add", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1451 { "sh3add", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1452 { "sh1add.uw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1453 { "sh2add.uw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1454 { "sh3add.uw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1455 { "clmul", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1456 { "clmulr", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1457 { "clmulh", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1458 { "min", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1459 { "minu", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1460 { "max", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1461 { "maxu", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1462 { "clzw", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1463 { "ctzw", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1464 { "cpopw", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1465 { "slli.uw", rv_codec_i_sh6
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1466 { "add.uw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1467 { "rolw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1468 { "rorw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1469 { "rev8", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1470 { "zext.h", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1471 { "roriw", rv_codec_i_sh5
, rv_fmt_rd_rs1_imm
, NULL
, 0, 0, 0 },
1472 { "orc.b", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1473 { "bset", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1474 { "bclr", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1475 { "binv", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1476 { "bext", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1477 { "aes32esmi", rv_codec_k_bs
, rv_fmt_rs1_rs2_bs
, NULL
, 0, 0, 0 },
1478 { "aes32esi", rv_codec_k_bs
, rv_fmt_rs1_rs2_bs
, NULL
, 0, 0, 0 },
1479 { "aes32dsmi", rv_codec_k_bs
, rv_fmt_rs1_rs2_bs
, NULL
, 0, 0, 0 },
1480 { "aes32dsi", rv_codec_k_bs
, rv_fmt_rs1_rs2_bs
, NULL
, 0, 0, 0 },
1481 { "aes64ks1i", rv_codec_k_rnum
, rv_fmt_rd_rs1_rnum
, NULL
, 0, 0, 0 },
1482 { "aes64ks2", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1483 { "aes64im", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0 },
1484 { "aes64esm", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1485 { "aes64es", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1486 { "aes64dsm", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1487 { "aes64ds", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1488 { "sha256sig0", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0 },
1489 { "sha256sig1", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0 },
1490 { "sha256sum0", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0 },
1491 { "sha256sum1", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0 },
1492 { "sha512sig0", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1493 { "sha512sig1", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1494 { "sha512sum0", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1495 { "sha512sum1", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1496 { "sha512sum0r", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1497 { "sha512sum1r", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1498 { "sha512sig0l", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1499 { "sha512sig0h", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1500 { "sha512sig1l", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1501 { "sha512sig1h", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1502 { "sm3p0", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0 },
1503 { "sm3p1", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0 },
1504 { "sm4ed", rv_codec_k_bs
, rv_fmt_rs1_rs2_bs
, NULL
, 0, 0, 0 },
1505 { "sm4ks", rv_codec_k_bs
, rv_fmt_rs1_rs2_bs
, NULL
, 0, 0, 0 },
1506 { "brev8", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1507 { "pack", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1508 { "packh", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1509 { "packw", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1510 { "unzip", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1511 { "zip", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1512 { "xperm4", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1513 { "xperm8", rv_codec_r
, rv_fmt_rd_rs1
, NULL
, 0, 0, 0 },
1514 { "vle8.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1515 { "vle16.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1516 { "vle32.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1517 { "vle64.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1518 { "vse8.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1519 { "vse16.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1520 { "vse32.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1521 { "vse64.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1522 { "vlm.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1523 { "vsm.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1524 { "vlse8.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_rs2_vm
, NULL
, 0, 0, 0 },
1525 { "vlse16.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_rs2_vm
, NULL
, 0, 0, 0 },
1526 { "vlse32.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_rs2_vm
, NULL
, 0, 0, 0 },
1527 { "vlse64.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_rs2_vm
, NULL
, 0, 0, 0 },
1528 { "vsse8.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_rs2_vm
, NULL
, 0, 0, 0 },
1529 { "vsse16.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_rs2_vm
, NULL
, 0, 0, 0 },
1530 { "vsse32.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_rs2_vm
, NULL
, 0, 0, 0 },
1531 { "vsse64.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_rs2_vm
, NULL
, 0, 0, 0 },
1532 { "vluxei8.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1533 { "vluxei16.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1534 { "vluxei32.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1535 { "vluxei64.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1536 { "vloxei8.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1537 { "vloxei16.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1538 { "vloxei32.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1539 { "vloxei64.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1540 { "vsuxei8.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1541 { "vsuxei16.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1542 { "vsuxei32.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1543 { "vsuxei64.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1544 { "vsoxei8.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1545 { "vsoxei16.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1546 { "vsoxei32.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1547 { "vsoxei64.v", rv_codec_v_r
, rv_fmt_ldst_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1548 { "vle8ff.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1549 { "vle16ff.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1550 { "vle32ff.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1551 { "vle64ff.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1552 { "vl1re8.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1553 { "vl1re16.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1554 { "vl1re32.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1555 { "vl1re64.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1556 { "vl2re8.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1557 { "vl2re16.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1558 { "vl2re32.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1559 { "vl2re64.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1560 { "vl4re8.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1561 { "vl4re16.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1562 { "vl4re32.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1563 { "vl4re64.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1564 { "vl8re8.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1565 { "vl8re16.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1566 { "vl8re32.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1567 { "vl8re64.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1568 { "vs1r.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1569 { "vs2r.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1570 { "vs4r.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1571 { "vs8r.v", rv_codec_v_ldst
, rv_fmt_ldst_vd_rs1_vm
, NULL
, 0, 0, 0 },
1572 { "vadd.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1573 { "vadd.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1574 { "vadd.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1575 { "vsub.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1576 { "vsub.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1577 { "vrsub.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1578 { "vrsub.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1579 { "vwaddu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1580 { "vwaddu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1581 { "vwadd.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1582 { "vwadd.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1583 { "vwsubu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1584 { "vwsubu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1585 { "vwsub.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1586 { "vwsub.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1587 { "vwaddu.wv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1588 { "vwaddu.wx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1589 { "vwadd.wv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1590 { "vwadd.wx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1591 { "vwsubu.wv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1592 { "vwsubu.wx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1593 { "vwsub.wv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1594 { "vwsub.wx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1595 { "vadc.vvm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vl
, NULL
, 0, 0, 0 },
1596 { "vadc.vxm", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vl
, NULL
, 0, 0, 0 },
1597 { "vadc.vim", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vl
, NULL
, 0, 0, 0 },
1598 { "vmadc.vvm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vl
, NULL
, 0, 0, 0 },
1599 { "vmadc.vxm", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vl
, NULL
, 0, 0, 0 },
1600 { "vmadc.vim", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vl
, NULL
, 0, 0, 0 },
1601 { "vsbc.vvm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vl
, NULL
, 0, 0, 0 },
1602 { "vsbc.vxm", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vl
, NULL
, 0, 0, 0 },
1603 { "vmsbc.vvm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vl
, NULL
, 0, 0, 0 },
1604 { "vmsbc.vxm", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vl
, NULL
, 0, 0, 0 },
1605 { "vand.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1606 { "vand.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1607 { "vand.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1608 { "vor.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1609 { "vor.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1610 { "vor.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1611 { "vxor.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1612 { "vxor.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1613 { "vxor.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1614 { "vsll.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1615 { "vsll.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1616 { "vsll.vi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1617 { "vsrl.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1618 { "vsrl.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1619 { "vsrl.vi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1620 { "vsra.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1621 { "vsra.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1622 { "vsra.vi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1623 { "vnsrl.wv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1624 { "vnsrl.wx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1625 { "vnsrl.wi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1626 { "vnsra.wv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1627 { "vnsra.wx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1628 { "vnsra.wi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1629 { "vmseq.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1630 { "vmseq.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1631 { "vmseq.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1632 { "vmsne.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1633 { "vmsne.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1634 { "vmsne.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1635 { "vmsltu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1636 { "vmsltu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1637 { "vmslt.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1638 { "vmslt.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1639 { "vmsleu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1640 { "vmsleu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1641 { "vmsleu.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1642 { "vmsle.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1643 { "vmsle.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1644 { "vmsle.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1645 { "vmsgtu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1646 { "vmsgtu.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1647 { "vmsgt.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1648 { "vmsgt.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1649 { "vminu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1650 { "vminu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1651 { "vmin.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1652 { "vmin.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1653 { "vmaxu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1654 { "vmaxu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1655 { "vmax.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1656 { "vmax.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1657 { "vmul.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1658 { "vmul.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1659 { "vmulh.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1660 { "vmulh.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1661 { "vmulhu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1662 { "vmulhu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1663 { "vmulhsu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1664 { "vmulhsu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1665 { "vdivu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1666 { "vdivu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1667 { "vdiv.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1668 { "vdiv.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1669 { "vremu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1670 { "vremu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1671 { "vrem.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1672 { "vrem.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1673 { "vwmulu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1674 { "vwmulu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1675 { "vwmulsu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1676 { "vwmulsu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1677 { "vwmul.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1678 { "vwmul.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1679 { "vmacc.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1680 { "vmacc.vx", rv_codec_v_r
, rv_fmt_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1681 { "vnmsac.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1682 { "vnmsac.vx", rv_codec_v_r
, rv_fmt_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1683 { "vmadd.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1684 { "vmadd.vx", rv_codec_v_r
, rv_fmt_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1685 { "vnmsub.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1686 { "vnmsub.vx", rv_codec_v_r
, rv_fmt_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1687 { "vwmaccu.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1688 { "vwmaccu.vx", rv_codec_v_r
, rv_fmt_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1689 { "vwmacc.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1690 { "vwmacc.vx", rv_codec_v_r
, rv_fmt_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1691 { "vwmaccsu.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1692 { "vwmaccsu.vx", rv_codec_v_r
, rv_fmt_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1693 { "vwmaccus.vx", rv_codec_v_r
, rv_fmt_vd_rs1_vs2_vm
, NULL
, 0, 0, 0 },
1694 { "vmv.v.v", rv_codec_v_r
, rv_fmt_vd_vs1
, NULL
, 0, 0, 0 },
1695 { "vmv.v.x", rv_codec_v_r
, rv_fmt_vd_rs1
, NULL
, 0, 0, 0 },
1696 { "vmv.v.i", rv_codec_v_i
, rv_fmt_vd_imm
, NULL
, 0, 0, 0 },
1697 { "vmerge.vvm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vl
, NULL
, 0, 0, 0 },
1698 { "vmerge.vxm", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vl
, NULL
, 0, 0, 0 },
1699 { "vmerge.vim", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vl
, NULL
, 0, 0, 0 },
1700 { "vsaddu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1701 { "vsaddu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1702 { "vsaddu.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1703 { "vsadd.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1704 { "vsadd.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1705 { "vsadd.vi", rv_codec_v_i
, rv_fmt_vd_vs2_imm_vm
, NULL
, 0, 0, 0 },
1706 { "vssubu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1707 { "vssubu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1708 { "vssub.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1709 { "vssub.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1710 { "vaadd.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1711 { "vaadd.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1712 { "vaaddu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1713 { "vaaddu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1714 { "vasub.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1715 { "vasub.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1716 { "vasubu.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1717 { "vasubu.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1718 { "vsmul.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1719 { "vsmul.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1720 { "vssrl.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1721 { "vssrl.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1722 { "vssrl.vi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1723 { "vssra.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1724 { "vssra.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1725 { "vssra.vi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1726 { "vnclipu.wv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1727 { "vnclipu.wx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1728 { "vnclipu.wi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1729 { "vnclip.wv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1730 { "vnclip.wx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1731 { "vnclip.wi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1732 { "vfadd.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1733 { "vfadd.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1734 { "vfsub.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1735 { "vfsub.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1736 { "vfrsub.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1737 { "vfwadd.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1738 { "vfwadd.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1739 { "vfwadd.wv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1740 { "vfwadd.wf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1741 { "vfwsub.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1742 { "vfwsub.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1743 { "vfwsub.wv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1744 { "vfwsub.wf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1745 { "vfmul.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1746 { "vfmul.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1747 { "vfdiv.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1748 { "vfdiv.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1749 { "vfrdiv.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1750 { "vfwmul.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1751 { "vfwmul.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1752 { "vfmacc.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1753 { "vfmacc.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1754 { "vfnmacc.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1755 { "vfnmacc.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1756 { "vfmsac.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1757 { "vfmsac.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1758 { "vfnmsac.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1759 { "vfnmsac.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1760 { "vfmadd.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1761 { "vfmadd.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1762 { "vfnmadd.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1763 { "vfnmadd.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1764 { "vfmsub.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1765 { "vfmsub.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1766 { "vfnmsub.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1767 { "vfnmsub.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1768 { "vfwmacc.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1769 { "vfwmacc.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1770 { "vfwnmacc.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1771 { "vfwnmacc.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1772 { "vfwmsac.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1773 { "vfwmsac.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1774 { "vfwnmsac.vv", rv_codec_v_r
, rv_fmt_vd_vs1_vs2_vm
, NULL
, 0, 0, 0 },
1775 { "vfwnmsac.vf", rv_codec_v_r
, rv_fmt_vd_fs1_vs2_vm
, NULL
, 0, 0, 0 },
1776 { "vfsqrt.v", rv_codec_v_r
, rv_fmt_vd_vs2
, NULL
, 0, 0, 0 },
1777 { "vfrsqrt7.v", rv_codec_v_r
, rv_fmt_vd_vs2
, NULL
, 0, 0, 0 },
1778 { "vfrec7.v", rv_codec_v_r
, rv_fmt_vd_vs2
, NULL
, 0, 0, 0 },
1779 { "vfmin.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1780 { "vfmin.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1781 { "vfmax.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1782 { "vfmax.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1783 { "vfsgnj.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1784 { "vfsgnj.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1785 { "vfsgnjn.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1786 { "vfsgnjn.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1787 { "vfsgnjx.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1788 { "vfsgnjx.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1789 { "vfslide1up.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1790 { "vfslide1down.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1791 { "vmfeq.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1792 { "vmfeq.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1793 { "vmfne.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1794 { "vmfne.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1795 { "vmflt.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1796 { "vmflt.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1797 { "vmfle.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1798 { "vmfle.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1799 { "vmfgt.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1800 { "vmfge.vf", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vm
, NULL
, 0, 0, 0 },
1801 { "vfclass.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1802 { "vfmerge.vfm", rv_codec_v_r
, rv_fmt_vd_vs2_fs1_vl
, NULL
, 0, 0, 0 },
1803 { "vfmv.v.f", rv_codec_v_r
, rv_fmt_vd_fs1
, NULL
, 0, 0, 0 },
1804 { "vfcvt.xu.f.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1805 { "vfcvt.x.f.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1806 { "vfcvt.f.xu.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1807 { "vfcvt.f.x.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1808 { "vfcvt.rtz.xu.f.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1809 { "vfcvt.rtz.x.f.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1810 { "vfwcvt.xu.f.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1811 { "vfwcvt.x.f.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1812 { "vfwcvt.f.xu.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1813 { "vfwcvt.f.x.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1814 { "vfwcvt.f.f.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1815 { "vfwcvt.rtz.xu.f.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1816 { "vfwcvt.rtz.x.f.v", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1817 { "vfncvt.xu.f.w", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1818 { "vfncvt.x.f.w", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1819 { "vfncvt.f.xu.w", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1820 { "vfncvt.f.x.w", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1821 { "vfncvt.f.f.w", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1822 { "vfncvt.rod.f.f.w", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1823 { "vfncvt.rtz.xu.f.w", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1824 { "vfncvt.rtz.x.f.w", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1825 { "vredsum.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1826 { "vredand.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1827 { "vredor.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1828 { "vredxor.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1829 { "vredminu.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1830 { "vredmin.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1831 { "vredmaxu.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1832 { "vredmax.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1833 { "vwredsumu.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1834 { "vwredsum.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1835 { "vfredusum.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1836 { "vfredosum.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1837 { "vfredmin.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1838 { "vfredmax.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1839 { "vfwredusum.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1840 { "vfwredosum.vs", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1841 { "vmand.mm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1842 { "vmnand.mm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1843 { "vmandn.mm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1844 { "vmxor.mm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1845 { "vmor.mm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1846 { "vmnor.mm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1847 { "vmorn.mm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1848 { "vmxnor.mm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1849 { "vcpop.m", rv_codec_v_r
, rv_fmt_rd_vs2_vm
, NULL
, 0, 0, 0 },
1850 { "vfirst.m", rv_codec_v_r
, rv_fmt_rd_vs2_vm
, NULL
, 0, 0, 0 },
1851 { "vmsbf.m", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1852 { "vmsif.m", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1853 { "vmsof.m", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1854 { "viota.m", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1855 { "vid.v", rv_codec_v_r
, rv_fmt_vd_vm
, NULL
, 0, 0, 0 },
1856 { "vmv.x.s", rv_codec_v_r
, rv_fmt_rd_vs2
, NULL
, 0, 0, 0 },
1857 { "vmv.s.x", rv_codec_v_r
, rv_fmt_vd_rs1
, NULL
, 0, 0, 0 },
1858 { "vfmv.f.s", rv_codec_v_r
, rv_fmt_fd_vs2
, NULL
, 0, 0, 0 },
1859 { "vfmv.s.f", rv_codec_v_r
, rv_fmt_vd_fs1
, NULL
, 0, 0, 0 },
1860 { "vslideup.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1861 { "vslideup.vi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1862 { "vslide1up.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1863 { "vslidedown.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1864 { "vslidedown.vi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1865 { "vslide1down.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1866 { "vrgather.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1867 { "vrgatherei16.vv", rv_codec_v_r
, rv_fmt_vd_vs2_vs1_vm
, NULL
, 0, 0, 0 },
1868 { "vrgather.vx", rv_codec_v_r
, rv_fmt_vd_vs2_rs1_vm
, NULL
, 0, 0, 0 },
1869 { "vrgather.vi", rv_codec_v_i
, rv_fmt_vd_vs2_uimm_vm
, NULL
, 0, 0, 0 },
1870 { "vcompress.vm", rv_codec_v_r
, rv_fmt_vd_vs2_vs1
, NULL
, 0, 0, 0 },
1871 { "vmv1r.v", rv_codec_v_r
, rv_fmt_vd_vs2
, NULL
, 0, 0, 0 },
1872 { "vmv2r.v", rv_codec_v_r
, rv_fmt_vd_vs2
, NULL
, 0, 0, 0 },
1873 { "vmv4r.v", rv_codec_v_r
, rv_fmt_vd_vs2
, NULL
, 0, 0, 0 },
1874 { "vmv8r.v", rv_codec_v_r
, rv_fmt_vd_vs2
, NULL
, 0, 0, 0 },
1875 { "vzext.vf2", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1876 { "vzext.vf4", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1877 { "vzext.vf8", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1878 { "vsext.vf2", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1879 { "vsext.vf4", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1880 { "vsext.vf8", rv_codec_v_r
, rv_fmt_vd_vs2_vm
, NULL
, 0, 0, 0 },
1881 { "vsetvli", rv_codec_vsetvli
, rv_fmt_vsetvli
, NULL
, 0, 0, 0 },
1882 { "vsetivli", rv_codec_vsetivli
, rv_fmt_vsetivli
, NULL
, 0, 0, 0 },
1883 { "vsetvl", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1884 { "c.zext.b", rv_codec_zcb_ext
, rv_fmt_rd
, NULL
, 0 },
1885 { "c.sext.b", rv_codec_zcb_ext
, rv_fmt_rd
, NULL
, 0 },
1886 { "c.zext.h", rv_codec_zcb_ext
, rv_fmt_rd
, NULL
, 0 },
1887 { "c.sext.h", rv_codec_zcb_ext
, rv_fmt_rd
, NULL
, 0 },
1888 { "c.zext.w", rv_codec_zcb_ext
, rv_fmt_rd
, NULL
, 0 },
1889 { "c.not", rv_codec_zcb_ext
, rv_fmt_rd
, NULL
, 0 },
1890 { "c.mul", rv_codec_zcb_mul
, rv_fmt_rd_rs2
, NULL
, 0, 0 },
1891 { "c.lbu", rv_codec_zcb_lb
, rv_fmt_rs1_rs2_zce_ldst
, NULL
, 0, 0, 0 },
1892 { "c.lhu", rv_codec_zcb_lh
, rv_fmt_rs1_rs2_zce_ldst
, NULL
, 0, 0, 0 },
1893 { "c.lh", rv_codec_zcb_lh
, rv_fmt_rs1_rs2_zce_ldst
, NULL
, 0, 0, 0 },
1894 { "c.sb", rv_codec_zcb_lb
, rv_fmt_rs1_rs2_zce_ldst
, NULL
, 0, 0, 0 },
1895 { "c.sh", rv_codec_zcb_lh
, rv_fmt_rs1_rs2_zce_ldst
, NULL
, 0, 0, 0 },
1896 { "cm.push", rv_codec_zcmp_cm_pushpop
, rv_fmt_push_rlist
, NULL
, 0, 0 },
1897 { "cm.pop", rv_codec_zcmp_cm_pushpop
, rv_fmt_pop_rlist
, NULL
, 0, 0 },
1898 { "cm.popret", rv_codec_zcmp_cm_pushpop
, rv_fmt_pop_rlist
, NULL
, 0, 0, 0 },
1899 { "cm.popretz", rv_codec_zcmp_cm_pushpop
, rv_fmt_pop_rlist
, NULL
, 0, 0 },
1900 { "cm.mva01s", rv_codec_zcmp_cm_mv
, rv_fmt_rd_rs2
, NULL
, 0, 0, 0 },
1901 { "cm.mvsa01", rv_codec_zcmp_cm_mv
, rv_fmt_rd_rs2
, NULL
, 0, 0, 0 },
1902 { "cm.jt", rv_codec_zcmt_jt
, rv_fmt_zcmt_index
, NULL
, 0 },
1903 { "cm.jalt", rv_codec_zcmt_jt
, rv_fmt_zcmt_index
, NULL
, 0 },
1904 { "czero.eqz", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1905 { "czero.nez", rv_codec_r
, rv_fmt_rd_rs1_rs2
, NULL
, 0, 0, 0 },
1910 static const char *csr_name(int csrno
)
1913 case 0x0000: return "ustatus";
1914 case 0x0001: return "fflags";
1915 case 0x0002: return "frm";
1916 case 0x0003: return "fcsr";
1917 case 0x0004: return "uie";
1918 case 0x0005: return "utvec";
1919 case 0x0008: return "vstart";
1920 case 0x0009: return "vxsat";
1921 case 0x000a: return "vxrm";
1922 case 0x000f: return "vcsr";
1923 case 0x0015: return "seed";
1924 case 0x0017: return "jvt";
1925 case 0x0040: return "uscratch";
1926 case 0x0041: return "uepc";
1927 case 0x0042: return "ucause";
1928 case 0x0043: return "utval";
1929 case 0x0044: return "uip";
1930 case 0x0100: return "sstatus";
1931 case 0x0104: return "sie";
1932 case 0x0105: return "stvec";
1933 case 0x0106: return "scounteren";
1934 case 0x0140: return "sscratch";
1935 case 0x0141: return "sepc";
1936 case 0x0142: return "scause";
1937 case 0x0143: return "stval";
1938 case 0x0144: return "sip";
1939 case 0x0180: return "satp";
1940 case 0x0200: return "hstatus";
1941 case 0x0202: return "hedeleg";
1942 case 0x0203: return "hideleg";
1943 case 0x0204: return "hie";
1944 case 0x0205: return "htvec";
1945 case 0x0240: return "hscratch";
1946 case 0x0241: return "hepc";
1947 case 0x0242: return "hcause";
1948 case 0x0243: return "hbadaddr";
1949 case 0x0244: return "hip";
1950 case 0x0300: return "mstatus";
1951 case 0x0301: return "misa";
1952 case 0x0302: return "medeleg";
1953 case 0x0303: return "mideleg";
1954 case 0x0304: return "mie";
1955 case 0x0305: return "mtvec";
1956 case 0x0306: return "mcounteren";
1957 case 0x0320: return "mucounteren";
1958 case 0x0321: return "mscounteren";
1959 case 0x0322: return "mhcounteren";
1960 case 0x0323: return "mhpmevent3";
1961 case 0x0324: return "mhpmevent4";
1962 case 0x0325: return "mhpmevent5";
1963 case 0x0326: return "mhpmevent6";
1964 case 0x0327: return "mhpmevent7";
1965 case 0x0328: return "mhpmevent8";
1966 case 0x0329: return "mhpmevent9";
1967 case 0x032a: return "mhpmevent10";
1968 case 0x032b: return "mhpmevent11";
1969 case 0x032c: return "mhpmevent12";
1970 case 0x032d: return "mhpmevent13";
1971 case 0x032e: return "mhpmevent14";
1972 case 0x032f: return "mhpmevent15";
1973 case 0x0330: return "mhpmevent16";
1974 case 0x0331: return "mhpmevent17";
1975 case 0x0332: return "mhpmevent18";
1976 case 0x0333: return "mhpmevent19";
1977 case 0x0334: return "mhpmevent20";
1978 case 0x0335: return "mhpmevent21";
1979 case 0x0336: return "mhpmevent22";
1980 case 0x0337: return "mhpmevent23";
1981 case 0x0338: return "mhpmevent24";
1982 case 0x0339: return "mhpmevent25";
1983 case 0x033a: return "mhpmevent26";
1984 case 0x033b: return "mhpmevent27";
1985 case 0x033c: return "mhpmevent28";
1986 case 0x033d: return "mhpmevent29";
1987 case 0x033e: return "mhpmevent30";
1988 case 0x033f: return "mhpmevent31";
1989 case 0x0340: return "mscratch";
1990 case 0x0341: return "mepc";
1991 case 0x0342: return "mcause";
1992 case 0x0343: return "mtval";
1993 case 0x0344: return "mip";
1994 case 0x0380: return "mbase";
1995 case 0x0381: return "mbound";
1996 case 0x0382: return "mibase";
1997 case 0x0383: return "mibound";
1998 case 0x0384: return "mdbase";
1999 case 0x0385: return "mdbound";
2000 case 0x03a0: return "pmpcfg3";
2001 case 0x03b0: return "pmpaddr0";
2002 case 0x03b1: return "pmpaddr1";
2003 case 0x03b2: return "pmpaddr2";
2004 case 0x03b3: return "pmpaddr3";
2005 case 0x03b4: return "pmpaddr4";
2006 case 0x03b5: return "pmpaddr5";
2007 case 0x03b6: return "pmpaddr6";
2008 case 0x03b7: return "pmpaddr7";
2009 case 0x03b8: return "pmpaddr8";
2010 case 0x03b9: return "pmpaddr9";
2011 case 0x03ba: return "pmpaddr10";
2012 case 0x03bb: return "pmpaddr11";
2013 case 0x03bc: return "pmpaddr12";
2014 case 0x03bd: return "pmpaddr14";
2015 case 0x03be: return "pmpaddr13";
2016 case 0x03bf: return "pmpaddr15";
2017 case 0x0780: return "mtohost";
2018 case 0x0781: return "mfromhost";
2019 case 0x0782: return "mreset";
2020 case 0x0783: return "mipi";
2021 case 0x0784: return "miobase";
2022 case 0x07a0: return "tselect";
2023 case 0x07a1: return "tdata1";
2024 case 0x07a2: return "tdata2";
2025 case 0x07a3: return "tdata3";
2026 case 0x07b0: return "dcsr";
2027 case 0x07b1: return "dpc";
2028 case 0x07b2: return "dscratch";
2029 case 0x0b00: return "mcycle";
2030 case 0x0b01: return "mtime";
2031 case 0x0b02: return "minstret";
2032 case 0x0b03: return "mhpmcounter3";
2033 case 0x0b04: return "mhpmcounter4";
2034 case 0x0b05: return "mhpmcounter5";
2035 case 0x0b06: return "mhpmcounter6";
2036 case 0x0b07: return "mhpmcounter7";
2037 case 0x0b08: return "mhpmcounter8";
2038 case 0x0b09: return "mhpmcounter9";
2039 case 0x0b0a: return "mhpmcounter10";
2040 case 0x0b0b: return "mhpmcounter11";
2041 case 0x0b0c: return "mhpmcounter12";
2042 case 0x0b0d: return "mhpmcounter13";
2043 case 0x0b0e: return "mhpmcounter14";
2044 case 0x0b0f: return "mhpmcounter15";
2045 case 0x0b10: return "mhpmcounter16";
2046 case 0x0b11: return "mhpmcounter17";
2047 case 0x0b12: return "mhpmcounter18";
2048 case 0x0b13: return "mhpmcounter19";
2049 case 0x0b14: return "mhpmcounter20";
2050 case 0x0b15: return "mhpmcounter21";
2051 case 0x0b16: return "mhpmcounter22";
2052 case 0x0b17: return "mhpmcounter23";
2053 case 0x0b18: return "mhpmcounter24";
2054 case 0x0b19: return "mhpmcounter25";
2055 case 0x0b1a: return "mhpmcounter26";
2056 case 0x0b1b: return "mhpmcounter27";
2057 case 0x0b1c: return "mhpmcounter28";
2058 case 0x0b1d: return "mhpmcounter29";
2059 case 0x0b1e: return "mhpmcounter30";
2060 case 0x0b1f: return "mhpmcounter31";
2061 case 0x0b80: return "mcycleh";
2062 case 0x0b81: return "mtimeh";
2063 case 0x0b82: return "minstreth";
2064 case 0x0b83: return "mhpmcounter3h";
2065 case 0x0b84: return "mhpmcounter4h";
2066 case 0x0b85: return "mhpmcounter5h";
2067 case 0x0b86: return "mhpmcounter6h";
2068 case 0x0b87: return "mhpmcounter7h";
2069 case 0x0b88: return "mhpmcounter8h";
2070 case 0x0b89: return "mhpmcounter9h";
2071 case 0x0b8a: return "mhpmcounter10h";
2072 case 0x0b8b: return "mhpmcounter11h";
2073 case 0x0b8c: return "mhpmcounter12h";
2074 case 0x0b8d: return "mhpmcounter13h";
2075 case 0x0b8e: return "mhpmcounter14h";
2076 case 0x0b8f: return "mhpmcounter15h";
2077 case 0x0b90: return "mhpmcounter16h";
2078 case 0x0b91: return "mhpmcounter17h";
2079 case 0x0b92: return "mhpmcounter18h";
2080 case 0x0b93: return "mhpmcounter19h";
2081 case 0x0b94: return "mhpmcounter20h";
2082 case 0x0b95: return "mhpmcounter21h";
2083 case 0x0b96: return "mhpmcounter22h";
2084 case 0x0b97: return "mhpmcounter23h";
2085 case 0x0b98: return "mhpmcounter24h";
2086 case 0x0b99: return "mhpmcounter25h";
2087 case 0x0b9a: return "mhpmcounter26h";
2088 case 0x0b9b: return "mhpmcounter27h";
2089 case 0x0b9c: return "mhpmcounter28h";
2090 case 0x0b9d: return "mhpmcounter29h";
2091 case 0x0b9e: return "mhpmcounter30h";
2092 case 0x0b9f: return "mhpmcounter31h";
2093 case 0x0c00: return "cycle";
2094 case 0x0c01: return "time";
2095 case 0x0c02: return "instret";
2096 case 0x0c20: return "vl";
2097 case 0x0c21: return "vtype";
2098 case 0x0c22: return "vlenb";
2099 case 0x0c80: return "cycleh";
2100 case 0x0c81: return "timeh";
2101 case 0x0c82: return "instreth";
2102 case 0x0d00: return "scycle";
2103 case 0x0d01: return "stime";
2104 case 0x0d02: return "sinstret";
2105 case 0x0d80: return "scycleh";
2106 case 0x0d81: return "stimeh";
2107 case 0x0d82: return "sinstreth";
2108 case 0x0e00: return "hcycle";
2109 case 0x0e01: return "htime";
2110 case 0x0e02: return "hinstret";
2111 case 0x0e80: return "hcycleh";
2112 case 0x0e81: return "htimeh";
2113 case 0x0e82: return "hinstreth";
2114 case 0x0f11: return "mvendorid";
2115 case 0x0f12: return "marchid";
2116 case 0x0f13: return "mimpid";
2117 case 0x0f14: return "mhartid";
2118 default: return NULL
;
2124 static void decode_inst_opcode(rv_decode
*dec
, rv_isa isa
)
2126 rv_inst inst
= dec
->inst
;
2127 rv_opcode op
= rv_op_illegal
;
2128 switch ((inst
>> 0) & 0b11) {
2130 switch ((inst
>> 13) & 0b111) {
2131 case 0: op
= rv_op_c_addi4spn
; break;
2139 case 2: op
= rv_op_c_lw
; break;
2148 switch ((inst
>> 10) & 0b111) {
2149 case 0: op
= rv_op_c_lbu
; break;
2151 if (((inst
>> 6) & 1) == 0) {
2157 case 2: op
= rv_op_c_sb
; break;
2159 if (((inst
>> 6) & 1) == 0) {
2172 case 6: op
= rv_op_c_sw
; break;
2183 switch ((inst
>> 13) & 0b111) {
2185 switch ((inst
>> 2) & 0b11111111111) {
2186 case 0: op
= rv_op_c_nop
; break;
2187 default: op
= rv_op_c_addi
; break;
2197 case 2: op
= rv_op_c_li
; break;
2199 switch ((inst
>> 7) & 0b11111) {
2200 case 2: op
= rv_op_c_addi16sp
; break;
2201 default: op
= rv_op_c_lui
; break;
2205 switch ((inst
>> 10) & 0b11) {
2212 case 2: op
= rv_op_c_andi
; break;
2214 switch (((inst
>> 10) & 0b100) | ((inst
>> 5) & 0b011)) {
2215 case 0: op
= rv_op_c_sub
; break;
2216 case 1: op
= rv_op_c_xor
; break;
2217 case 2: op
= rv_op_c_or
; break;
2218 case 3: op
= rv_op_c_and
; break;
2219 case 4: op
= rv_op_c_subw
; break;
2220 case 5: op
= rv_op_c_addw
; break;
2221 case 6: op
= rv_op_c_mul
; break;
2223 switch ((inst
>> 2) & 0b111) {
2224 case 0: op
= rv_op_c_zext_b
; break;
2225 case 1: op
= rv_op_c_sext_b
; break;
2226 case 2: op
= rv_op_c_zext_h
; break;
2227 case 3: op
= rv_op_c_sext_h
; break;
2228 case 4: op
= rv_op_c_zext_w
; break;
2229 case 5: op
= rv_op_c_not
; break;
2236 case 5: op
= rv_op_c_j
; break;
2237 case 6: op
= rv_op_c_beqz
; break;
2238 case 7: op
= rv_op_c_bnez
; break;
2242 switch ((inst
>> 13) & 0b111) {
2253 case 2: op
= rv_op_c_lwsp
; break;
2262 switch ((inst
>> 12) & 0b1) {
2264 switch ((inst
>> 2) & 0b11111) {
2265 case 0: op
= rv_op_c_jr
; break;
2266 default: op
= rv_op_c_mv
; break;
2270 switch ((inst
>> 2) & 0b11111) {
2272 switch ((inst
>> 7) & 0b11111) {
2273 case 0: op
= rv_op_c_ebreak
; break;
2274 default: op
= rv_op_c_jalr
; break;
2277 default: op
= rv_op_c_add
; break;
2287 if (dec
->cfg
->ext_zcmp
&& ((inst
>> 12) & 0b01)) {
2288 switch ((inst
>> 8) & 0b01111) {
2290 if (((inst
>> 4) & 0b01111) >= 4) {
2295 if (((inst
>> 4) & 0b01111) >= 4) {
2300 if (((inst
>> 4) & 0b01111) >= 4) {
2301 op
= rv_op_cm_popretz
;
2305 if (((inst
>> 4) & 0b01111) >= 4) {
2306 op
= rv_op_cm_popret
;
2311 switch ((inst
>> 10) & 0b011) {
2313 if (!dec
->cfg
->ext_zcmt
) {
2316 if (((inst
>> 2) & 0xFF) >= 32) {
2323 if (!dec
->cfg
->ext_zcmp
) {
2326 switch ((inst
>> 5) & 0b011) {
2327 case 1: op
= rv_op_cm_mvsa01
; break;
2328 case 3: op
= rv_op_cm_mva01s
; break;
2335 case 6: op
= rv_op_c_swsp
; break;
2346 switch ((inst
>> 2) & 0b11111) {
2348 switch ((inst
>> 12) & 0b111) {
2349 case 0: op
= rv_op_lb
; break;
2350 case 1: op
= rv_op_lh
; break;
2351 case 2: op
= rv_op_lw
; break;
2352 case 3: op
= rv_op_ld
; break;
2353 case 4: op
= rv_op_lbu
; break;
2354 case 5: op
= rv_op_lhu
; break;
2355 case 6: op
= rv_op_lwu
; break;
2356 case 7: op
= rv_op_ldu
; break;
2360 switch ((inst
>> 12) & 0b111) {
2362 switch ((inst
>> 20) & 0b111111111111) {
2363 case 40: op
= rv_op_vl1re8_v
; break;
2364 case 552: op
= rv_op_vl2re8_v
; break;
2365 case 1576: op
= rv_op_vl4re8_v
; break;
2366 case 3624: op
= rv_op_vl8re8_v
; break;
2368 switch ((inst
>> 26) & 0b111) {
2370 switch ((inst
>> 20) & 0b11111) {
2371 case 0: op
= rv_op_vle8_v
; break;
2372 case 11: op
= rv_op_vlm_v
; break;
2373 case 16: op
= rv_op_vle8ff_v
; break;
2376 case 1: op
= rv_op_vluxei8_v
; break;
2377 case 2: op
= rv_op_vlse8_v
; break;
2378 case 3: op
= rv_op_vloxei8_v
; break;
2381 case 2: op
= rv_op_flw
; break;
2382 case 3: op
= rv_op_fld
; break;
2383 case 4: op
= rv_op_flq
; break;
2385 switch ((inst
>> 20) & 0b111111111111) {
2386 case 40: op
= rv_op_vl1re16_v
; break;
2387 case 552: op
= rv_op_vl2re16_v
; break;
2388 case 1576: op
= rv_op_vl4re16_v
; break;
2389 case 3624: op
= rv_op_vl8re16_v
; break;
2391 switch ((inst
>> 26) & 0b111) {
2393 switch ((inst
>> 20) & 0b11111) {
2394 case 0: op
= rv_op_vle16_v
; break;
2395 case 16: op
= rv_op_vle16ff_v
; break;
2398 case 1: op
= rv_op_vluxei16_v
; break;
2399 case 2: op
= rv_op_vlse16_v
; break;
2400 case 3: op
= rv_op_vloxei16_v
; break;
2404 switch ((inst
>> 20) & 0b111111111111) {
2405 case 40: op
= rv_op_vl1re32_v
; break;
2406 case 552: op
= rv_op_vl2re32_v
; break;
2407 case 1576: op
= rv_op_vl4re32_v
; break;
2408 case 3624: op
= rv_op_vl8re32_v
; break;
2410 switch ((inst
>> 26) & 0b111) {
2412 switch ((inst
>> 20) & 0b11111) {
2413 case 0: op
= rv_op_vle32_v
; break;
2414 case 16: op
= rv_op_vle32ff_v
; break;
2417 case 1: op
= rv_op_vluxei32_v
; break;
2418 case 2: op
= rv_op_vlse32_v
; break;
2419 case 3: op
= rv_op_vloxei32_v
; break;
2423 switch ((inst
>> 20) & 0b111111111111) {
2424 case 40: op
= rv_op_vl1re64_v
; break;
2425 case 552: op
= rv_op_vl2re64_v
; break;
2426 case 1576: op
= rv_op_vl4re64_v
; break;
2427 case 3624: op
= rv_op_vl8re64_v
; break;
2429 switch ((inst
>> 26) & 0b111) {
2431 switch ((inst
>> 20) & 0b11111) {
2432 case 0: op
= rv_op_vle64_v
; break;
2433 case 16: op
= rv_op_vle64ff_v
; break;
2436 case 1: op
= rv_op_vluxei64_v
; break;
2437 case 2: op
= rv_op_vlse64_v
; break;
2438 case 3: op
= rv_op_vloxei64_v
; break;
2444 switch ((inst
>> 12) & 0b111) {
2445 case 0: op
= rv_op_fence
; break;
2446 case 1: op
= rv_op_fence_i
; break;
2447 case 2: op
= rv_op_lq
; break;
2451 switch ((inst
>> 12) & 0b111) {
2452 case 0: op
= rv_op_addi
; break;
2454 switch ((inst
>> 27) & 0b11111) {
2455 case 0b00000: op
= rv_op_slli
; break;
2457 switch ((inst
>> 20) & 0b1111111) {
2458 case 0b0001111: op
= rv_op_zip
; break;
2462 switch ((inst
>> 20) & 0b1111111) {
2463 case 0b0000000: op
= rv_op_sha256sum0
; break;
2464 case 0b0000001: op
= rv_op_sha256sum1
; break;
2465 case 0b0000010: op
= rv_op_sha256sig0
; break;
2466 case 0b0000011: op
= rv_op_sha256sig1
; break;
2467 case 0b0000100: op
= rv_op_sha512sum0
; break;
2468 case 0b0000101: op
= rv_op_sha512sum1
; break;
2469 case 0b0000110: op
= rv_op_sha512sig0
; break;
2470 case 0b0000111: op
= rv_op_sha512sig1
; break;
2471 case 0b0001000: op
= rv_op_sm3p0
; break;
2472 case 0b0001001: op
= rv_op_sm3p1
; break;
2475 case 0b00101: op
= rv_op_bseti
; break;
2477 switch ((inst
>> 20) & 0b1111111) {
2478 case 0b0000000: op
= rv_op_aes64im
; break;
2480 if (((inst
>> 24) & 0b0111) == 0b001) {
2481 op
= rv_op_aes64ks1i
;
2486 case 0b01001: op
= rv_op_bclri
; break;
2487 case 0b01101: op
= rv_op_binvi
; break;
2489 switch ((inst
>> 20) & 0b1111111) {
2490 case 0b0000000: op
= rv_op_clz
; break;
2491 case 0b0000001: op
= rv_op_ctz
; break;
2492 case 0b0000010: op
= rv_op_cpop
; break;
2494 case 0b0000100: op
= rv_op_sext_b
; break;
2495 case 0b0000101: op
= rv_op_sext_h
; break;
2500 case 2: op
= rv_op_slti
; break;
2501 case 3: op
= rv_op_sltiu
; break;
2502 case 4: op
= rv_op_xori
; break;
2504 switch ((inst
>> 27) & 0b11111) {
2505 case 0b00000: op
= rv_op_srli
; break;
2507 switch ((inst
>> 20) & 0b1111111) {
2508 case 0b0001111: op
= rv_op_unzip
; break;
2511 case 0b00101: op
= rv_op_orc_b
; break;
2512 case 0b01000: op
= rv_op_srai
; break;
2513 case 0b01001: op
= rv_op_bexti
; break;
2514 case 0b01100: op
= rv_op_rori
; break;
2516 switch ((inst
>> 20) & 0b1111111) {
2517 case 0b0011000: op
= rv_op_rev8
; break;
2518 case 0b0111000: op
= rv_op_rev8
; break;
2519 case 0b0000111: op
= rv_op_brev8
; break;
2524 case 6: op
= rv_op_ori
; break;
2525 case 7: op
= rv_op_andi
; break;
2528 case 5: op
= rv_op_auipc
; break;
2530 switch ((inst
>> 12) & 0b111) {
2531 case 0: op
= rv_op_addiw
; break;
2533 switch ((inst
>> 26) & 0b111111) {
2534 case 0: op
= rv_op_slliw
; break;
2535 case 2: op
= rv_op_slli_uw
; break;
2537 switch ((inst
>> 20) & 0b11111) {
2538 case 0b00000: op
= rv_op_clzw
; break;
2539 case 0b00001: op
= rv_op_ctzw
; break;
2540 case 0b00010: op
= rv_op_cpopw
; break;
2546 switch ((inst
>> 25) & 0b1111111) {
2547 case 0: op
= rv_op_srliw
; break;
2548 case 32: op
= rv_op_sraiw
; break;
2549 case 48: op
= rv_op_roriw
; break;
2555 switch ((inst
>> 12) & 0b111) {
2556 case 0: op
= rv_op_sb
; break;
2557 case 1: op
= rv_op_sh
; break;
2558 case 2: op
= rv_op_sw
; break;
2559 case 3: op
= rv_op_sd
; break;
2560 case 4: op
= rv_op_sq
; break;
2564 switch ((inst
>> 12) & 0b111) {
2566 switch ((inst
>> 20) & 0b111111111111) {
2567 case 40: op
= rv_op_vs1r_v
; break;
2568 case 552: op
= rv_op_vs2r_v
; break;
2569 case 1576: op
= rv_op_vs4r_v
; break;
2570 case 3624: op
= rv_op_vs8r_v
; break;
2572 switch ((inst
>> 26) & 0b111) {
2574 switch ((inst
>> 20) & 0b11111) {
2575 case 0: op
= rv_op_vse8_v
; break;
2576 case 11: op
= rv_op_vsm_v
; break;
2579 case 1: op
= rv_op_vsuxei8_v
; break;
2580 case 2: op
= rv_op_vsse8_v
; break;
2581 case 3: op
= rv_op_vsoxei8_v
; break;
2584 case 2: op
= rv_op_fsw
; break;
2585 case 3: op
= rv_op_fsd
; break;
2586 case 4: op
= rv_op_fsq
; break;
2588 switch ((inst
>> 26) & 0b111) {
2590 switch ((inst
>> 20) & 0b11111) {
2591 case 0: op
= rv_op_vse16_v
; break;
2594 case 1: op
= rv_op_vsuxei16_v
; break;
2595 case 2: op
= rv_op_vsse16_v
; break;
2596 case 3: op
= rv_op_vsoxei16_v
; break;
2600 switch ((inst
>> 26) & 0b111) {
2602 switch ((inst
>> 20) & 0b11111) {
2603 case 0: op
= rv_op_vse32_v
; break;
2606 case 1: op
= rv_op_vsuxei32_v
; break;
2607 case 2: op
= rv_op_vsse32_v
; break;
2608 case 3: op
= rv_op_vsoxei32_v
; break;
2612 switch ((inst
>> 26) & 0b111) {
2614 switch ((inst
>> 20) & 0b11111) {
2615 case 0: op
= rv_op_vse64_v
; break;
2618 case 1: op
= rv_op_vsuxei64_v
; break;
2619 case 2: op
= rv_op_vsse64_v
; break;
2620 case 3: op
= rv_op_vsoxei64_v
; break;
2626 switch (((inst
>> 24) & 0b11111000) |
2627 ((inst
>> 12) & 0b00000111)) {
2628 case 2: op
= rv_op_amoadd_w
; break;
2629 case 3: op
= rv_op_amoadd_d
; break;
2630 case 4: op
= rv_op_amoadd_q
; break;
2631 case 10: op
= rv_op_amoswap_w
; break;
2632 case 11: op
= rv_op_amoswap_d
; break;
2633 case 12: op
= rv_op_amoswap_q
; break;
2635 switch ((inst
>> 20) & 0b11111) {
2636 case 0: op
= rv_op_lr_w
; break;
2640 switch ((inst
>> 20) & 0b11111) {
2641 case 0: op
= rv_op_lr_d
; break;
2645 switch ((inst
>> 20) & 0b11111) {
2646 case 0: op
= rv_op_lr_q
; break;
2649 case 26: op
= rv_op_sc_w
; break;
2650 case 27: op
= rv_op_sc_d
; break;
2651 case 28: op
= rv_op_sc_q
; break;
2652 case 34: op
= rv_op_amoxor_w
; break;
2653 case 35: op
= rv_op_amoxor_d
; break;
2654 case 36: op
= rv_op_amoxor_q
; break;
2655 case 66: op
= rv_op_amoor_w
; break;
2656 case 67: op
= rv_op_amoor_d
; break;
2657 case 68: op
= rv_op_amoor_q
; break;
2658 case 98: op
= rv_op_amoand_w
; break;
2659 case 99: op
= rv_op_amoand_d
; break;
2660 case 100: op
= rv_op_amoand_q
; break;
2661 case 130: op
= rv_op_amomin_w
; break;
2662 case 131: op
= rv_op_amomin_d
; break;
2663 case 132: op
= rv_op_amomin_q
; break;
2664 case 162: op
= rv_op_amomax_w
; break;
2665 case 163: op
= rv_op_amomax_d
; break;
2666 case 164: op
= rv_op_amomax_q
; break;
2667 case 194: op
= rv_op_amominu_w
; break;
2668 case 195: op
= rv_op_amominu_d
; break;
2669 case 196: op
= rv_op_amominu_q
; break;
2670 case 226: op
= rv_op_amomaxu_w
; break;
2671 case 227: op
= rv_op_amomaxu_d
; break;
2672 case 228: op
= rv_op_amomaxu_q
; break;
2676 switch (((inst
>> 22) & 0b1111111000) |
2677 ((inst
>> 12) & 0b0000000111)) {
2678 case 0: op
= rv_op_add
; break;
2679 case 1: op
= rv_op_sll
; break;
2680 case 2: op
= rv_op_slt
; break;
2681 case 3: op
= rv_op_sltu
; break;
2682 case 4: op
= rv_op_xor
; break;
2683 case 5: op
= rv_op_srl
; break;
2684 case 6: op
= rv_op_or
; break;
2685 case 7: op
= rv_op_and
; break;
2686 case 8: op
= rv_op_mul
; break;
2687 case 9: op
= rv_op_mulh
; break;
2688 case 10: op
= rv_op_mulhsu
; break;
2689 case 11: op
= rv_op_mulhu
; break;
2690 case 12: op
= rv_op_div
; break;
2691 case 13: op
= rv_op_divu
; break;
2692 case 14: op
= rv_op_rem
; break;
2693 case 15: op
= rv_op_remu
; break;
2695 switch ((inst
>> 20) & 0b11111) {
2696 case 0: op
= rv_op_zext_h
; break;
2697 default: op
= rv_op_pack
; break;
2700 case 39: op
= rv_op_packh
; break;
2702 case 41: op
= rv_op_clmul
; break;
2703 case 42: op
= rv_op_clmulr
; break;
2704 case 43: op
= rv_op_clmulh
; break;
2705 case 44: op
= rv_op_min
; break;
2706 case 45: op
= rv_op_minu
; break;
2707 case 46: op
= rv_op_max
; break;
2708 case 47: op
= rv_op_maxu
; break;
2709 case 075: op
= rv_op_czero_eqz
; break;
2710 case 077: op
= rv_op_czero_nez
; break;
2711 case 130: op
= rv_op_sh1add
; break;
2712 case 132: op
= rv_op_sh2add
; break;
2713 case 134: op
= rv_op_sh3add
; break;
2714 case 161: op
= rv_op_bset
; break;
2715 case 162: op
= rv_op_xperm4
; break;
2716 case 164: op
= rv_op_xperm8
; break;
2717 case 200: op
= rv_op_aes64es
; break;
2718 case 216: op
= rv_op_aes64esm
; break;
2719 case 232: op
= rv_op_aes64ds
; break;
2720 case 248: op
= rv_op_aes64dsm
; break;
2721 case 256: op
= rv_op_sub
; break;
2722 case 260: op
= rv_op_xnor
; break;
2723 case 261: op
= rv_op_sra
; break;
2724 case 262: op
= rv_op_orn
; break;
2725 case 263: op
= rv_op_andn
; break;
2726 case 289: op
= rv_op_bclr
; break;
2727 case 293: op
= rv_op_bext
; break;
2728 case 320: op
= rv_op_sha512sum0r
; break;
2729 case 328: op
= rv_op_sha512sum1r
; break;
2730 case 336: op
= rv_op_sha512sig0l
; break;
2731 case 344: op
= rv_op_sha512sig1l
; break;
2732 case 368: op
= rv_op_sha512sig0h
; break;
2733 case 376: op
= rv_op_sha512sig1h
; break;
2734 case 385: op
= rv_op_rol
; break;
2735 case 389: op
= rv_op_ror
; break;
2736 case 417: op
= rv_op_binv
; break;
2737 case 504: op
= rv_op_aes64ks2
; break;
2739 switch ((inst
>> 25) & 0b0011111) {
2740 case 17: op
= rv_op_aes32esi
; break;
2741 case 19: op
= rv_op_aes32esmi
; break;
2742 case 21: op
= rv_op_aes32dsi
; break;
2743 case 23: op
= rv_op_aes32dsmi
; break;
2744 case 24: op
= rv_op_sm4ed
; break;
2745 case 26: op
= rv_op_sm4ks
; break;
2748 case 13: op
= rv_op_lui
; break;
2750 switch (((inst
>> 22) & 0b1111111000) |
2751 ((inst
>> 12) & 0b0000000111)) {
2752 case 0: op
= rv_op_addw
; break;
2753 case 1: op
= rv_op_sllw
; break;
2754 case 5: op
= rv_op_srlw
; break;
2755 case 8: op
= rv_op_mulw
; break;
2756 case 12: op
= rv_op_divw
; break;
2757 case 13: op
= rv_op_divuw
; break;
2758 case 14: op
= rv_op_remw
; break;
2759 case 15: op
= rv_op_remuw
; break;
2760 case 32: op
= rv_op_add_uw
; break;
2762 switch ((inst
>> 20) & 0b11111) {
2763 case 0: op
= rv_op_zext_h
; break;
2764 default: op
= rv_op_packw
; break;
2767 case 130: op
= rv_op_sh1add_uw
; break;
2768 case 132: op
= rv_op_sh2add_uw
; break;
2769 case 134: op
= rv_op_sh3add_uw
; break;
2770 case 256: op
= rv_op_subw
; break;
2771 case 261: op
= rv_op_sraw
; break;
2772 case 385: op
= rv_op_rolw
; break;
2773 case 389: op
= rv_op_rorw
; break;
2777 switch ((inst
>> 25) & 0b11) {
2778 case 0: op
= rv_op_fmadd_s
; break;
2779 case 1: op
= rv_op_fmadd_d
; break;
2780 case 3: op
= rv_op_fmadd_q
; break;
2784 switch ((inst
>> 25) & 0b11) {
2785 case 0: op
= rv_op_fmsub_s
; break;
2786 case 1: op
= rv_op_fmsub_d
; break;
2787 case 3: op
= rv_op_fmsub_q
; break;
2791 switch ((inst
>> 25) & 0b11) {
2792 case 0: op
= rv_op_fnmsub_s
; break;
2793 case 1: op
= rv_op_fnmsub_d
; break;
2794 case 3: op
= rv_op_fnmsub_q
; break;
2798 switch ((inst
>> 25) & 0b11) {
2799 case 0: op
= rv_op_fnmadd_s
; break;
2800 case 1: op
= rv_op_fnmadd_d
; break;
2801 case 3: op
= rv_op_fnmadd_q
; break;
2805 switch ((inst
>> 25) & 0b1111111) {
2806 case 0: op
= rv_op_fadd_s
; break;
2807 case 1: op
= rv_op_fadd_d
; break;
2808 case 3: op
= rv_op_fadd_q
; break;
2809 case 4: op
= rv_op_fsub_s
; break;
2810 case 5: op
= rv_op_fsub_d
; break;
2811 case 7: op
= rv_op_fsub_q
; break;
2812 case 8: op
= rv_op_fmul_s
; break;
2813 case 9: op
= rv_op_fmul_d
; break;
2814 case 11: op
= rv_op_fmul_q
; break;
2815 case 12: op
= rv_op_fdiv_s
; break;
2816 case 13: op
= rv_op_fdiv_d
; break;
2817 case 15: op
= rv_op_fdiv_q
; break;
2819 switch ((inst
>> 12) & 0b111) {
2820 case 0: op
= rv_op_fsgnj_s
; break;
2821 case 1: op
= rv_op_fsgnjn_s
; break;
2822 case 2: op
= rv_op_fsgnjx_s
; break;
2826 switch ((inst
>> 12) & 0b111) {
2827 case 0: op
= rv_op_fsgnj_d
; break;
2828 case 1: op
= rv_op_fsgnjn_d
; break;
2829 case 2: op
= rv_op_fsgnjx_d
; break;
2833 switch ((inst
>> 12) & 0b111) {
2834 case 0: op
= rv_op_fsgnj_q
; break;
2835 case 1: op
= rv_op_fsgnjn_q
; break;
2836 case 2: op
= rv_op_fsgnjx_q
; break;
2840 switch ((inst
>> 12) & 0b111) {
2841 case 0: op
= rv_op_fmin_s
; break;
2842 case 1: op
= rv_op_fmax_s
; break;
2846 switch ((inst
>> 12) & 0b111) {
2847 case 0: op
= rv_op_fmin_d
; break;
2848 case 1: op
= rv_op_fmax_d
; break;
2852 switch ((inst
>> 12) & 0b111) {
2853 case 0: op
= rv_op_fmin_q
; break;
2854 case 1: op
= rv_op_fmax_q
; break;
2858 switch ((inst
>> 20) & 0b11111) {
2859 case 1: op
= rv_op_fcvt_s_d
; break;
2860 case 3: op
= rv_op_fcvt_s_q
; break;
2864 switch ((inst
>> 20) & 0b11111) {
2865 case 0: op
= rv_op_fcvt_d_s
; break;
2866 case 3: op
= rv_op_fcvt_d_q
; break;
2870 switch ((inst
>> 20) & 0b11111) {
2871 case 0: op
= rv_op_fcvt_q_s
; break;
2872 case 1: op
= rv_op_fcvt_q_d
; break;
2876 switch ((inst
>> 20) & 0b11111) {
2877 case 0: op
= rv_op_fsqrt_s
; break;
2881 switch ((inst
>> 20) & 0b11111) {
2882 case 0: op
= rv_op_fsqrt_d
; break;
2886 switch ((inst
>> 20) & 0b11111) {
2887 case 0: op
= rv_op_fsqrt_q
; break;
2891 switch ((inst
>> 12) & 0b111) {
2892 case 0: op
= rv_op_fle_s
; break;
2893 case 1: op
= rv_op_flt_s
; break;
2894 case 2: op
= rv_op_feq_s
; break;
2898 switch ((inst
>> 12) & 0b111) {
2899 case 0: op
= rv_op_fle_d
; break;
2900 case 1: op
= rv_op_flt_d
; break;
2901 case 2: op
= rv_op_feq_d
; break;
2905 switch ((inst
>> 12) & 0b111) {
2906 case 0: op
= rv_op_fle_q
; break;
2907 case 1: op
= rv_op_flt_q
; break;
2908 case 2: op
= rv_op_feq_q
; break;
2912 switch ((inst
>> 20) & 0b11111) {
2913 case 0: op
= rv_op_fcvt_w_s
; break;
2914 case 1: op
= rv_op_fcvt_wu_s
; break;
2915 case 2: op
= rv_op_fcvt_l_s
; break;
2916 case 3: op
= rv_op_fcvt_lu_s
; break;
2920 switch ((inst
>> 20) & 0b11111) {
2921 case 0: op
= rv_op_fcvt_w_d
; break;
2922 case 1: op
= rv_op_fcvt_wu_d
; break;
2923 case 2: op
= rv_op_fcvt_l_d
; break;
2924 case 3: op
= rv_op_fcvt_lu_d
; break;
2928 switch ((inst
>> 20) & 0b11111) {
2929 case 0: op
= rv_op_fcvt_w_q
; break;
2930 case 1: op
= rv_op_fcvt_wu_q
; break;
2931 case 2: op
= rv_op_fcvt_l_q
; break;
2932 case 3: op
= rv_op_fcvt_lu_q
; break;
2936 switch ((inst
>> 20) & 0b11111) {
2937 case 0: op
= rv_op_fcvt_s_w
; break;
2938 case 1: op
= rv_op_fcvt_s_wu
; break;
2939 case 2: op
= rv_op_fcvt_s_l
; break;
2940 case 3: op
= rv_op_fcvt_s_lu
; break;
2944 switch ((inst
>> 20) & 0b11111) {
2945 case 0: op
= rv_op_fcvt_d_w
; break;
2946 case 1: op
= rv_op_fcvt_d_wu
; break;
2947 case 2: op
= rv_op_fcvt_d_l
; break;
2948 case 3: op
= rv_op_fcvt_d_lu
; break;
2952 switch ((inst
>> 20) & 0b11111) {
2953 case 0: op
= rv_op_fcvt_q_w
; break;
2954 case 1: op
= rv_op_fcvt_q_wu
; break;
2955 case 2: op
= rv_op_fcvt_q_l
; break;
2956 case 3: op
= rv_op_fcvt_q_lu
; break;
2960 switch (((inst
>> 17) & 0b11111000) |
2961 ((inst
>> 12) & 0b00000111)) {
2962 case 0: op
= rv_op_fmv_x_s
; break;
2963 case 1: op
= rv_op_fclass_s
; break;
2967 switch (((inst
>> 17) & 0b11111000) |
2968 ((inst
>> 12) & 0b00000111)) {
2969 case 0: op
= rv_op_fmv_x_d
; break;
2970 case 1: op
= rv_op_fclass_d
; break;
2974 switch (((inst
>> 17) & 0b11111000) |
2975 ((inst
>> 12) & 0b00000111)) {
2976 case 0: op
= rv_op_fmv_x_q
; break;
2977 case 1: op
= rv_op_fclass_q
; break;
2981 switch (((inst
>> 17) & 0b11111000) |
2982 ((inst
>> 12) & 0b00000111)) {
2983 case 0: op
= rv_op_fmv_s_x
; break;
2987 switch (((inst
>> 17) & 0b11111000) |
2988 ((inst
>> 12) & 0b00000111)) {
2989 case 0: op
= rv_op_fmv_d_x
; break;
2993 switch (((inst
>> 17) & 0b11111000) |
2994 ((inst
>> 12) & 0b00000111)) {
2995 case 0: op
= rv_op_fmv_q_x
; break;
3001 switch ((inst
>> 12) & 0b111) {
3003 switch ((inst
>> 26) & 0b111111) {
3004 case 0: op
= rv_op_vadd_vv
; break;
3005 case 2: op
= rv_op_vsub_vv
; break;
3006 case 4: op
= rv_op_vminu_vv
; break;
3007 case 5: op
= rv_op_vmin_vv
; break;
3008 case 6: op
= rv_op_vmaxu_vv
; break;
3009 case 7: op
= rv_op_vmax_vv
; break;
3010 case 9: op
= rv_op_vand_vv
; break;
3011 case 10: op
= rv_op_vor_vv
; break;
3012 case 11: op
= rv_op_vxor_vv
; break;
3013 case 12: op
= rv_op_vrgather_vv
; break;
3014 case 14: op
= rv_op_vrgatherei16_vv
; break;
3016 if (((inst
>> 25) & 1) == 0) {
3017 op
= rv_op_vadc_vvm
;
3020 case 17: op
= rv_op_vmadc_vvm
; break;
3022 if (((inst
>> 25) & 1) == 0) {
3023 op
= rv_op_vsbc_vvm
;
3026 case 19: op
= rv_op_vmsbc_vvm
; break;
3028 if (((inst
>> 20) & 0b111111) == 32)
3030 else if (((inst
>> 25) & 1) == 0)
3031 op
= rv_op_vmerge_vvm
;
3033 case 24: op
= rv_op_vmseq_vv
; break;
3034 case 25: op
= rv_op_vmsne_vv
; break;
3035 case 26: op
= rv_op_vmsltu_vv
; break;
3036 case 27: op
= rv_op_vmslt_vv
; break;
3037 case 28: op
= rv_op_vmsleu_vv
; break;
3038 case 29: op
= rv_op_vmsle_vv
; break;
3039 case 32: op
= rv_op_vsaddu_vv
; break;
3040 case 33: op
= rv_op_vsadd_vv
; break;
3041 case 34: op
= rv_op_vssubu_vv
; break;
3042 case 35: op
= rv_op_vssub_vv
; break;
3043 case 37: op
= rv_op_vsll_vv
; break;
3044 case 39: op
= rv_op_vsmul_vv
; break;
3045 case 40: op
= rv_op_vsrl_vv
; break;
3046 case 41: op
= rv_op_vsra_vv
; break;
3047 case 42: op
= rv_op_vssrl_vv
; break;
3048 case 43: op
= rv_op_vssra_vv
; break;
3049 case 44: op
= rv_op_vnsrl_wv
; break;
3050 case 45: op
= rv_op_vnsra_wv
; break;
3051 case 46: op
= rv_op_vnclipu_wv
; break;
3052 case 47: op
= rv_op_vnclip_wv
; break;
3053 case 48: op
= rv_op_vwredsumu_vs
; break;
3054 case 49: op
= rv_op_vwredsum_vs
; break;
3058 switch ((inst
>> 26) & 0b111111) {
3059 case 0: op
= rv_op_vfadd_vv
; break;
3060 case 1: op
= rv_op_vfredusum_vs
; break;
3061 case 2: op
= rv_op_vfsub_vv
; break;
3062 case 3: op
= rv_op_vfredosum_vs
; break;
3063 case 4: op
= rv_op_vfmin_vv
; break;
3064 case 5: op
= rv_op_vfredmin_vs
; break;
3065 case 6: op
= rv_op_vfmax_vv
; break;
3066 case 7: op
= rv_op_vfredmax_vs
; break;
3067 case 8: op
= rv_op_vfsgnj_vv
; break;
3068 case 9: op
= rv_op_vfsgnjn_vv
; break;
3069 case 10: op
= rv_op_vfsgnjx_vv
; break;
3071 switch ((inst
>> 15) & 0b11111) {
3072 case 0: if ((inst
>> 25) & 1) op
= rv_op_vfmv_f_s
; break;
3076 switch ((inst
>> 15) & 0b11111) {
3077 case 0: op
= rv_op_vfcvt_xu_f_v
; break;
3078 case 1: op
= rv_op_vfcvt_x_f_v
; break;
3079 case 2: op
= rv_op_vfcvt_f_xu_v
; break;
3080 case 3: op
= rv_op_vfcvt_f_x_v
; break;
3081 case 6: op
= rv_op_vfcvt_rtz_xu_f_v
; break;
3082 case 7: op
= rv_op_vfcvt_rtz_x_f_v
; break;
3083 case 8: op
= rv_op_vfwcvt_xu_f_v
; break;
3084 case 9: op
= rv_op_vfwcvt_x_f_v
; break;
3085 case 10: op
= rv_op_vfwcvt_f_xu_v
; break;
3086 case 11: op
= rv_op_vfwcvt_f_x_v
; break;
3087 case 12: op
= rv_op_vfwcvt_f_f_v
; break;
3088 case 14: op
= rv_op_vfwcvt_rtz_xu_f_v
; break;
3089 case 15: op
= rv_op_vfwcvt_rtz_x_f_v
; break;
3090 case 16: op
= rv_op_vfncvt_xu_f_w
; break;
3091 case 17: op
= rv_op_vfncvt_x_f_w
; break;
3092 case 18: op
= rv_op_vfncvt_f_xu_w
; break;
3093 case 19: op
= rv_op_vfncvt_f_x_w
; break;
3094 case 20: op
= rv_op_vfncvt_f_f_w
; break;
3095 case 21: op
= rv_op_vfncvt_rod_f_f_w
; break;
3096 case 22: op
= rv_op_vfncvt_rtz_xu_f_w
; break;
3097 case 23: op
= rv_op_vfncvt_rtz_x_f_w
; break;
3101 switch ((inst
>> 15) & 0b11111) {
3102 case 0: op
= rv_op_vfsqrt_v
; break;
3103 case 4: op
= rv_op_vfrsqrt7_v
; break;
3104 case 5: op
= rv_op_vfrec7_v
; break;
3105 case 16: op
= rv_op_vfclass_v
; break;
3108 case 24: op
= rv_op_vmfeq_vv
; break;
3109 case 25: op
= rv_op_vmfle_vv
; break;
3110 case 27: op
= rv_op_vmflt_vv
; break;
3111 case 28: op
= rv_op_vmfne_vv
; break;
3112 case 32: op
= rv_op_vfdiv_vv
; break;
3113 case 36: op
= rv_op_vfmul_vv
; break;
3114 case 40: op
= rv_op_vfmadd_vv
; break;
3115 case 41: op
= rv_op_vfnmadd_vv
; break;
3116 case 42: op
= rv_op_vfmsub_vv
; break;
3117 case 43: op
= rv_op_vfnmsub_vv
; break;
3118 case 44: op
= rv_op_vfmacc_vv
; break;
3119 case 45: op
= rv_op_vfnmacc_vv
; break;
3120 case 46: op
= rv_op_vfmsac_vv
; break;
3121 case 47: op
= rv_op_vfnmsac_vv
; break;
3122 case 48: op
= rv_op_vfwadd_vv
; break;
3123 case 49: op
= rv_op_vfwredusum_vs
; break;
3124 case 50: op
= rv_op_vfwsub_vv
; break;
3125 case 51: op
= rv_op_vfwredosum_vs
; break;
3126 case 52: op
= rv_op_vfwadd_wv
; break;
3127 case 54: op
= rv_op_vfwsub_wv
; break;
3128 case 56: op
= rv_op_vfwmul_vv
; break;
3129 case 60: op
= rv_op_vfwmacc_vv
; break;
3130 case 61: op
= rv_op_vfwnmacc_vv
; break;
3131 case 62: op
= rv_op_vfwmsac_vv
; break;
3132 case 63: op
= rv_op_vfwnmsac_vv
; break;
3136 switch ((inst
>> 26) & 0b111111) {
3137 case 0: op
= rv_op_vredsum_vs
; break;
3138 case 1: op
= rv_op_vredand_vs
; break;
3139 case 2: op
= rv_op_vredor_vs
; break;
3140 case 3: op
= rv_op_vredxor_vs
; break;
3141 case 4: op
= rv_op_vredminu_vs
; break;
3142 case 5: op
= rv_op_vredmin_vs
; break;
3143 case 6: op
= rv_op_vredmaxu_vs
; break;
3144 case 7: op
= rv_op_vredmax_vs
; break;
3145 case 8: op
= rv_op_vaaddu_vv
; break;
3146 case 9: op
= rv_op_vaadd_vv
; break;
3147 case 10: op
= rv_op_vasubu_vv
; break;
3148 case 11: op
= rv_op_vasub_vv
; break;
3150 switch ((inst
>> 15) & 0b11111) {
3151 case 0: if ((inst
>> 25) & 1) op
= rv_op_vmv_x_s
; break;
3152 case 16: op
= rv_op_vcpop_m
; break;
3153 case 17: op
= rv_op_vfirst_m
; break;
3157 switch ((inst
>> 15) & 0b11111) {
3158 case 2: op
= rv_op_vzext_vf8
; break;
3159 case 3: op
= rv_op_vsext_vf8
; break;
3160 case 4: op
= rv_op_vzext_vf4
; break;
3161 case 5: op
= rv_op_vsext_vf4
; break;
3162 case 6: op
= rv_op_vzext_vf2
; break;
3163 case 7: op
= rv_op_vsext_vf2
; break;
3167 switch ((inst
>> 15) & 0b11111) {
3168 case 1: op
= rv_op_vmsbf_m
; break;
3169 case 2: op
= rv_op_vmsof_m
; break;
3170 case 3: op
= rv_op_vmsif_m
; break;
3171 case 16: op
= rv_op_viota_m
; break;
3173 if (((inst
>> 20) & 0b11111) == 0) {
3179 case 23: if ((inst
>> 25) & 1) op
= rv_op_vcompress_vm
; break;
3180 case 24: if ((inst
>> 25) & 1) op
= rv_op_vmandn_mm
; break;
3181 case 25: if ((inst
>> 25) & 1) op
= rv_op_vmand_mm
; break;
3182 case 26: if ((inst
>> 25) & 1) op
= rv_op_vmor_mm
; break;
3183 case 27: if ((inst
>> 25) & 1) op
= rv_op_vmxor_mm
; break;
3184 case 28: if ((inst
>> 25) & 1) op
= rv_op_vmorn_mm
; break;
3185 case 29: if ((inst
>> 25) & 1) op
= rv_op_vmnand_mm
; break;
3186 case 30: if ((inst
>> 25) & 1) op
= rv_op_vmnor_mm
; break;
3187 case 31: if ((inst
>> 25) & 1) op
= rv_op_vmxnor_mm
; break;
3188 case 32: op
= rv_op_vdivu_vv
; break;
3189 case 33: op
= rv_op_vdiv_vv
; break;
3190 case 34: op
= rv_op_vremu_vv
; break;
3191 case 35: op
= rv_op_vrem_vv
; break;
3192 case 36: op
= rv_op_vmulhu_vv
; break;
3193 case 37: op
= rv_op_vmul_vv
; break;
3194 case 38: op
= rv_op_vmulhsu_vv
; break;
3195 case 39: op
= rv_op_vmulh_vv
; break;
3196 case 41: op
= rv_op_vmadd_vv
; break;
3197 case 43: op
= rv_op_vnmsub_vv
; break;
3198 case 45: op
= rv_op_vmacc_vv
; break;
3199 case 47: op
= rv_op_vnmsac_vv
; break;
3200 case 48: op
= rv_op_vwaddu_vv
; break;
3201 case 49: op
= rv_op_vwadd_vv
; break;
3202 case 50: op
= rv_op_vwsubu_vv
; break;
3203 case 51: op
= rv_op_vwsub_vv
; break;
3204 case 52: op
= rv_op_vwaddu_wv
; break;
3205 case 53: op
= rv_op_vwadd_wv
; break;
3206 case 54: op
= rv_op_vwsubu_wv
; break;
3207 case 55: op
= rv_op_vwsub_wv
; break;
3208 case 56: op
= rv_op_vwmulu_vv
; break;
3209 case 58: op
= rv_op_vwmulsu_vv
; break;
3210 case 59: op
= rv_op_vwmul_vv
; break;
3211 case 60: op
= rv_op_vwmaccu_vv
; break;
3212 case 61: op
= rv_op_vwmacc_vv
; break;
3213 case 63: op
= rv_op_vwmaccsu_vv
; break;
3217 switch ((inst
>> 26) & 0b111111) {
3218 case 0: op
= rv_op_vadd_vi
; break;
3219 case 3: op
= rv_op_vrsub_vi
; break;
3220 case 9: op
= rv_op_vand_vi
; break;
3221 case 10: op
= rv_op_vor_vi
; break;
3222 case 11: op
= rv_op_vxor_vi
; break;
3223 case 12: op
= rv_op_vrgather_vi
; break;
3224 case 14: op
= rv_op_vslideup_vi
; break;
3225 case 15: op
= rv_op_vslidedown_vi
; break;
3227 if (((inst
>> 25) & 1) == 0) {
3228 op
= rv_op_vadc_vim
;
3231 case 17: op
= rv_op_vmadc_vim
; break;
3233 if (((inst
>> 20) & 0b111111) == 32)
3235 else if (((inst
>> 25) & 1) == 0)
3236 op
= rv_op_vmerge_vim
;
3238 case 24: op
= rv_op_vmseq_vi
; break;
3239 case 25: op
= rv_op_vmsne_vi
; break;
3240 case 28: op
= rv_op_vmsleu_vi
; break;
3241 case 29: op
= rv_op_vmsle_vi
; break;
3242 case 30: op
= rv_op_vmsgtu_vi
; break;
3243 case 31: op
= rv_op_vmsgt_vi
; break;
3244 case 32: op
= rv_op_vsaddu_vi
; break;
3245 case 33: op
= rv_op_vsadd_vi
; break;
3246 case 37: op
= rv_op_vsll_vi
; break;
3248 switch ((inst
>> 15) & 0b11111) {
3249 case 0: op
= rv_op_vmv1r_v
; break;
3250 case 1: op
= rv_op_vmv2r_v
; break;
3251 case 3: op
= rv_op_vmv4r_v
; break;
3252 case 7: op
= rv_op_vmv8r_v
; break;
3255 case 40: op
= rv_op_vsrl_vi
; break;
3256 case 41: op
= rv_op_vsra_vi
; break;
3257 case 42: op
= rv_op_vssrl_vi
; break;
3258 case 43: op
= rv_op_vssra_vi
; break;
3259 case 44: op
= rv_op_vnsrl_wi
; break;
3260 case 45: op
= rv_op_vnsra_wi
; break;
3261 case 46: op
= rv_op_vnclipu_wi
; break;
3262 case 47: op
= rv_op_vnclip_wi
; break;
3266 switch ((inst
>> 26) & 0b111111) {
3267 case 0: op
= rv_op_vadd_vx
; break;
3268 case 2: op
= rv_op_vsub_vx
; break;
3269 case 3: op
= rv_op_vrsub_vx
; break;
3270 case 4: op
= rv_op_vminu_vx
; break;
3271 case 5: op
= rv_op_vmin_vx
; break;
3272 case 6: op
= rv_op_vmaxu_vx
; break;
3273 case 7: op
= rv_op_vmax_vx
; break;
3274 case 9: op
= rv_op_vand_vx
; break;
3275 case 10: op
= rv_op_vor_vx
; break;
3276 case 11: op
= rv_op_vxor_vx
; break;
3277 case 12: op
= rv_op_vrgather_vx
; break;
3278 case 14: op
= rv_op_vslideup_vx
; break;
3279 case 15: op
= rv_op_vslidedown_vx
; break;
3281 if (((inst
>> 25) & 1) == 0) {
3282 op
= rv_op_vadc_vxm
;
3285 case 17: op
= rv_op_vmadc_vxm
; break;
3287 if (((inst
>> 25) & 1) == 0) {
3288 op
= rv_op_vsbc_vxm
;
3291 case 19: op
= rv_op_vmsbc_vxm
; break;
3293 if (((inst
>> 20) & 0b111111) == 32)
3295 else if (((inst
>> 25) & 1) == 0)
3296 op
= rv_op_vmerge_vxm
;
3298 case 24: op
= rv_op_vmseq_vx
; break;
3299 case 25: op
= rv_op_vmsne_vx
; break;
3300 case 26: op
= rv_op_vmsltu_vx
; break;
3301 case 27: op
= rv_op_vmslt_vx
; break;
3302 case 28: op
= rv_op_vmsleu_vx
; break;
3303 case 29: op
= rv_op_vmsle_vx
; break;
3304 case 30: op
= rv_op_vmsgtu_vx
; break;
3305 case 31: op
= rv_op_vmsgt_vx
; break;
3306 case 32: op
= rv_op_vsaddu_vx
; break;
3307 case 33: op
= rv_op_vsadd_vx
; break;
3308 case 34: op
= rv_op_vssubu_vx
; break;
3309 case 35: op
= rv_op_vssub_vx
; break;
3310 case 37: op
= rv_op_vsll_vx
; break;
3311 case 39: op
= rv_op_vsmul_vx
; break;
3312 case 40: op
= rv_op_vsrl_vx
; break;
3313 case 41: op
= rv_op_vsra_vx
; break;
3314 case 42: op
= rv_op_vssrl_vx
; break;
3315 case 43: op
= rv_op_vssra_vx
; break;
3316 case 44: op
= rv_op_vnsrl_wx
; break;
3317 case 45: op
= rv_op_vnsra_wx
; break;
3318 case 46: op
= rv_op_vnclipu_wx
; break;
3319 case 47: op
= rv_op_vnclip_wx
; break;
3323 switch ((inst
>> 26) & 0b111111) {
3324 case 0: op
= rv_op_vfadd_vf
; break;
3325 case 2: op
= rv_op_vfsub_vf
; break;
3326 case 4: op
= rv_op_vfmin_vf
; break;
3327 case 6: op
= rv_op_vfmax_vf
; break;
3328 case 8: op
= rv_op_vfsgnj_vf
; break;
3329 case 9: op
= rv_op_vfsgnjn_vf
; break;
3330 case 10: op
= rv_op_vfsgnjx_vf
; break;
3331 case 14: op
= rv_op_vfslide1up_vf
; break;
3332 case 15: op
= rv_op_vfslide1down_vf
; break;
3334 switch ((inst
>> 20) & 0b11111) {
3335 case 0: if ((inst
>> 25) & 1) op
= rv_op_vfmv_s_f
; break;
3339 if (((inst
>> 25) & 1) == 0)
3340 op
= rv_op_vfmerge_vfm
;
3341 else if (((inst
>> 20) & 0b111111) == 32)
3342 op
= rv_op_vfmv_v_f
;
3344 case 24: op
= rv_op_vmfeq_vf
; break;
3345 case 25: op
= rv_op_vmfle_vf
; break;
3346 case 27: op
= rv_op_vmflt_vf
; break;
3347 case 28: op
= rv_op_vmfne_vf
; break;
3348 case 29: op
= rv_op_vmfgt_vf
; break;
3349 case 31: op
= rv_op_vmfge_vf
; break;
3350 case 32: op
= rv_op_vfdiv_vf
; break;
3351 case 33: op
= rv_op_vfrdiv_vf
; break;
3352 case 36: op
= rv_op_vfmul_vf
; break;
3353 case 39: op
= rv_op_vfrsub_vf
; break;
3354 case 40: op
= rv_op_vfmadd_vf
; break;
3355 case 41: op
= rv_op_vfnmadd_vf
; break;
3356 case 42: op
= rv_op_vfmsub_vf
; break;
3357 case 43: op
= rv_op_vfnmsub_vf
; break;
3358 case 44: op
= rv_op_vfmacc_vf
; break;
3359 case 45: op
= rv_op_vfnmacc_vf
; break;
3360 case 46: op
= rv_op_vfmsac_vf
; break;
3361 case 47: op
= rv_op_vfnmsac_vf
; break;
3362 case 48: op
= rv_op_vfwadd_vf
; break;
3363 case 50: op
= rv_op_vfwsub_vf
; break;
3364 case 52: op
= rv_op_vfwadd_wf
; break;
3365 case 54: op
= rv_op_vfwsub_wf
; break;
3366 case 56: op
= rv_op_vfwmul_vf
; break;
3367 case 60: op
= rv_op_vfwmacc_vf
; break;
3368 case 61: op
= rv_op_vfwnmacc_vf
; break;
3369 case 62: op
= rv_op_vfwmsac_vf
; break;
3370 case 63: op
= rv_op_vfwnmsac_vf
; break;
3374 switch ((inst
>> 26) & 0b111111) {
3375 case 8: op
= rv_op_vaaddu_vx
; break;
3376 case 9: op
= rv_op_vaadd_vx
; break;
3377 case 10: op
= rv_op_vasubu_vx
; break;
3378 case 11: op
= rv_op_vasub_vx
; break;
3379 case 14: op
= rv_op_vslide1up_vx
; break;
3380 case 15: op
= rv_op_vslide1down_vx
; break;
3382 switch ((inst
>> 20) & 0b11111) {
3383 case 0: if ((inst
>> 25) & 1) op
= rv_op_vmv_s_x
; break;
3386 case 32: op
= rv_op_vdivu_vx
; break;
3387 case 33: op
= rv_op_vdiv_vx
; break;
3388 case 34: op
= rv_op_vremu_vx
; break;
3389 case 35: op
= rv_op_vrem_vx
; break;
3390 case 36: op
= rv_op_vmulhu_vx
; break;
3391 case 37: op
= rv_op_vmul_vx
; break;
3392 case 38: op
= rv_op_vmulhsu_vx
; break;
3393 case 39: op
= rv_op_vmulh_vx
; break;
3394 case 41: op
= rv_op_vmadd_vx
; break;
3395 case 43: op
= rv_op_vnmsub_vx
; break;
3396 case 45: op
= rv_op_vmacc_vx
; break;
3397 case 47: op
= rv_op_vnmsac_vx
; break;
3398 case 48: op
= rv_op_vwaddu_vx
; break;
3399 case 49: op
= rv_op_vwadd_vx
; break;
3400 case 50: op
= rv_op_vwsubu_vx
; break;
3401 case 51: op
= rv_op_vwsub_vx
; break;
3402 case 52: op
= rv_op_vwaddu_wx
; break;
3403 case 53: op
= rv_op_vwadd_wx
; break;
3404 case 54: op
= rv_op_vwsubu_wx
; break;
3405 case 55: op
= rv_op_vwsub_wx
; break;
3406 case 56: op
= rv_op_vwmulu_vx
; break;
3407 case 58: op
= rv_op_vwmulsu_vx
; break;
3408 case 59: op
= rv_op_vwmul_vx
; break;
3409 case 60: op
= rv_op_vwmaccu_vx
; break;
3410 case 61: op
= rv_op_vwmacc_vx
; break;
3411 case 62: op
= rv_op_vwmaccus_vx
; break;
3412 case 63: op
= rv_op_vwmaccsu_vx
; break;
3416 if (((inst
>> 31) & 1) == 0) {
3418 } else if ((inst
>> 30) & 1) {
3419 op
= rv_op_vsetivli
;
3420 } else if (((inst
>> 25) & 0b11111) == 0) {
3427 switch ((inst
>> 12) & 0b111) {
3428 case 0: op
= rv_op_addid
; break;
3430 switch ((inst
>> 26) & 0b111111) {
3431 case 0: op
= rv_op_sllid
; break;
3435 switch ((inst
>> 26) & 0b111111) {
3436 case 0: op
= rv_op_srlid
; break;
3437 case 16: op
= rv_op_sraid
; break;
3443 switch ((inst
>> 12) & 0b111) {
3444 case 0: op
= rv_op_beq
; break;
3445 case 1: op
= rv_op_bne
; break;
3446 case 4: op
= rv_op_blt
; break;
3447 case 5: op
= rv_op_bge
; break;
3448 case 6: op
= rv_op_bltu
; break;
3449 case 7: op
= rv_op_bgeu
; break;
3453 switch ((inst
>> 12) & 0b111) {
3454 case 0: op
= rv_op_jalr
; break;
3457 case 27: op
= rv_op_jal
; break;
3459 switch ((inst
>> 12) & 0b111) {
3461 switch (((inst
>> 20) & 0b111111100000) |
3462 ((inst
>> 7) & 0b000000011111)) {
3464 switch ((inst
>> 15) & 0b1111111111) {
3465 case 0: op
= rv_op_ecall
; break;
3466 case 32: op
= rv_op_ebreak
; break;
3467 case 64: op
= rv_op_uret
; break;
3471 switch ((inst
>> 20) & 0b11111) {
3473 switch ((inst
>> 15) & 0b11111) {
3474 case 0: op
= rv_op_sret
; break;
3477 case 4: op
= rv_op_sfence_vm
; break;
3479 switch ((inst
>> 15) & 0b11111) {
3480 case 0: op
= rv_op_wfi
; break;
3485 case 288: op
= rv_op_sfence_vma
; break;
3487 switch ((inst
>> 15) & 0b1111111111) {
3488 case 64: op
= rv_op_hret
; break;
3492 switch ((inst
>> 15) & 0b1111111111) {
3493 case 64: op
= rv_op_mret
; break;
3497 switch ((inst
>> 15) & 0b1111111111) {
3498 case 576: op
= rv_op_dret
; break;
3503 case 1: op
= rv_op_csrrw
; break;
3504 case 2: op
= rv_op_csrrs
; break;
3505 case 3: op
= rv_op_csrrc
; break;
3506 case 5: op
= rv_op_csrrwi
; break;
3507 case 6: op
= rv_op_csrrsi
; break;
3508 case 7: op
= rv_op_csrrci
; break;
3512 switch (((inst
>> 22) & 0b1111111000) |
3513 ((inst
>> 12) & 0b0000000111)) {
3514 case 0: op
= rv_op_addd
; break;
3515 case 1: op
= rv_op_slld
; break;
3516 case 5: op
= rv_op_srld
; break;
3517 case 8: op
= rv_op_muld
; break;
3518 case 12: op
= rv_op_divd
; break;
3519 case 13: op
= rv_op_divud
; break;
3520 case 14: op
= rv_op_remd
; break;
3521 case 15: op
= rv_op_remud
; break;
3522 case 256: op
= rv_op_subd
; break;
3523 case 261: op
= rv_op_srad
; break;
3532 /* operand extractors */
3534 static uint32_t operand_rd(rv_inst inst
)
3536 return (inst
<< 52) >> 59;
3539 static uint32_t operand_rs1(rv_inst inst
)
3541 return (inst
<< 44) >> 59;
3544 static uint32_t operand_rs2(rv_inst inst
)
3546 return (inst
<< 39) >> 59;
3549 static uint32_t operand_rs3(rv_inst inst
)
3551 return (inst
<< 32) >> 59;
3554 static uint32_t operand_aq(rv_inst inst
)
3556 return (inst
<< 37) >> 63;
3559 static uint32_t operand_rl(rv_inst inst
)
3561 return (inst
<< 38) >> 63;
3564 static uint32_t operand_pred(rv_inst inst
)
3566 return (inst
<< 36) >> 60;
3569 static uint32_t operand_succ(rv_inst inst
)
3571 return (inst
<< 40) >> 60;
3574 static uint32_t operand_rm(rv_inst inst
)
3576 return (inst
<< 49) >> 61;
3579 static uint32_t operand_shamt5(rv_inst inst
)
3581 return (inst
<< 39) >> 59;
3584 static uint32_t operand_shamt6(rv_inst inst
)
3586 return (inst
<< 38) >> 58;
3589 static uint32_t operand_shamt7(rv_inst inst
)
3591 return (inst
<< 37) >> 57;
3594 static uint32_t operand_crdq(rv_inst inst
)
3596 return (inst
<< 59) >> 61;
3599 static uint32_t operand_crs1q(rv_inst inst
)
3601 return (inst
<< 54) >> 61;
3604 static uint32_t operand_crs1rdq(rv_inst inst
)
3606 return (inst
<< 54) >> 61;
3609 static uint32_t operand_crs2q(rv_inst inst
)
3611 return (inst
<< 59) >> 61;
3614 static uint32_t calculate_xreg(uint32_t sreg
)
3616 return sreg
< 2 ? sreg
+ 8 : sreg
+ 16;
3619 static uint32_t operand_sreg1(rv_inst inst
)
3621 return calculate_xreg((inst
<< 54) >> 61);
3624 static uint32_t operand_sreg2(rv_inst inst
)
3626 return calculate_xreg((inst
<< 59) >> 61);
3629 static uint32_t operand_crd(rv_inst inst
)
3631 return (inst
<< 52) >> 59;
3634 static uint32_t operand_crs1(rv_inst inst
)
3636 return (inst
<< 52) >> 59;
3639 static uint32_t operand_crs1rd(rv_inst inst
)
3641 return (inst
<< 52) >> 59;
3644 static uint32_t operand_crs2(rv_inst inst
)
3646 return (inst
<< 57) >> 59;
3649 static uint32_t operand_cimmsh5(rv_inst inst
)
3651 return (inst
<< 57) >> 59;
3654 static uint32_t operand_csr12(rv_inst inst
)
3656 return (inst
<< 32) >> 52;
3659 static int32_t operand_imm12(rv_inst inst
)
3661 return ((int64_t)inst
<< 32) >> 52;
3664 static int32_t operand_imm20(rv_inst inst
)
3666 return (((int64_t)inst
<< 32) >> 44) << 12;
3669 static int32_t operand_jimm20(rv_inst inst
)
3671 return (((int64_t)inst
<< 32) >> 63) << 20 |
3672 ((inst
<< 33) >> 54) << 1 |
3673 ((inst
<< 43) >> 63) << 11 |
3674 ((inst
<< 44) >> 56) << 12;
3677 static int32_t operand_simm12(rv_inst inst
)
3679 return (((int64_t)inst
<< 32) >> 57) << 5 |
3683 static int32_t operand_sbimm12(rv_inst inst
)
3685 return (((int64_t)inst
<< 32) >> 63) << 12 |
3686 ((inst
<< 33) >> 58) << 5 |
3687 ((inst
<< 52) >> 60) << 1 |
3688 ((inst
<< 56) >> 63) << 11;
3691 static uint32_t operand_cimmshl6(rv_inst inst
, rv_isa isa
)
3693 int imm
= ((inst
<< 51) >> 63) << 5 |
3696 imm
= imm
? imm
: 64;
3701 static uint32_t operand_cimmshr6(rv_inst inst
, rv_isa isa
)
3703 int imm
= ((inst
<< 51) >> 63) << 5 |
3706 imm
= imm
| (imm
& 32) << 1;
3707 imm
= imm
? imm
: 64;
3712 static int32_t operand_cimmi(rv_inst inst
)
3714 return (((int64_t)inst
<< 51) >> 63) << 5 |
3718 static int32_t operand_cimmui(rv_inst inst
)
3720 return (((int64_t)inst
<< 51) >> 63) << 17 |
3721 ((inst
<< 57) >> 59) << 12;
3724 static uint32_t operand_cimmlwsp(rv_inst inst
)
3726 return ((inst
<< 51) >> 63) << 5 |
3727 ((inst
<< 57) >> 61) << 2 |
3728 ((inst
<< 60) >> 62) << 6;
3731 static uint32_t operand_cimmldsp(rv_inst inst
)
3733 return ((inst
<< 51) >> 63) << 5 |
3734 ((inst
<< 57) >> 62) << 3 |
3735 ((inst
<< 59) >> 61) << 6;
3738 static uint32_t operand_cimmlqsp(rv_inst inst
)
3740 return ((inst
<< 51) >> 63) << 5 |
3741 ((inst
<< 57) >> 63) << 4 |
3742 ((inst
<< 58) >> 60) << 6;
3745 static int32_t operand_cimm16sp(rv_inst inst
)
3747 return (((int64_t)inst
<< 51) >> 63) << 9 |
3748 ((inst
<< 57) >> 63) << 4 |
3749 ((inst
<< 58) >> 63) << 6 |
3750 ((inst
<< 59) >> 62) << 7 |
3751 ((inst
<< 61) >> 63) << 5;
3754 static int32_t operand_cimmj(rv_inst inst
)
3756 return (((int64_t)inst
<< 51) >> 63) << 11 |
3757 ((inst
<< 52) >> 63) << 4 |
3758 ((inst
<< 53) >> 62) << 8 |
3759 ((inst
<< 55) >> 63) << 10 |
3760 ((inst
<< 56) >> 63) << 6 |
3761 ((inst
<< 57) >> 63) << 7 |
3762 ((inst
<< 58) >> 61) << 1 |
3763 ((inst
<< 61) >> 63) << 5;
3766 static int32_t operand_cimmb(rv_inst inst
)
3768 return (((int64_t)inst
<< 51) >> 63) << 8 |
3769 ((inst
<< 52) >> 62) << 3 |
3770 ((inst
<< 57) >> 62) << 6 |
3771 ((inst
<< 59) >> 62) << 1 |
3772 ((inst
<< 61) >> 63) << 5;
3775 static uint32_t operand_cimmswsp(rv_inst inst
)
3777 return ((inst
<< 51) >> 60) << 2 |
3778 ((inst
<< 55) >> 62) << 6;
3781 static uint32_t operand_cimmsdsp(rv_inst inst
)
3783 return ((inst
<< 51) >> 61) << 3 |
3784 ((inst
<< 54) >> 61) << 6;
3787 static uint32_t operand_cimmsqsp(rv_inst inst
)
3789 return ((inst
<< 51) >> 62) << 4 |
3790 ((inst
<< 53) >> 60) << 6;
3793 static uint32_t operand_cimm4spn(rv_inst inst
)
3795 return ((inst
<< 51) >> 62) << 4 |
3796 ((inst
<< 53) >> 60) << 6 |
3797 ((inst
<< 57) >> 63) << 2 |
3798 ((inst
<< 58) >> 63) << 3;
3801 static uint32_t operand_cimmw(rv_inst inst
)
3803 return ((inst
<< 51) >> 61) << 3 |
3804 ((inst
<< 57) >> 63) << 2 |
3805 ((inst
<< 58) >> 63) << 6;
3808 static uint32_t operand_cimmd(rv_inst inst
)
3810 return ((inst
<< 51) >> 61) << 3 |
3811 ((inst
<< 57) >> 62) << 6;
3814 static uint32_t operand_cimmq(rv_inst inst
)
3816 return ((inst
<< 51) >> 62) << 4 |
3817 ((inst
<< 53) >> 63) << 8 |
3818 ((inst
<< 57) >> 62) << 6;
3821 static uint32_t operand_vimm(rv_inst inst
)
3823 return (int64_t)(inst
<< 44) >> 59;
3826 static uint32_t operand_vzimm11(rv_inst inst
)
3828 return (inst
<< 33) >> 53;
3831 static uint32_t operand_vzimm10(rv_inst inst
)
3833 return (inst
<< 34) >> 54;
3836 static uint32_t operand_bs(rv_inst inst
)
3838 return (inst
<< 32) >> 62;
3841 static uint32_t operand_rnum(rv_inst inst
)
3843 return (inst
<< 40) >> 60;
3846 static uint32_t operand_vm(rv_inst inst
)
3848 return (inst
<< 38) >> 63;
3851 static uint32_t operand_uimm_c_lb(rv_inst inst
)
3853 return (((inst
<< 58) >> 63) << 1) |
3854 ((inst
<< 57) >> 63);
3857 static uint32_t operand_uimm_c_lh(rv_inst inst
)
3859 return (((inst
<< 58) >> 63) << 1);
3862 static uint32_t operand_zcmp_spimm(rv_inst inst
)
3864 return ((inst
<< 60) >> 62) << 4;
3867 static uint32_t operand_zcmp_rlist(rv_inst inst
)
3869 return ((inst
<< 56) >> 60);
3872 static uint32_t calculate_stack_adj(rv_isa isa
, uint32_t rlist
, uint32_t spimm
)
3874 int xlen_bytes_log2
= isa
== rv64
? 3 : 2;
3875 int regs
= rlist
== 15 ? 13 : rlist
- 3;
3876 uint32_t stack_adj_base
= ROUND_UP(regs
<< xlen_bytes_log2
, 16);
3877 return stack_adj_base
+ spimm
;
3880 static uint32_t operand_zcmp_stack_adj(rv_inst inst
, rv_isa isa
)
3882 return calculate_stack_adj(isa
, operand_zcmp_rlist(inst
),
3883 operand_zcmp_spimm(inst
));
3886 static uint32_t operand_tbl_index(rv_inst inst
)
3888 return ((inst
<< 54) >> 56);
3891 /* decode operands */
3893 static void decode_inst_operands(rv_decode
*dec
, rv_isa isa
)
3895 const rv_opcode_data
*opcode_data
= dec
->opcode_data
;
3896 rv_inst inst
= dec
->inst
;
3897 dec
->codec
= opcode_data
[dec
->op
].codec
;
3898 switch (dec
->codec
) {
3900 dec
->rd
= dec
->rs1
= dec
->rs2
= rv_ireg_zero
;
3904 dec
->rd
= operand_rd(inst
);
3905 dec
->rs1
= dec
->rs2
= rv_ireg_zero
;
3906 dec
->imm
= operand_imm20(inst
);
3909 dec
->rd
= operand_rd(inst
);
3910 dec
->rs1
= dec
->rs2
= rv_ireg_zero
;
3911 dec
->imm
= operand_jimm20(inst
);
3914 dec
->rd
= operand_rd(inst
);
3915 dec
->rs1
= operand_rs1(inst
);
3916 dec
->rs2
= rv_ireg_zero
;
3917 dec
->imm
= operand_imm12(inst
);
3919 case rv_codec_i_sh5
:
3920 dec
->rd
= operand_rd(inst
);
3921 dec
->rs1
= operand_rs1(inst
);
3922 dec
->rs2
= rv_ireg_zero
;
3923 dec
->imm
= operand_shamt5(inst
);
3925 case rv_codec_i_sh6
:
3926 dec
->rd
= operand_rd(inst
);
3927 dec
->rs1
= operand_rs1(inst
);
3928 dec
->rs2
= rv_ireg_zero
;
3929 dec
->imm
= operand_shamt6(inst
);
3931 case rv_codec_i_sh7
:
3932 dec
->rd
= operand_rd(inst
);
3933 dec
->rs1
= operand_rs1(inst
);
3934 dec
->rs2
= rv_ireg_zero
;
3935 dec
->imm
= operand_shamt7(inst
);
3937 case rv_codec_i_csr
:
3938 dec
->rd
= operand_rd(inst
);
3939 dec
->rs1
= operand_rs1(inst
);
3940 dec
->rs2
= rv_ireg_zero
;
3941 dec
->imm
= operand_csr12(inst
);
3944 dec
->rd
= rv_ireg_zero
;
3945 dec
->rs1
= operand_rs1(inst
);
3946 dec
->rs2
= operand_rs2(inst
);
3947 dec
->imm
= operand_simm12(inst
);
3950 dec
->rd
= rv_ireg_zero
;
3951 dec
->rs1
= operand_rs1(inst
);
3952 dec
->rs2
= operand_rs2(inst
);
3953 dec
->imm
= operand_sbimm12(inst
);
3956 dec
->rd
= operand_rd(inst
);
3957 dec
->rs1
= operand_rs1(inst
);
3958 dec
->rs2
= operand_rs2(inst
);
3962 dec
->rd
= operand_rd(inst
);
3963 dec
->rs1
= operand_rs1(inst
);
3964 dec
->rs2
= operand_rs2(inst
);
3966 dec
->rm
= operand_rm(inst
);
3969 dec
->rd
= operand_rd(inst
);
3970 dec
->rs1
= operand_rs1(inst
);
3971 dec
->rs2
= operand_rs2(inst
);
3972 dec
->rs3
= operand_rs3(inst
);
3974 dec
->rm
= operand_rm(inst
);
3977 dec
->rd
= operand_rd(inst
);
3978 dec
->rs1
= operand_rs1(inst
);
3979 dec
->rs2
= operand_rs2(inst
);
3981 dec
->aq
= operand_aq(inst
);
3982 dec
->rl
= operand_rl(inst
);
3985 dec
->rd
= operand_rd(inst
);
3986 dec
->rs1
= operand_rs1(inst
);
3987 dec
->rs2
= rv_ireg_zero
;
3989 dec
->aq
= operand_aq(inst
);
3990 dec
->rl
= operand_rl(inst
);
3993 dec
->rd
= dec
->rs1
= dec
->rs2
= rv_ireg_zero
;
3994 dec
->pred
= operand_pred(inst
);
3995 dec
->succ
= operand_succ(inst
);
3999 dec
->rd
= rv_ireg_zero
;
4000 dec
->rs1
= operand_crs1q(inst
) + 8;
4001 dec
->rs2
= rv_ireg_zero
;
4002 dec
->imm
= operand_cimmb(inst
);
4004 case rv_codec_cb_imm
:
4005 dec
->rd
= dec
->rs1
= operand_crs1rdq(inst
) + 8;
4006 dec
->rs2
= rv_ireg_zero
;
4007 dec
->imm
= operand_cimmi(inst
);
4009 case rv_codec_cb_sh5
:
4010 dec
->rd
= dec
->rs1
= operand_crs1rdq(inst
) + 8;
4011 dec
->rs2
= rv_ireg_zero
;
4012 dec
->imm
= operand_cimmsh5(inst
);
4014 case rv_codec_cb_sh6
:
4015 dec
->rd
= dec
->rs1
= operand_crs1rdq(inst
) + 8;
4016 dec
->rs2
= rv_ireg_zero
;
4017 dec
->imm
= operand_cimmshr6(inst
, isa
);
4020 dec
->rd
= dec
->rs1
= operand_crs1rd(inst
);
4021 dec
->rs2
= rv_ireg_zero
;
4022 dec
->imm
= operand_cimmi(inst
);
4024 case rv_codec_ci_sh5
:
4025 dec
->rd
= dec
->rs1
= operand_crs1rd(inst
);
4026 dec
->rs2
= rv_ireg_zero
;
4027 dec
->imm
= operand_cimmsh5(inst
);
4029 case rv_codec_ci_sh6
:
4030 dec
->rd
= dec
->rs1
= operand_crs1rd(inst
);
4031 dec
->rs2
= rv_ireg_zero
;
4032 dec
->imm
= operand_cimmshl6(inst
, isa
);
4034 case rv_codec_ci_16sp
:
4035 dec
->rd
= rv_ireg_sp
;
4036 dec
->rs1
= rv_ireg_sp
;
4037 dec
->rs2
= rv_ireg_zero
;
4038 dec
->imm
= operand_cimm16sp(inst
);
4040 case rv_codec_ci_lwsp
:
4041 dec
->rd
= operand_crd(inst
);
4042 dec
->rs1
= rv_ireg_sp
;
4043 dec
->rs2
= rv_ireg_zero
;
4044 dec
->imm
= operand_cimmlwsp(inst
);
4046 case rv_codec_ci_ldsp
:
4047 dec
->rd
= operand_crd(inst
);
4048 dec
->rs1
= rv_ireg_sp
;
4049 dec
->rs2
= rv_ireg_zero
;
4050 dec
->imm
= operand_cimmldsp(inst
);
4052 case rv_codec_ci_lqsp
:
4053 dec
->rd
= operand_crd(inst
);
4054 dec
->rs1
= rv_ireg_sp
;
4055 dec
->rs2
= rv_ireg_zero
;
4056 dec
->imm
= operand_cimmlqsp(inst
);
4058 case rv_codec_ci_li
:
4059 dec
->rd
= operand_crd(inst
);
4060 dec
->rs1
= rv_ireg_zero
;
4061 dec
->rs2
= rv_ireg_zero
;
4062 dec
->imm
= operand_cimmi(inst
);
4064 case rv_codec_ci_lui
:
4065 dec
->rd
= operand_crd(inst
);
4066 dec
->rs1
= rv_ireg_zero
;
4067 dec
->rs2
= rv_ireg_zero
;
4068 dec
->imm
= operand_cimmui(inst
);
4070 case rv_codec_ci_none
:
4071 dec
->rd
= dec
->rs1
= dec
->rs2
= rv_ireg_zero
;
4074 case rv_codec_ciw_4spn
:
4075 dec
->rd
= operand_crdq(inst
) + 8;
4076 dec
->rs1
= rv_ireg_sp
;
4077 dec
->rs2
= rv_ireg_zero
;
4078 dec
->imm
= operand_cimm4spn(inst
);
4081 dec
->rd
= dec
->rs1
= dec
->rs2
= rv_ireg_zero
;
4082 dec
->imm
= operand_cimmj(inst
);
4084 case rv_codec_cj_jal
:
4085 dec
->rd
= rv_ireg_ra
;
4086 dec
->rs1
= dec
->rs2
= rv_ireg_zero
;
4087 dec
->imm
= operand_cimmj(inst
);
4089 case rv_codec_cl_lw
:
4090 dec
->rd
= operand_crdq(inst
) + 8;
4091 dec
->rs1
= operand_crs1q(inst
) + 8;
4092 dec
->rs2
= rv_ireg_zero
;
4093 dec
->imm
= operand_cimmw(inst
);
4095 case rv_codec_cl_ld
:
4096 dec
->rd
= operand_crdq(inst
) + 8;
4097 dec
->rs1
= operand_crs1q(inst
) + 8;
4098 dec
->rs2
= rv_ireg_zero
;
4099 dec
->imm
= operand_cimmd(inst
);
4101 case rv_codec_cl_lq
:
4102 dec
->rd
= operand_crdq(inst
) + 8;
4103 dec
->rs1
= operand_crs1q(inst
) + 8;
4104 dec
->rs2
= rv_ireg_zero
;
4105 dec
->imm
= operand_cimmq(inst
);
4108 dec
->rd
= dec
->rs1
= operand_crs1rd(inst
);
4109 dec
->rs2
= operand_crs2(inst
);
4112 case rv_codec_cr_mv
:
4113 dec
->rd
= operand_crd(inst
);
4114 dec
->rs1
= operand_crs2(inst
);
4115 dec
->rs2
= rv_ireg_zero
;
4118 case rv_codec_cr_jalr
:
4119 dec
->rd
= rv_ireg_ra
;
4120 dec
->rs1
= operand_crs1(inst
);
4121 dec
->rs2
= rv_ireg_zero
;
4124 case rv_codec_cr_jr
:
4125 dec
->rd
= rv_ireg_zero
;
4126 dec
->rs1
= operand_crs1(inst
);
4127 dec
->rs2
= rv_ireg_zero
;
4131 dec
->rd
= dec
->rs1
= operand_crs1rdq(inst
) + 8;
4132 dec
->rs2
= operand_crs2q(inst
) + 8;
4135 case rv_codec_cs_sw
:
4136 dec
->rd
= rv_ireg_zero
;
4137 dec
->rs1
= operand_crs1q(inst
) + 8;
4138 dec
->rs2
= operand_crs2q(inst
) + 8;
4139 dec
->imm
= operand_cimmw(inst
);
4141 case rv_codec_cs_sd
:
4142 dec
->rd
= rv_ireg_zero
;
4143 dec
->rs1
= operand_crs1q(inst
) + 8;
4144 dec
->rs2
= operand_crs2q(inst
) + 8;
4145 dec
->imm
= operand_cimmd(inst
);
4147 case rv_codec_cs_sq
:
4148 dec
->rd
= rv_ireg_zero
;
4149 dec
->rs1
= operand_crs1q(inst
) + 8;
4150 dec
->rs2
= operand_crs2q(inst
) + 8;
4151 dec
->imm
= operand_cimmq(inst
);
4153 case rv_codec_css_swsp
:
4154 dec
->rd
= rv_ireg_zero
;
4155 dec
->rs1
= rv_ireg_sp
;
4156 dec
->rs2
= operand_crs2(inst
);
4157 dec
->imm
= operand_cimmswsp(inst
);
4159 case rv_codec_css_sdsp
:
4160 dec
->rd
= rv_ireg_zero
;
4161 dec
->rs1
= rv_ireg_sp
;
4162 dec
->rs2
= operand_crs2(inst
);
4163 dec
->imm
= operand_cimmsdsp(inst
);
4165 case rv_codec_css_sqsp
:
4166 dec
->rd
= rv_ireg_zero
;
4167 dec
->rs1
= rv_ireg_sp
;
4168 dec
->rs2
= operand_crs2(inst
);
4169 dec
->imm
= operand_cimmsqsp(inst
);
4172 dec
->rs1
= operand_rs1(inst
);
4173 dec
->rs2
= operand_rs2(inst
);
4174 dec
->bs
= operand_bs(inst
);
4176 case rv_codec_k_rnum
:
4177 dec
->rd
= operand_rd(inst
);
4178 dec
->rs1
= operand_rs1(inst
);
4179 dec
->rnum
= operand_rnum(inst
);
4182 dec
->rd
= operand_rd(inst
);
4183 dec
->rs1
= operand_rs1(inst
);
4184 dec
->rs2
= operand_rs2(inst
);
4185 dec
->vm
= operand_vm(inst
);
4187 case rv_codec_v_ldst
:
4188 dec
->rd
= operand_rd(inst
);
4189 dec
->rs1
= operand_rs1(inst
);
4190 dec
->vm
= operand_vm(inst
);
4193 dec
->rd
= operand_rd(inst
);
4194 dec
->rs2
= operand_rs2(inst
);
4195 dec
->imm
= operand_vimm(inst
);
4196 dec
->vm
= operand_vm(inst
);
4198 case rv_codec_vsetvli
:
4199 dec
->rd
= operand_rd(inst
);
4200 dec
->rs1
= operand_rs1(inst
);
4201 dec
->vzimm
= operand_vzimm11(inst
);
4203 case rv_codec_vsetivli
:
4204 dec
->rd
= operand_rd(inst
);
4205 dec
->imm
= operand_vimm(inst
);
4206 dec
->vzimm
= operand_vzimm10(inst
);
4208 case rv_codec_zcb_lb
:
4209 dec
->rs1
= operand_crs1q(inst
) + 8;
4210 dec
->rs2
= operand_crs2q(inst
) + 8;
4211 dec
->imm
= operand_uimm_c_lb(inst
);
4213 case rv_codec_zcb_lh
:
4214 dec
->rs1
= operand_crs1q(inst
) + 8;
4215 dec
->rs2
= operand_crs2q(inst
) + 8;
4216 dec
->imm
= operand_uimm_c_lh(inst
);
4218 case rv_codec_zcb_ext
:
4219 dec
->rd
= operand_crs1q(inst
) + 8;
4221 case rv_codec_zcb_mul
:
4222 dec
->rd
= operand_crs1rdq(inst
) + 8;
4223 dec
->rs2
= operand_crs2q(inst
) + 8;
4225 case rv_codec_zcmp_cm_pushpop
:
4226 dec
->imm
= operand_zcmp_stack_adj(inst
, isa
);
4227 dec
->rlist
= operand_zcmp_rlist(inst
);
4229 case rv_codec_zcmp_cm_mv
:
4230 dec
->rd
= operand_sreg1(inst
);
4231 dec
->rs2
= operand_sreg2(inst
);
4233 case rv_codec_zcmt_jt
:
4234 dec
->imm
= operand_tbl_index(inst
);
4239 /* check constraint */
4241 static bool check_constraints(rv_decode
*dec
, const rvc_constraint
*c
)
4243 int32_t imm
= dec
->imm
;
4244 uint8_t rd
= dec
->rd
, rs1
= dec
->rs1
, rs2
= dec
->rs2
;
4245 while (*c
!= rvc_end
) {
4267 case rvc_rs2_eq_rs1
:
4268 if (!(rs2
== rs1
)) {
4277 case rvc_imm_eq_zero
:
4292 case rvc_csr_eq_0x001
:
4293 if (!(imm
== 0x001)) {
4297 case rvc_csr_eq_0x002
:
4298 if (!(imm
== 0x002)) {
4302 case rvc_csr_eq_0x003
:
4303 if (!(imm
== 0x003)) {
4307 case rvc_csr_eq_0xc00
:
4308 if (!(imm
== 0xc00)) {
4312 case rvc_csr_eq_0xc01
:
4313 if (!(imm
== 0xc01)) {
4317 case rvc_csr_eq_0xc02
:
4318 if (!(imm
== 0xc02)) {
4322 case rvc_csr_eq_0xc80
:
4323 if (!(imm
== 0xc80)) {
4327 case rvc_csr_eq_0xc81
:
4328 if (!(imm
== 0xc81)) {
4332 case rvc_csr_eq_0xc82
:
4333 if (!(imm
== 0xc82)) {
4344 /* instruction length */
4346 static size_t inst_length(rv_inst inst
)
4348 /* NOTE: supports maximum instruction size of 64-bits */
4351 * instruction length coding
4353 * aa - 16 bit aa != 11
4354 * bbb11 - 32 bit bbb != 111
4359 return (inst
& 0b11) != 0b11 ? 2
4360 : (inst
& 0b11100) != 0b11100 ? 4
4361 : (inst
& 0b111111) == 0b011111 ? 6
4362 : (inst
& 0b1111111) == 0b0111111 ? 8
4366 /* format instruction */
4368 static void append(char *s1
, const char *s2
, size_t n
)
4370 size_t l1
= strlen(s1
);
4371 if (n
- l1
- 1 > 0) {
4372 strncat(s1
, s2
, n
- l1
);
4376 static void format_inst(char *buf
, size_t buflen
, size_t tab
, rv_decode
*dec
)
4378 const rv_opcode_data
*opcode_data
= dec
->opcode_data
;
4382 fmt
= opcode_data
[dec
->op
].format
;
4386 append(buf
, opcode_data
[dec
->op
].name
, buflen
);
4389 append(buf
, "(", buflen
);
4392 append(buf
, ",", buflen
);
4395 append(buf
, ")", buflen
);
4398 append(buf
, "-", buflen
);
4401 snprintf(tmp
, sizeof(tmp
), "%d", dec
->bs
);
4402 append(buf
, tmp
, buflen
);
4405 snprintf(tmp
, sizeof(tmp
), "%d", dec
->rnum
);
4406 append(buf
, tmp
, buflen
);
4409 append(buf
, rv_ireg_name_sym
[dec
->rd
], buflen
);
4412 append(buf
, rv_ireg_name_sym
[dec
->rs1
], buflen
);
4415 append(buf
, rv_ireg_name_sym
[dec
->rs2
], buflen
);
4418 append(buf
, dec
->cfg
->ext_zfinx
? rv_ireg_name_sym
[dec
->rd
] :
4419 rv_freg_name_sym
[dec
->rd
],
4423 append(buf
, dec
->cfg
->ext_zfinx
? rv_ireg_name_sym
[dec
->rs1
] :
4424 rv_freg_name_sym
[dec
->rs1
],
4428 append(buf
, dec
->cfg
->ext_zfinx
? rv_ireg_name_sym
[dec
->rs2
] :
4429 rv_freg_name_sym
[dec
->rs2
],
4433 append(buf
, dec
->cfg
->ext_zfinx
? rv_ireg_name_sym
[dec
->rs3
] :
4434 rv_freg_name_sym
[dec
->rs3
],
4438 snprintf(tmp
, sizeof(tmp
), "%d", dec
->rs1
);
4439 append(buf
, tmp
, buflen
);
4442 snprintf(tmp
, sizeof(tmp
), "%d", dec
->imm
);
4443 append(buf
, tmp
, buflen
);
4446 snprintf(tmp
, sizeof(tmp
), "%u", ((uint32_t)dec
->imm
& 0b11111));
4447 append(buf
, tmp
, buflen
);
4450 snprintf(tmp
, sizeof(tmp
), "%d", dec
->imm
);
4451 append(buf
, tmp
, buflen
);
4452 while (strlen(buf
) < tab
* 2) {
4453 append(buf
, " ", buflen
);
4455 snprintf(tmp
, sizeof(tmp
), "# 0x%" PRIx64
,
4456 dec
->pc
+ dec
->imm
);
4457 append(buf
, tmp
, buflen
);
4460 const char *name
= csr_name(dec
->imm
& 0xfff);
4462 append(buf
, name
, buflen
);
4464 snprintf(tmp
, sizeof(tmp
), "0x%03x", dec
->imm
& 0xfff);
4465 append(buf
, tmp
, buflen
);
4472 append(buf
, "rne", buflen
);
4475 append(buf
, "rtz", buflen
);
4478 append(buf
, "rdn", buflen
);
4481 append(buf
, "rup", buflen
);
4484 append(buf
, "rmm", buflen
);
4487 append(buf
, "dyn", buflen
);
4490 append(buf
, "inv", buflen
);
4495 if (dec
->pred
& rv_fence_i
) {
4496 append(buf
, "i", buflen
);
4498 if (dec
->pred
& rv_fence_o
) {
4499 append(buf
, "o", buflen
);
4501 if (dec
->pred
& rv_fence_r
) {
4502 append(buf
, "r", buflen
);
4504 if (dec
->pred
& rv_fence_w
) {
4505 append(buf
, "w", buflen
);
4509 if (dec
->succ
& rv_fence_i
) {
4510 append(buf
, "i", buflen
);
4512 if (dec
->succ
& rv_fence_o
) {
4513 append(buf
, "o", buflen
);
4515 if (dec
->succ
& rv_fence_r
) {
4516 append(buf
, "r", buflen
);
4518 if (dec
->succ
& rv_fence_w
) {
4519 append(buf
, "w", buflen
);
4523 while (strlen(buf
) < tab
) {
4524 append(buf
, " ", buflen
);
4529 append(buf
, ".aq", buflen
);
4534 append(buf
, ".rl", buflen
);
4538 append(buf
, ",v0", buflen
);
4542 append(buf
, ",v0.t", buflen
);
4546 append(buf
, rv_vreg_name_sym
[dec
->rd
], buflen
);
4549 append(buf
, rv_vreg_name_sym
[dec
->rs1
], buflen
);
4552 append(buf
, rv_vreg_name_sym
[dec
->rs2
], buflen
);
4555 append(buf
, rv_vreg_name_sym
[dec
->rs3
], buflen
);
4558 char nbuf
[32] = {0};
4559 const int sew
= 1 << (((dec
->vzimm
>> 3) & 0b111) + 3);
4560 sprintf(nbuf
, "%d", sew
);
4561 const int lmul
= dec
->vzimm
& 0b11;
4562 const int flmul
= (dec
->vzimm
>> 2) & 1;
4563 const char *vta
= (dec
->vzimm
>> 6) & 1 ? "ta" : "tu";
4564 const char *vma
= (dec
->vzimm
>> 7) & 1 ? "ma" : "mu";
4565 append(buf
, "e", buflen
);
4566 append(buf
, nbuf
, buflen
);
4567 append(buf
, ",m", buflen
);
4571 sprintf(nbuf
, "f2");
4574 sprintf(nbuf
, "f4");
4577 sprintf(nbuf
, "f8");
4580 append(buf
, nbuf
, buflen
);
4582 sprintf(nbuf
, "%d", 1 << lmul
);
4583 append(buf
, nbuf
, buflen
);
4585 append(buf
, ",", buflen
);
4586 append(buf
, vta
, buflen
);
4587 append(buf
, ",", buflen
);
4588 append(buf
, vma
, buflen
);
4592 switch (dec
->rlist
) {
4594 snprintf(tmp
, sizeof(tmp
), "{ra}");
4597 snprintf(tmp
, sizeof(tmp
), "{ra, s0}");
4600 snprintf(tmp
, sizeof(tmp
), "{ra, s0-s11}");
4603 snprintf(tmp
, sizeof(tmp
), "{ra, s0-s%d}", dec
->rlist
- 5);
4606 append(buf
, tmp
, buflen
);
4616 /* lift instruction to pseudo-instruction */
4618 static void decode_inst_lift_pseudo(rv_decode
*dec
)
4620 const rv_opcode_data
*opcode_data
= dec
->opcode_data
;
4621 const rv_comp_data
*comp_data
= opcode_data
[dec
->op
].pseudo
;
4625 while (comp_data
->constraints
) {
4626 if (check_constraints(dec
, comp_data
->constraints
)) {
4627 dec
->op
= comp_data
->op
;
4628 dec
->codec
= opcode_data
[dec
->op
].codec
;
4635 /* decompress instruction */
4637 static void decode_inst_decompress_rv32(rv_decode
*dec
)
4639 const rv_opcode_data
*opcode_data
= dec
->opcode_data
;
4640 int decomp_op
= opcode_data
[dec
->op
].decomp_rv32
;
4641 if (decomp_op
!= rv_op_illegal
) {
4642 if ((opcode_data
[dec
->op
].decomp_data
& rvcd_imm_nz
)
4644 dec
->op
= rv_op_illegal
;
4646 dec
->op
= decomp_op
;
4647 dec
->codec
= opcode_data
[decomp_op
].codec
;
4652 static void decode_inst_decompress_rv64(rv_decode
*dec
)
4654 const rv_opcode_data
*opcode_data
= dec
->opcode_data
;
4655 int decomp_op
= opcode_data
[dec
->op
].decomp_rv64
;
4656 if (decomp_op
!= rv_op_illegal
) {
4657 if ((opcode_data
[dec
->op
].decomp_data
& rvcd_imm_nz
)
4659 dec
->op
= rv_op_illegal
;
4661 dec
->op
= decomp_op
;
4662 dec
->codec
= opcode_data
[decomp_op
].codec
;
4667 static void decode_inst_decompress_rv128(rv_decode
*dec
)
4669 const rv_opcode_data
*opcode_data
= dec
->opcode_data
;
4670 int decomp_op
= opcode_data
[dec
->op
].decomp_rv128
;
4671 if (decomp_op
!= rv_op_illegal
) {
4672 if ((opcode_data
[dec
->op
].decomp_data
& rvcd_imm_nz
)
4674 dec
->op
= rv_op_illegal
;
4676 dec
->op
= decomp_op
;
4677 dec
->codec
= opcode_data
[decomp_op
].codec
;
4682 static void decode_inst_decompress(rv_decode
*dec
, rv_isa isa
)
4686 decode_inst_decompress_rv32(dec
);
4689 decode_inst_decompress_rv64(dec
);
4692 decode_inst_decompress_rv128(dec
);
4697 /* disassemble instruction */
4700 disasm_inst(char *buf
, size_t buflen
, rv_isa isa
, uint64_t pc
, rv_inst inst
,
4701 RISCVCPUConfig
*cfg
)
4703 rv_decode dec
= { 0 };
4708 static const struct {
4709 bool (*guard_func
)(const RISCVCPUConfig
*);
4710 const rv_opcode_data
*opcode_data
;
4711 void (*decode_func
)(rv_decode
*, rv_isa
);
4713 { always_true_p
, rvi_opcode_data
, decode_inst_opcode
},
4714 { has_XVentanaCondOps_p
, ventana_opcode_data
, decode_xventanacondops
},
4717 for (size_t i
= 0; i
< ARRAY_SIZE(decoders
); i
++) {
4718 bool (*guard_func
)(const RISCVCPUConfig
*) = decoders
[i
].guard_func
;
4719 const rv_opcode_data
*opcode_data
= decoders
[i
].opcode_data
;
4720 void (*decode_func
)(rv_decode
*, rv_isa
) = decoders
[i
].decode_func
;
4722 if (guard_func(cfg
)) {
4723 dec
.opcode_data
= opcode_data
;
4724 decode_func(&dec
, isa
);
4725 if (dec
.op
!= rv_op_illegal
)
4730 if (dec
.op
== rv_op_illegal
) {
4731 dec
.opcode_data
= rvi_opcode_data
;
4734 decode_inst_operands(&dec
, isa
);
4735 decode_inst_decompress(&dec
, isa
);
4736 decode_inst_lift_pseudo(&dec
);
4737 format_inst(buf
, buflen
, 24, &dec
);
4740 #define INST_FMT_2 "%04" PRIx64 " "
4741 #define INST_FMT_4 "%08" PRIx64 " "
4742 #define INST_FMT_6 "%012" PRIx64 " "
4743 #define INST_FMT_8 "%016" PRIx64 " "
4746 print_insn_riscv(bfd_vma memaddr
, struct disassemble_info
*info
, rv_isa isa
)
4748 char buf
[128] = { 0 };
4755 /* Instructions are made of 2-byte packets in little-endian order */
4756 for (n
= 0; n
< len
; n
+= 2) {
4757 status
= (*info
->read_memory_func
)(memaddr
+ n
, packet
, 2, info
);
4759 /* Don't fail just because we fell off the end. */
4763 (*info
->memory_error_func
)(status
, memaddr
, info
);
4766 inst
|= ((rv_inst
) bfd_getl16(packet
)) << (8 * n
);
4768 len
= inst_length(inst
);
4774 (*info
->fprintf_func
)(info
->stream
, INST_FMT_2
, inst
);
4777 (*info
->fprintf_func
)(info
->stream
, INST_FMT_4
, inst
);
4780 (*info
->fprintf_func
)(info
->stream
, INST_FMT_6
, inst
);
4783 (*info
->fprintf_func
)(info
->stream
, INST_FMT_8
, inst
);
4787 disasm_inst(buf
, sizeof(buf
), isa
, memaddr
, inst
,
4788 (RISCVCPUConfig
*)info
->target_info
);
4789 (*info
->fprintf_func
)(info
->stream
, "%s", buf
);
4794 int print_insn_riscv32(bfd_vma memaddr
, struct disassemble_info
*info
)
4796 return print_insn_riscv(memaddr
, info
, rv32
);
4799 int print_insn_riscv64(bfd_vma memaddr
, struct disassemble_info
*info
)
4801 return print_insn_riscv(memaddr
, info
, rv64
);
4804 int print_insn_riscv128(bfd_vma memaddr
, struct disassemble_info
*info
)
4806 return print_insn_riscv(memaddr
, info
, rv128
);