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