github.com/bir3/gocompiler@v0.9.2202/src/cmd/internal/obj/riscv/inst.go (about)

     1  // Code generated by parse.py -go rv64_a rv64_d rv64_f rv64_i rv64_m rv64_q rv_a rv_d rv_f rv_i rv_m rv_q rv_s rv_system rv_zicsr; DO NOT EDIT.
     2  package riscv
     3  
     4  import "github.com/bir3/gocompiler/src/cmd/internal/obj"
     5  
     6  type inst struct {
     7  	opcode	uint32
     8  	funct3	uint32
     9  	rs2	uint32
    10  	csr	int64
    11  	funct7	uint32
    12  }
    13  
    14  func encode(a obj.As) *inst {
    15  	switch a {
    16  	case AADD:
    17  		return &inst{0x33, 0x0, 0x0, 0, 0x0}
    18  	case AADDI:
    19  		return &inst{0x13, 0x0, 0x0, 0, 0x0}
    20  	case AADDIW:
    21  		return &inst{0x1b, 0x0, 0x0, 0, 0x0}
    22  	case AADDW:
    23  		return &inst{0x3b, 0x0, 0x0, 0, 0x0}
    24  	case AAMOADDD:
    25  		return &inst{0x2f, 0x3, 0x0, 0, 0x0}
    26  	case AAMOADDW:
    27  		return &inst{0x2f, 0x2, 0x0, 0, 0x0}
    28  	case AAMOANDD:
    29  		return &inst{0x2f, 0x3, 0x0, 1536, 0x30}
    30  	case AAMOANDW:
    31  		return &inst{0x2f, 0x2, 0x0, 1536, 0x30}
    32  	case AAMOMAXD:
    33  		return &inst{0x2f, 0x3, 0x0, -1536, 0x50}
    34  	case AAMOMAXW:
    35  		return &inst{0x2f, 0x2, 0x0, -1536, 0x50}
    36  	case AAMOMAXUD:
    37  		return &inst{0x2f, 0x3, 0x0, -512, 0x70}
    38  	case AAMOMAXUW:
    39  		return &inst{0x2f, 0x2, 0x0, -512, 0x70}
    40  	case AAMOMIND:
    41  		return &inst{0x2f, 0x3, 0x0, -2048, 0x40}
    42  	case AAMOMINW:
    43  		return &inst{0x2f, 0x2, 0x0, -2048, 0x40}
    44  	case AAMOMINUD:
    45  		return &inst{0x2f, 0x3, 0x0, -1024, 0x60}
    46  	case AAMOMINUW:
    47  		return &inst{0x2f, 0x2, 0x0, -1024, 0x60}
    48  	case AAMOORD:
    49  		return &inst{0x2f, 0x3, 0x0, 1024, 0x20}
    50  	case AAMOORW:
    51  		return &inst{0x2f, 0x2, 0x0, 1024, 0x20}
    52  	case AAMOSWAPD:
    53  		return &inst{0x2f, 0x3, 0x0, 128, 0x4}
    54  	case AAMOSWAPW:
    55  		return &inst{0x2f, 0x2, 0x0, 128, 0x4}
    56  	case AAMOXORD:
    57  		return &inst{0x2f, 0x3, 0x0, 512, 0x10}
    58  	case AAMOXORW:
    59  		return &inst{0x2f, 0x2, 0x0, 512, 0x10}
    60  	case AAND:
    61  		return &inst{0x33, 0x7, 0x0, 0, 0x0}
    62  	case AANDI:
    63  		return &inst{0x13, 0x7, 0x0, 0, 0x0}
    64  	case AAUIPC:
    65  		return &inst{0x17, 0x0, 0x0, 0, 0x0}
    66  	case ABEQ:
    67  		return &inst{0x63, 0x0, 0x0, 0, 0x0}
    68  	case ABGE:
    69  		return &inst{0x63, 0x5, 0x0, 0, 0x0}
    70  	case ABGEU:
    71  		return &inst{0x63, 0x7, 0x0, 0, 0x0}
    72  	case ABLT:
    73  		return &inst{0x63, 0x4, 0x0, 0, 0x0}
    74  	case ABLTU:
    75  		return &inst{0x63, 0x6, 0x0, 0, 0x0}
    76  	case ABNE:
    77  		return &inst{0x63, 0x1, 0x0, 0, 0x0}
    78  	case ACSRRC:
    79  		return &inst{0x73, 0x3, 0x0, 0, 0x0}
    80  	case ACSRRCI:
    81  		return &inst{0x73, 0x7, 0x0, 0, 0x0}
    82  	case ACSRRS:
    83  		return &inst{0x73, 0x2, 0x0, 0, 0x0}
    84  	case ACSRRSI:
    85  		return &inst{0x73, 0x6, 0x0, 0, 0x0}
    86  	case ACSRRW:
    87  		return &inst{0x73, 0x1, 0x0, 0, 0x0}
    88  	case ACSRRWI:
    89  		return &inst{0x73, 0x5, 0x0, 0, 0x0}
    90  	case ADIV:
    91  		return &inst{0x33, 0x4, 0x0, 32, 0x1}
    92  	case ADIVU:
    93  		return &inst{0x33, 0x5, 0x0, 32, 0x1}
    94  	case ADIVUW:
    95  		return &inst{0x3b, 0x5, 0x0, 32, 0x1}
    96  	case ADIVW:
    97  		return &inst{0x3b, 0x4, 0x0, 32, 0x1}
    98  	case ADRET:
    99  		return &inst{0x73, 0x0, 0x12, 1970, 0x3d}
   100  	case AEBREAK:
   101  		return &inst{0x73, 0x0, 0x1, 1, 0x0}
   102  	case AECALL:
   103  		return &inst{0x73, 0x0, 0x0, 0, 0x0}
   104  	case AFADDD:
   105  		return &inst{0x53, 0x0, 0x0, 32, 0x1}
   106  	case AFADDQ:
   107  		return &inst{0x53, 0x0, 0x0, 96, 0x3}
   108  	case AFADDS:
   109  		return &inst{0x53, 0x0, 0x0, 0, 0x0}
   110  	case AFCLASSD:
   111  		return &inst{0x53, 0x1, 0x0, -480, 0x71}
   112  	case AFCLASSQ:
   113  		return &inst{0x53, 0x1, 0x0, -416, 0x73}
   114  	case AFCLASSS:
   115  		return &inst{0x53, 0x1, 0x0, -512, 0x70}
   116  	case AFCVTDL:
   117  		return &inst{0x53, 0x0, 0x2, -734, 0x69}
   118  	case AFCVTDLU:
   119  		return &inst{0x53, 0x0, 0x3, -733, 0x69}
   120  	case AFCVTDQ:
   121  		return &inst{0x53, 0x0, 0x3, 1059, 0x21}
   122  	case AFCVTDS:
   123  		return &inst{0x53, 0x0, 0x0, 1056, 0x21}
   124  	case AFCVTDW:
   125  		return &inst{0x53, 0x0, 0x0, -736, 0x69}
   126  	case AFCVTDWU:
   127  		return &inst{0x53, 0x0, 0x1, -735, 0x69}
   128  	case AFCVTLD:
   129  		return &inst{0x53, 0x0, 0x2, -990, 0x61}
   130  	case AFCVTLQ:
   131  		return &inst{0x53, 0x0, 0x2, -926, 0x63}
   132  	case AFCVTLS:
   133  		return &inst{0x53, 0x0, 0x2, -1022, 0x60}
   134  	case AFCVTLUD:
   135  		return &inst{0x53, 0x0, 0x3, -989, 0x61}
   136  	case AFCVTLUQ:
   137  		return &inst{0x53, 0x0, 0x3, -925, 0x63}
   138  	case AFCVTLUS:
   139  		return &inst{0x53, 0x0, 0x3, -1021, 0x60}
   140  	case AFCVTQD:
   141  		return &inst{0x53, 0x0, 0x1, 1121, 0x23}
   142  	case AFCVTQL:
   143  		return &inst{0x53, 0x0, 0x2, -670, 0x6b}
   144  	case AFCVTQLU:
   145  		return &inst{0x53, 0x0, 0x3, -669, 0x6b}
   146  	case AFCVTQS:
   147  		return &inst{0x53, 0x0, 0x0, 1120, 0x23}
   148  	case AFCVTQW:
   149  		return &inst{0x53, 0x0, 0x0, -672, 0x6b}
   150  	case AFCVTQWU:
   151  		return &inst{0x53, 0x0, 0x1, -671, 0x6b}
   152  	case AFCVTSD:
   153  		return &inst{0x53, 0x0, 0x1, 1025, 0x20}
   154  	case AFCVTSL:
   155  		return &inst{0x53, 0x0, 0x2, -766, 0x68}
   156  	case AFCVTSLU:
   157  		return &inst{0x53, 0x0, 0x3, -765, 0x68}
   158  	case AFCVTSQ:
   159  		return &inst{0x53, 0x0, 0x3, 1027, 0x20}
   160  	case AFCVTSW:
   161  		return &inst{0x53, 0x0, 0x0, -768, 0x68}
   162  	case AFCVTSWU:
   163  		return &inst{0x53, 0x0, 0x1, -767, 0x68}
   164  	case AFCVTWD:
   165  		return &inst{0x53, 0x0, 0x0, -992, 0x61}
   166  	case AFCVTWQ:
   167  		return &inst{0x53, 0x0, 0x0, -928, 0x63}
   168  	case AFCVTWS:
   169  		return &inst{0x53, 0x0, 0x0, -1024, 0x60}
   170  	case AFCVTWUD:
   171  		return &inst{0x53, 0x0, 0x1, -991, 0x61}
   172  	case AFCVTWUQ:
   173  		return &inst{0x53, 0x0, 0x1, -927, 0x63}
   174  	case AFCVTWUS:
   175  		return &inst{0x53, 0x0, 0x1, -1023, 0x60}
   176  	case AFDIVD:
   177  		return &inst{0x53, 0x0, 0x0, 416, 0xd}
   178  	case AFDIVQ:
   179  		return &inst{0x53, 0x0, 0x0, 480, 0xf}
   180  	case AFDIVS:
   181  		return &inst{0x53, 0x0, 0x0, 384, 0xc}
   182  	case AFENCE:
   183  		return &inst{0xf, 0x0, 0x0, 0, 0x0}
   184  	case AFENCETSO:
   185  		return &inst{0xf, 0x0, 0x13, -1997, 0x41}
   186  	case AFEQD:
   187  		return &inst{0x53, 0x2, 0x0, -1504, 0x51}
   188  	case AFEQQ:
   189  		return &inst{0x53, 0x2, 0x0, -1440, 0x53}
   190  	case AFEQS:
   191  		return &inst{0x53, 0x2, 0x0, -1536, 0x50}
   192  	case AFLD:
   193  		return &inst{0x7, 0x3, 0x0, 0, 0x0}
   194  	case AFLED:
   195  		return &inst{0x53, 0x0, 0x0, -1504, 0x51}
   196  	case AFLEQ:
   197  		return &inst{0x53, 0x0, 0x0, -1440, 0x53}
   198  	case AFLES:
   199  		return &inst{0x53, 0x0, 0x0, -1536, 0x50}
   200  	case AFLQ:
   201  		return &inst{0x7, 0x4, 0x0, 0, 0x0}
   202  	case AFLTD:
   203  		return &inst{0x53, 0x1, 0x0, -1504, 0x51}
   204  	case AFLTQ:
   205  		return &inst{0x53, 0x1, 0x0, -1440, 0x53}
   206  	case AFLTS:
   207  		return &inst{0x53, 0x1, 0x0, -1536, 0x50}
   208  	case AFLW:
   209  		return &inst{0x7, 0x2, 0x0, 0, 0x0}
   210  	case AFMADDD:
   211  		return &inst{0x43, 0x0, 0x0, 32, 0x1}
   212  	case AFMADDQ:
   213  		return &inst{0x43, 0x0, 0x0, 96, 0x3}
   214  	case AFMADDS:
   215  		return &inst{0x43, 0x0, 0x0, 0, 0x0}
   216  	case AFMAXD:
   217  		return &inst{0x53, 0x1, 0x0, 672, 0x15}
   218  	case AFMAXQ:
   219  		return &inst{0x53, 0x1, 0x0, 736, 0x17}
   220  	case AFMAXS:
   221  		return &inst{0x53, 0x1, 0x0, 640, 0x14}
   222  	case AFMIND:
   223  		return &inst{0x53, 0x0, 0x0, 672, 0x15}
   224  	case AFMINQ:
   225  		return &inst{0x53, 0x0, 0x0, 736, 0x17}
   226  	case AFMINS:
   227  		return &inst{0x53, 0x0, 0x0, 640, 0x14}
   228  	case AFMSUBD:
   229  		return &inst{0x47, 0x0, 0x0, 32, 0x1}
   230  	case AFMSUBQ:
   231  		return &inst{0x47, 0x0, 0x0, 96, 0x3}
   232  	case AFMSUBS:
   233  		return &inst{0x47, 0x0, 0x0, 0, 0x0}
   234  	case AFMULD:
   235  		return &inst{0x53, 0x0, 0x0, 288, 0x9}
   236  	case AFMULQ:
   237  		return &inst{0x53, 0x0, 0x0, 352, 0xb}
   238  	case AFMULS:
   239  		return &inst{0x53, 0x0, 0x0, 256, 0x8}
   240  	case AFMVDX:
   241  		return &inst{0x53, 0x0, 0x0, -224, 0x79}
   242  	case AFMVSX:
   243  		return &inst{0x53, 0x0, 0x0, -256, 0x78}
   244  	case AFMVWX:
   245  		return &inst{0x53, 0x0, 0x0, -256, 0x78}
   246  	case AFMVXD:
   247  		return &inst{0x53, 0x0, 0x0, -480, 0x71}
   248  	case AFMVXS:
   249  		return &inst{0x53, 0x0, 0x0, -512, 0x70}
   250  	case AFMVXW:
   251  		return &inst{0x53, 0x0, 0x0, -512, 0x70}
   252  	case AFNMADDD:
   253  		return &inst{0x4f, 0x0, 0x0, 32, 0x1}
   254  	case AFNMADDQ:
   255  		return &inst{0x4f, 0x0, 0x0, 96, 0x3}
   256  	case AFNMADDS:
   257  		return &inst{0x4f, 0x0, 0x0, 0, 0x0}
   258  	case AFNMSUBD:
   259  		return &inst{0x4b, 0x0, 0x0, 32, 0x1}
   260  	case AFNMSUBQ:
   261  		return &inst{0x4b, 0x0, 0x0, 96, 0x3}
   262  	case AFNMSUBS:
   263  		return &inst{0x4b, 0x0, 0x0, 0, 0x0}
   264  	case AFRCSR:
   265  		return &inst{0x73, 0x2, 0x3, 3, 0x0}
   266  	case AFRFLAGS:
   267  		return &inst{0x73, 0x2, 0x1, 1, 0x0}
   268  	case AFRRM:
   269  		return &inst{0x73, 0x2, 0x2, 2, 0x0}
   270  	case AFSCSR:
   271  		return &inst{0x73, 0x1, 0x3, 3, 0x0}
   272  	case AFSD:
   273  		return &inst{0x27, 0x3, 0x0, 0, 0x0}
   274  	case AFSFLAGS:
   275  		return &inst{0x73, 0x1, 0x1, 1, 0x0}
   276  	case AFSFLAGSI:
   277  		return &inst{0x73, 0x5, 0x1, 1, 0x0}
   278  	case AFSGNJD:
   279  		return &inst{0x53, 0x0, 0x0, 544, 0x11}
   280  	case AFSGNJQ:
   281  		return &inst{0x53, 0x0, 0x0, 608, 0x13}
   282  	case AFSGNJS:
   283  		return &inst{0x53, 0x0, 0x0, 512, 0x10}
   284  	case AFSGNJND:
   285  		return &inst{0x53, 0x1, 0x0, 544, 0x11}
   286  	case AFSGNJNQ:
   287  		return &inst{0x53, 0x1, 0x0, 608, 0x13}
   288  	case AFSGNJNS:
   289  		return &inst{0x53, 0x1, 0x0, 512, 0x10}
   290  	case AFSGNJXD:
   291  		return &inst{0x53, 0x2, 0x0, 544, 0x11}
   292  	case AFSGNJXQ:
   293  		return &inst{0x53, 0x2, 0x0, 608, 0x13}
   294  	case AFSGNJXS:
   295  		return &inst{0x53, 0x2, 0x0, 512, 0x10}
   296  	case AFSQ:
   297  		return &inst{0x27, 0x4, 0x0, 0, 0x0}
   298  	case AFSQRTD:
   299  		return &inst{0x53, 0x0, 0x0, 1440, 0x2d}
   300  	case AFSQRTQ:
   301  		return &inst{0x53, 0x0, 0x0, 1504, 0x2f}
   302  	case AFSQRTS:
   303  		return &inst{0x53, 0x0, 0x0, 1408, 0x2c}
   304  	case AFSRM:
   305  		return &inst{0x73, 0x1, 0x2, 2, 0x0}
   306  	case AFSRMI:
   307  		return &inst{0x73, 0x5, 0x2, 2, 0x0}
   308  	case AFSUBD:
   309  		return &inst{0x53, 0x0, 0x0, 160, 0x5}
   310  	case AFSUBQ:
   311  		return &inst{0x53, 0x0, 0x0, 224, 0x7}
   312  	case AFSUBS:
   313  		return &inst{0x53, 0x0, 0x0, 128, 0x4}
   314  	case AFSW:
   315  		return &inst{0x27, 0x2, 0x0, 0, 0x0}
   316  	case AJAL:
   317  		return &inst{0x6f, 0x0, 0x0, 0, 0x0}
   318  	case AJALR:
   319  		return &inst{0x67, 0x0, 0x0, 0, 0x0}
   320  	case ALB:
   321  		return &inst{0x3, 0x0, 0x0, 0, 0x0}
   322  	case ALBU:
   323  		return &inst{0x3, 0x4, 0x0, 0, 0x0}
   324  	case ALD:
   325  		return &inst{0x3, 0x3, 0x0, 0, 0x0}
   326  	case ALH:
   327  		return &inst{0x3, 0x1, 0x0, 0, 0x0}
   328  	case ALHU:
   329  		return &inst{0x3, 0x5, 0x0, 0, 0x0}
   330  	case ALRD:
   331  		return &inst{0x2f, 0x3, 0x0, 256, 0x8}
   332  	case ALRW:
   333  		return &inst{0x2f, 0x2, 0x0, 256, 0x8}
   334  	case ALUI:
   335  		return &inst{0x37, 0x0, 0x0, 0, 0x0}
   336  	case ALW:
   337  		return &inst{0x3, 0x2, 0x0, 0, 0x0}
   338  	case ALWU:
   339  		return &inst{0x3, 0x6, 0x0, 0, 0x0}
   340  	case AMRET:
   341  		return &inst{0x73, 0x0, 0x2, 770, 0x18}
   342  	case AMUL:
   343  		return &inst{0x33, 0x0, 0x0, 32, 0x1}
   344  	case AMULH:
   345  		return &inst{0x33, 0x1, 0x0, 32, 0x1}
   346  	case AMULHSU:
   347  		return &inst{0x33, 0x2, 0x0, 32, 0x1}
   348  	case AMULHU:
   349  		return &inst{0x33, 0x3, 0x0, 32, 0x1}
   350  	case AMULW:
   351  		return &inst{0x3b, 0x0, 0x0, 32, 0x1}
   352  	case AOR:
   353  		return &inst{0x33, 0x6, 0x0, 0, 0x0}
   354  	case AORI:
   355  		return &inst{0x13, 0x6, 0x0, 0, 0x0}
   356  	case APAUSE:
   357  		return &inst{0xf, 0x0, 0x10, 16, 0x0}
   358  	case ARDCYCLE:
   359  		return &inst{0x73, 0x2, 0x0, -1024, 0x60}
   360  	case ARDCYCLEH:
   361  		return &inst{0x73, 0x2, 0x0, -896, 0x64}
   362  	case ARDINSTRET:
   363  		return &inst{0x73, 0x2, 0x2, -1022, 0x60}
   364  	case ARDINSTRETH:
   365  		return &inst{0x73, 0x2, 0x2, -894, 0x64}
   366  	case ARDTIME:
   367  		return &inst{0x73, 0x2, 0x1, -1023, 0x60}
   368  	case ARDTIMEH:
   369  		return &inst{0x73, 0x2, 0x1, -895, 0x64}
   370  	case AREM:
   371  		return &inst{0x33, 0x6, 0x0, 32, 0x1}
   372  	case AREMU:
   373  		return &inst{0x33, 0x7, 0x0, 32, 0x1}
   374  	case AREMUW:
   375  		return &inst{0x3b, 0x7, 0x0, 32, 0x1}
   376  	case AREMW:
   377  		return &inst{0x3b, 0x6, 0x0, 32, 0x1}
   378  	case ASB:
   379  		return &inst{0x23, 0x0, 0x0, 0, 0x0}
   380  	case ASBREAK:
   381  		return &inst{0x73, 0x0, 0x1, 1, 0x0}
   382  	case ASCD:
   383  		return &inst{0x2f, 0x3, 0x0, 384, 0xc}
   384  	case ASCW:
   385  		return &inst{0x2f, 0x2, 0x0, 384, 0xc}
   386  	case ASCALL:
   387  		return &inst{0x73, 0x0, 0x0, 0, 0x0}
   388  	case ASD:
   389  		return &inst{0x23, 0x3, 0x0, 0, 0x0}
   390  	case ASFENCEVMA:
   391  		return &inst{0x73, 0x0, 0x0, 288, 0x9}
   392  	case ASH:
   393  		return &inst{0x23, 0x1, 0x0, 0, 0x0}
   394  	case ASLL:
   395  		return &inst{0x33, 0x1, 0x0, 0, 0x0}
   396  	case ASLLI:
   397  		return &inst{0x13, 0x1, 0x0, 0, 0x0}
   398  	case ASLLIW:
   399  		return &inst{0x1b, 0x1, 0x0, 0, 0x0}
   400  	case ASLLW:
   401  		return &inst{0x3b, 0x1, 0x0, 0, 0x0}
   402  	case ASLT:
   403  		return &inst{0x33, 0x2, 0x0, 0, 0x0}
   404  	case ASLTI:
   405  		return &inst{0x13, 0x2, 0x0, 0, 0x0}
   406  	case ASLTIU:
   407  		return &inst{0x13, 0x3, 0x0, 0, 0x0}
   408  	case ASLTU:
   409  		return &inst{0x33, 0x3, 0x0, 0, 0x0}
   410  	case ASRA:
   411  		return &inst{0x33, 0x5, 0x0, 1024, 0x20}
   412  	case ASRAI:
   413  		return &inst{0x13, 0x5, 0x0, 1024, 0x20}
   414  	case ASRAIW:
   415  		return &inst{0x1b, 0x5, 0x0, 1024, 0x20}
   416  	case ASRAW:
   417  		return &inst{0x3b, 0x5, 0x0, 1024, 0x20}
   418  	case ASRET:
   419  		return &inst{0x73, 0x0, 0x2, 258, 0x8}
   420  	case ASRL:
   421  		return &inst{0x33, 0x5, 0x0, 0, 0x0}
   422  	case ASRLI:
   423  		return &inst{0x13, 0x5, 0x0, 0, 0x0}
   424  	case ASRLIW:
   425  		return &inst{0x1b, 0x5, 0x0, 0, 0x0}
   426  	case ASRLW:
   427  		return &inst{0x3b, 0x5, 0x0, 0, 0x0}
   428  	case ASUB:
   429  		return &inst{0x33, 0x0, 0x0, 1024, 0x20}
   430  	case ASUBW:
   431  		return &inst{0x3b, 0x0, 0x0, 1024, 0x20}
   432  	case ASW:
   433  		return &inst{0x23, 0x2, 0x0, 0, 0x0}
   434  	case AWFI:
   435  		return &inst{0x73, 0x0, 0x5, 261, 0x8}
   436  	case AXOR:
   437  		return &inst{0x33, 0x4, 0x0, 0, 0x0}
   438  	case AXORI:
   439  		return &inst{0x13, 0x4, 0x0, 0, 0x0}
   440  	}
   441  	return nil
   442  }