github.com/tencent/goom@v1.0.1/internal/arch/arm64asm/decode.go (about) 1 // Copyright 2017 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package arm64asm 6 7 import ( 8 "encoding/binary" 9 "fmt" 10 ) 11 12 type instArgs [5]instArg 13 14 // An instFormat describes the format of an instruction encoding. 15 // An instruction with 32-bit value x matches the format if x&mask == value 16 // and the predicator: canDecode(x) return true. 17 type instFormat struct { 18 mask uint32 19 value uint32 20 op Op 21 // args describe how to decode the instruction arguments. 22 // args is stored as a fixed-size array. 23 // if there are fewer than len(args) arguments, args[i] == 0 marks 24 // the end of the argument list. 25 args instArgs 26 canDecode func(instr uint32) bool 27 } 28 29 var ( 30 errShort = fmt.Errorf("truncated instruction") 31 errUnknown = fmt.Errorf("unknown instruction") 32 ) 33 34 var decoderCover []bool 35 36 func init() { 37 decoderCover = make([]bool, len(instFormats)) 38 } 39 40 // Decode decodes the 4 bytes in src as a single instruction. 41 func Decode(src []byte) (inst Inst, err error) { 42 if len(src) < 4 { 43 return Inst{}, errShort 44 } 45 46 x := binary.LittleEndian.Uint32(src) 47 48 Search: 49 for i := range instFormats { 50 f := &instFormats[i] 51 if x&f.mask != f.value { 52 continue 53 } 54 if f.canDecode != nil && !f.canDecode(x) { 55 continue 56 } 57 // Decode args. 58 var args Args 59 for j, aop := range f.args { 60 if aop == 0 { 61 break 62 } 63 arg := decodeArg(aop, x) 64 if arg == nil { // Cannot decode argument 65 continue Search 66 } 67 args[j] = arg 68 } 69 decoderCover[i] = true 70 inst = Inst{ 71 Op: f.op, 72 Args: args, 73 Enc: x, 74 } 75 return inst, nil 76 } 77 return Inst{}, errUnknown 78 } 79 80 // decodeArg decodes the arg described by aop from the instruction bits x. 81 // It returns nil if x cannot be decoded according to aop. 82 // nolint 83 func decodeArg(aop instArg, x uint32) Arg { 84 switch aop { 85 default: 86 return nil 87 88 case arg_Da: 89 return D0 + Reg((x>>10)&(1<<5-1)) 90 91 case arg_Dd: 92 return D0 + Reg(x&(1<<5-1)) 93 94 case arg_Dm: 95 return D0 + Reg((x>>16)&(1<<5-1)) 96 97 case arg_Dn: 98 return D0 + Reg((x>>5)&(1<<5-1)) 99 100 case arg_Hd: 101 return H0 + Reg(x&(1<<5-1)) 102 103 case arg_Hn: 104 return H0 + Reg((x>>5)&(1<<5-1)) 105 106 case arg_IAddSub: 107 imm12 := (x >> 10) & (1<<12 - 1) 108 shift := (x >> 22) & (1<<2 - 1) 109 if shift > 1 { 110 return nil 111 } 112 shift = shift * 12 113 return ImmShift{uint16(imm12), uint8(shift)} 114 115 case arg_Sa: 116 return S0 + Reg((x>>10)&(1<<5-1)) 117 118 case arg_Sd: 119 return S0 + Reg(x&(1<<5-1)) 120 121 case arg_Sm: 122 return S0 + Reg((x>>16)&(1<<5-1)) 123 124 case arg_Sn: 125 return S0 + Reg((x>>5)&(1<<5-1)) 126 127 case arg_Wa: 128 return W0 + Reg((x>>10)&(1<<5-1)) 129 130 case arg_Wd: 131 return W0 + Reg(x&(1<<5-1)) 132 133 case arg_Wds: 134 return RegSP(W0) + RegSP(x&(1<<5-1)) 135 136 case arg_Wm: 137 return W0 + Reg((x>>16)&(1<<5-1)) 138 139 case arg_Rm_extend__UXTB_0__UXTH_1__UXTW_2__LSL_UXTX_3__SXTB_4__SXTH_5__SXTW_6__SXTX_7__0_4: 140 return handle_ExtendedRegister(x, true) 141 142 case arg_Wm_extend__UXTB_0__UXTH_1__LSL_UXTW_2__UXTX_3__SXTB_4__SXTH_5__SXTW_6__SXTX_7__0_4: 143 return handle_ExtendedRegister(x, false) 144 145 case arg_Wn: 146 return W0 + Reg((x>>5)&(1<<5-1)) 147 148 case arg_Wns: 149 return RegSP(W0) + RegSP((x>>5)&(1<<5-1)) 150 151 case arg_Xa: 152 return X0 + Reg((x>>10)&(1<<5-1)) 153 154 case arg_Xd: 155 return X0 + Reg(x&(1<<5-1)) 156 157 case arg_Xds: 158 return RegSP(X0) + RegSP(x&(1<<5-1)) 159 160 case arg_Xm: 161 return X0 + Reg((x>>16)&(1<<5-1)) 162 163 case arg_Wm_shift__LSL_0__LSR_1__ASR_2__0_31: 164 return handle_ImmediateShiftedRegister(x, 31, true, false) 165 166 case arg_Wm_shift__LSL_0__LSR_1__ASR_2__ROR_3__0_31: 167 return handle_ImmediateShiftedRegister(x, 31, true, true) 168 169 case arg_Xm_shift__LSL_0__LSR_1__ASR_2__0_63: 170 return handle_ImmediateShiftedRegister(x, 63, false, false) 171 172 case arg_Xm_shift__LSL_0__LSR_1__ASR_2__ROR_3__0_63: 173 return handle_ImmediateShiftedRegister(x, 63, false, true) 174 175 case arg_Xn: 176 return X0 + Reg((x>>5)&(1<<5-1)) 177 178 case arg_Xns: 179 return RegSP(X0) + RegSP((x>>5)&(1<<5-1)) 180 181 case arg_slabel_imm14_2: 182 imm14 := ((x >> 5) & (1<<14 - 1)) 183 return PCRel(((int64(imm14) << 2) << 48) >> 48) 184 185 case arg_slabel_imm19_2: 186 imm19 := ((x >> 5) & (1<<19 - 1)) 187 return PCRel(((int64(imm19) << 2) << 43) >> 43) 188 189 case arg_slabel_imm26_2: 190 imm26 := (x & (1<<26 - 1)) 191 return PCRel(((int64(imm26) << 2) << 36) >> 36) 192 193 case arg_slabel_immhi_immlo_0: 194 immhi := ((x >> 5) & (1<<19 - 1)) 195 immlo := ((x >> 29) & (1<<2 - 1)) 196 immhilo := (immhi)<<2 | immlo 197 return PCRel((int64(immhilo) << 43) >> 43) 198 199 case arg_slabel_immhi_immlo_12: 200 immhi := ((x >> 5) & (1<<19 - 1)) 201 immlo := ((x >> 29) & (1<<2 - 1)) 202 immhilo := (immhi)<<2 | immlo 203 return PCRel(((int64(immhilo) << 12) << 31) >> 31) 204 205 case arg_Xns_mem: 206 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 207 return MemImmediate{Rn, AddrOffset, 0} 208 209 case arg_Xns_mem_extend_m__UXTW_2__LSL_3__SXTW_6__SXTX_7__0_0__1_1: 210 return handle_MemExtend(x, 1, false) 211 212 case arg_Xns_mem_extend_m__UXTW_2__LSL_3__SXTW_6__SXTX_7__0_0__2_1: 213 return handle_MemExtend(x, 2, false) 214 215 case arg_Xns_mem_extend_m__UXTW_2__LSL_3__SXTW_6__SXTX_7__0_0__3_1: 216 return handle_MemExtend(x, 3, false) 217 218 case arg_Xns_mem_extend_m__UXTW_2__LSL_3__SXTW_6__SXTX_7__absent_0__0_1: 219 return handle_MemExtend(x, 1, true) 220 221 case arg_Xns_mem_optional_imm12_1_unsigned: 222 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 223 imm12 := (x >> 10) & (1<<12 - 1) 224 return MemImmediate{Rn, AddrOffset, int32(imm12)} 225 226 case arg_Xns_mem_optional_imm12_2_unsigned: 227 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 228 imm12 := (x >> 10) & (1<<12 - 1) 229 return MemImmediate{Rn, AddrOffset, int32(imm12 << 1)} 230 231 case arg_Xns_mem_optional_imm12_4_unsigned: 232 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 233 imm12 := (x >> 10) & (1<<12 - 1) 234 return MemImmediate{Rn, AddrOffset, int32(imm12 << 2)} 235 236 case arg_Xns_mem_optional_imm12_8_unsigned: 237 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 238 imm12 := (x >> 10) & (1<<12 - 1) 239 return MemImmediate{Rn, AddrOffset, int32(imm12 << 3)} 240 241 case arg_Xns_mem_optional_imm7_4_signed: 242 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 243 imm7 := (x >> 15) & (1<<7 - 1) 244 return MemImmediate{Rn, AddrOffset, ((int32(imm7 << 2)) << 23) >> 23} 245 246 case arg_Xns_mem_optional_imm7_8_signed: 247 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 248 imm7 := (x >> 15) & (1<<7 - 1) 249 return MemImmediate{Rn, AddrOffset, ((int32(imm7 << 3)) << 22) >> 22} 250 251 case arg_Xns_mem_optional_imm9_1_signed: 252 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 253 imm9 := (x >> 12) & (1<<9 - 1) 254 return MemImmediate{Rn, AddrOffset, (int32(imm9) << 23) >> 23} 255 256 case arg_Xns_mem_post_imm7_4_signed: 257 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 258 imm7 := (x >> 15) & (1<<7 - 1) 259 return MemImmediate{Rn, AddrPostIndex, ((int32(imm7 << 2)) << 23) >> 23} 260 261 case arg_Xns_mem_post_imm7_8_signed: 262 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 263 imm7 := (x >> 15) & (1<<7 - 1) 264 return MemImmediate{Rn, AddrPostIndex, ((int32(imm7 << 3)) << 22) >> 22} 265 266 case arg_Xns_mem_post_imm9_1_signed: 267 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 268 imm9 := (x >> 12) & (1<<9 - 1) 269 return MemImmediate{Rn, AddrPostIndex, ((int32(imm9)) << 23) >> 23} 270 271 case arg_Xns_mem_wb_imm7_4_signed: 272 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 273 imm7 := (x >> 15) & (1<<7 - 1) 274 return MemImmediate{Rn, AddrPreIndex, ((int32(imm7 << 2)) << 23) >> 23} 275 276 case arg_Xns_mem_wb_imm7_8_signed: 277 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 278 imm7 := (x >> 15) & (1<<7 - 1) 279 return MemImmediate{Rn, AddrPreIndex, ((int32(imm7 << 3)) << 22) >> 22} 280 281 case arg_Xns_mem_wb_imm9_1_signed: 282 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 283 imm9 := (x >> 12) & (1<<9 - 1) 284 return MemImmediate{Rn, AddrPreIndex, ((int32(imm9)) << 23) >> 23} 285 286 case arg_Ws: 287 return W0 + Reg((x>>16)&(1<<5-1)) 288 289 case arg_Wt: 290 return W0 + Reg(x&(1<<5-1)) 291 292 case arg_Wt2: 293 return W0 + Reg((x>>10)&(1<<5-1)) 294 295 case arg_Xs: 296 return X0 + Reg((x>>16)&(1<<5-1)) 297 298 case arg_Xt: 299 return X0 + Reg(x&(1<<5-1)) 300 301 case arg_Xt2: 302 return X0 + Reg((x>>10)&(1<<5-1)) 303 304 case arg_immediate_0_127_CRm_op2: 305 crm_op2 := (x >> 5) & (1<<7 - 1) 306 return Imm_hint(crm_op2) 307 308 case arg_immediate_0_15_CRm: 309 crm := (x >> 8) & (1<<4 - 1) 310 return Imm{crm, false} 311 312 case arg_immediate_0_15_nzcv: 313 nzcv := x & (1<<4 - 1) 314 return Imm{nzcv, false} 315 316 case arg_immediate_0_31_imm5: 317 imm5 := (x >> 16) & (1<<5 - 1) 318 return Imm{imm5, false} 319 320 case arg_immediate_0_31_immr: 321 immr := (x >> 16) & (1<<6 - 1) 322 if immr > 31 { 323 return nil 324 } 325 return Imm{immr, false} 326 327 case arg_immediate_0_31_imms: 328 imms := (x >> 10) & (1<<6 - 1) 329 if imms > 31 { 330 return nil 331 } 332 return Imm{imms, true} 333 334 case arg_immediate_0_63_b5_b40: 335 b5 := (x >> 31) & 1 336 b40 := (x >> 19) & (1<<5 - 1) 337 return Imm{(b5 << 5) | b40, true} 338 339 case arg_immediate_0_63_immr: 340 immr := (x >> 16) & (1<<6 - 1) 341 return Imm{immr, false} 342 343 case arg_immediate_0_63_imms: 344 imms := (x >> 10) & (1<<6 - 1) 345 return Imm{imms, true} 346 347 case arg_immediate_0_65535_imm16: 348 imm16 := (x >> 5) & (1<<16 - 1) 349 return Imm{imm16, false} 350 351 case arg_immediate_0_7_op1: 352 op1 := (x >> 16) & (1<<3 - 1) 353 return Imm{op1, true} 354 355 case arg_immediate_0_7_op2: 356 op2 := (x >> 5) & (1<<3 - 1) 357 return Imm{op2, true} 358 359 case arg_immediate_ASR_SBFM_32M_bitfield_0_31_immr: 360 immr := (x >> 16) & (1<<6 - 1) 361 if immr > 31 { 362 return nil 363 } 364 return Imm{immr, true} 365 366 case arg_immediate_ASR_SBFM_64M_bitfield_0_63_immr: 367 immr := (x >> 16) & (1<<6 - 1) 368 return Imm{immr, true} 369 370 case arg_immediate_BFI_BFM_32M_bitfield_lsb_32_immr: 371 immr := (x >> 16) & (1<<6 - 1) 372 if immr > 31 { 373 return nil 374 } 375 return Imm{32 - immr, true} 376 377 case arg_immediate_BFI_BFM_32M_bitfield_width_32_imms: 378 imms := (x >> 10) & (1<<6 - 1) 379 if imms > 31 { 380 return nil 381 } 382 return Imm{imms + 1, true} 383 384 case arg_immediate_BFI_BFM_64M_bitfield_lsb_64_immr: 385 immr := (x >> 16) & (1<<6 - 1) 386 return Imm{64 - immr, true} 387 388 case arg_immediate_BFI_BFM_64M_bitfield_width_64_imms: 389 imms := (x >> 10) & (1<<6 - 1) 390 return Imm{imms + 1, true} 391 392 case arg_immediate_BFXIL_BFM_32M_bitfield_lsb_32_immr: 393 immr := (x >> 16) & (1<<6 - 1) 394 if immr > 31 { 395 return nil 396 } 397 return Imm{immr, true} 398 399 case arg_immediate_BFXIL_BFM_32M_bitfield_width_32_imms: 400 immr := (x >> 16) & (1<<6 - 1) 401 imms := (x >> 10) & (1<<6 - 1) 402 width := imms - immr + 1 403 if width < 1 || width > 32-immr { 404 return nil 405 } 406 return Imm{width, true} 407 408 case arg_immediate_BFXIL_BFM_64M_bitfield_lsb_64_immr: 409 immr := (x >> 16) & (1<<6 - 1) 410 return Imm{immr, true} 411 412 case arg_immediate_BFXIL_BFM_64M_bitfield_width_64_imms: 413 immr := (x >> 16) & (1<<6 - 1) 414 imms := (x >> 10) & (1<<6 - 1) 415 width := imms - immr + 1 416 if width < 1 || width > 64-immr { 417 return nil 418 } 419 return Imm{width, true} 420 421 case arg_immediate_bitmask_32_imms_immr: 422 return handle_bitmasks(x, 32) 423 424 case arg_immediate_bitmask_64_N_imms_immr: 425 return handle_bitmasks(x, 64) 426 427 case arg_immediate_LSL_UBFM_32M_bitfield_0_31_immr: 428 imms := (x >> 10) & (1<<6 - 1) 429 shift := 31 - imms 430 if shift > 31 { 431 return nil 432 } 433 return Imm{shift, true} 434 435 case arg_immediate_LSL_UBFM_64M_bitfield_0_63_immr: 436 imms := (x >> 10) & (1<<6 - 1) 437 shift := 63 - imms 438 if shift > 63 { 439 return nil 440 } 441 return Imm{shift, true} 442 443 case arg_immediate_LSR_UBFM_32M_bitfield_0_31_immr: 444 immr := (x >> 16) & (1<<6 - 1) 445 if immr > 31 { 446 return nil 447 } 448 return Imm{immr, true} 449 450 case arg_immediate_LSR_UBFM_64M_bitfield_0_63_immr: 451 immr := (x >> 16) & (1<<6 - 1) 452 return Imm{immr, true} 453 454 case arg_immediate_optional_0_15_CRm: 455 crm := (x >> 8) & (1<<4 - 1) 456 return Imm_clrex(crm) 457 458 case arg_immediate_optional_0_65535_imm16: 459 imm16 := (x >> 5) & (1<<16 - 1) 460 return Imm_dcps(imm16) 461 462 case arg_immediate_OptLSL_amount_16_0_16: 463 imm16 := (x >> 5) & (1<<16 - 1) 464 hw := (x >> 21) & (1<<2 - 1) 465 shift := hw * 16 466 if shift > 16 { 467 return nil 468 } 469 return ImmShift{uint16(imm16), uint8(shift)} 470 471 case arg_immediate_OptLSL_amount_16_0_48: 472 imm16 := (x >> 5) & (1<<16 - 1) 473 hw := (x >> 21) & (1<<2 - 1) 474 shift := hw * 16 475 return ImmShift{uint16(imm16), uint8(shift)} 476 477 case arg_immediate_SBFIZ_SBFM_32M_bitfield_lsb_32_immr: 478 immr := (x >> 16) & (1<<6 - 1) 479 if immr > 31 { 480 return nil 481 } 482 return Imm{32 - immr, true} 483 484 case arg_immediate_SBFIZ_SBFM_32M_bitfield_width_32_imms: 485 imms := (x >> 10) & (1<<6 - 1) 486 if imms > 31 { 487 return nil 488 } 489 return Imm{imms + 1, true} 490 491 case arg_immediate_SBFIZ_SBFM_64M_bitfield_lsb_64_immr: 492 immr := (x >> 16) & (1<<6 - 1) 493 return Imm{64 - immr, true} 494 495 case arg_immediate_SBFIZ_SBFM_64M_bitfield_width_64_imms: 496 imms := (x >> 10) & (1<<6 - 1) 497 return Imm{imms + 1, true} 498 499 case arg_immediate_SBFX_SBFM_32M_bitfield_lsb_32_immr: 500 immr := (x >> 16) & (1<<6 - 1) 501 if immr > 31 { 502 return nil 503 } 504 return Imm{immr, true} 505 506 case arg_immediate_SBFX_SBFM_32M_bitfield_width_32_imms: 507 immr := (x >> 16) & (1<<6 - 1) 508 imms := (x >> 10) & (1<<6 - 1) 509 width := imms - immr + 1 510 if width < 1 || width > 32-immr { 511 return nil 512 } 513 return Imm{width, true} 514 515 case arg_immediate_SBFX_SBFM_64M_bitfield_lsb_64_immr: 516 immr := (x >> 16) & (1<<6 - 1) 517 return Imm{immr, true} 518 519 case arg_immediate_SBFX_SBFM_64M_bitfield_width_64_imms: 520 immr := (x >> 16) & (1<<6 - 1) 521 imms := (x >> 10) & (1<<6 - 1) 522 width := imms - immr + 1 523 if width < 1 || width > 64-immr { 524 return nil 525 } 526 return Imm{width, true} 527 528 case arg_immediate_shift_32_implicit_imm16_hw: 529 imm16 := (x >> 5) & (1<<16 - 1) 530 hw := (x >> 21) & (1<<2 - 1) 531 shift := hw * 16 532 if shift > 16 { 533 return nil 534 } 535 result := uint32(imm16) << shift 536 return Imm{result, false} 537 538 case arg_immediate_shift_32_implicit_inverse_imm16_hw: 539 imm16 := (x >> 5) & (1<<16 - 1) 540 hw := (x >> 21) & (1<<2 - 1) 541 shift := hw * 16 542 if shift > 16 { 543 return nil 544 } 545 result := uint32(imm16) << shift 546 return Imm{^result, false} 547 548 case arg_immediate_shift_64_implicit_imm16_hw: 549 imm16 := (x >> 5) & (1<<16 - 1) 550 hw := (x >> 21) & (1<<2 - 1) 551 shift := hw * 16 552 result := uint64(imm16) << shift 553 return Imm64{result, false} 554 555 case arg_immediate_shift_64_implicit_inverse_imm16_hw: 556 imm16 := (x >> 5) & (1<<16 - 1) 557 hw := (x >> 21) & (1<<2 - 1) 558 shift := hw * 16 559 result := uint64(imm16) << shift 560 return Imm64{^result, false} 561 562 case arg_immediate_UBFIZ_UBFM_32M_bitfield_lsb_32_immr: 563 immr := (x >> 16) & (1<<6 - 1) 564 if immr > 31 { 565 return nil 566 } 567 return Imm{32 - immr, true} 568 569 case arg_immediate_UBFIZ_UBFM_32M_bitfield_width_32_imms: 570 imms := (x >> 10) & (1<<6 - 1) 571 if imms > 31 { 572 return nil 573 } 574 return Imm{imms + 1, true} 575 576 case arg_immediate_UBFIZ_UBFM_64M_bitfield_lsb_64_immr: 577 immr := (x >> 16) & (1<<6 - 1) 578 return Imm{64 - immr, true} 579 580 case arg_immediate_UBFIZ_UBFM_64M_bitfield_width_64_imms: 581 imms := (x >> 10) & (1<<6 - 1) 582 return Imm{imms + 1, true} 583 584 case arg_immediate_UBFX_UBFM_32M_bitfield_lsb_32_immr: 585 immr := (x >> 16) & (1<<6 - 1) 586 if immr > 31 { 587 return nil 588 } 589 return Imm{immr, true} 590 591 case arg_immediate_UBFX_UBFM_32M_bitfield_width_32_imms: 592 immr := (x >> 16) & (1<<6 - 1) 593 imms := (x >> 10) & (1<<6 - 1) 594 width := imms - immr + 1 595 if width < 1 || width > 32-immr { 596 return nil 597 } 598 return Imm{width, true} 599 600 case arg_immediate_UBFX_UBFM_64M_bitfield_lsb_64_immr: 601 immr := (x >> 16) & (1<<6 - 1) 602 return Imm{immr, true} 603 604 case arg_immediate_UBFX_UBFM_64M_bitfield_width_64_imms: 605 immr := (x >> 16) & (1<<6 - 1) 606 imms := (x >> 10) & (1<<6 - 1) 607 width := imms - immr + 1 608 if width < 1 || width > 64-immr { 609 return nil 610 } 611 return Imm{width, true} 612 613 case arg_Rt_31_1__W_0__X_1: 614 b5 := (x >> 31) & 1 615 Rt := x & (1<<5 - 1) 616 if b5 == 0 { 617 return W0 + Reg(Rt) 618 } else { 619 return X0 + Reg(Rt) 620 } 621 622 case arg_cond_AllowALNV_Normal: 623 cond := (x >> 12) & (1<<4 - 1) 624 return Cond{uint8(cond), false} 625 626 case arg_conditional: 627 cond := x & (1<<4 - 1) 628 return Cond{uint8(cond), false} 629 630 case arg_cond_NotAllowALNV_Invert: 631 cond := (x >> 12) & (1<<4 - 1) 632 if (cond >> 1) == 7 { 633 return nil 634 } 635 return Cond{uint8(cond), true} 636 637 case arg_Cm: 638 CRm := (x >> 8) & (1<<4 - 1) 639 return Imm_c(CRm) 640 641 case arg_Cn: 642 CRn := (x >> 12) & (1<<4 - 1) 643 return Imm_c(CRn) 644 645 case arg_option_DMB_BO_system_CRm: 646 CRm := (x >> 8) & (1<<4 - 1) 647 return Imm_option(CRm) 648 649 case arg_option_DSB_BO_system_CRm: 650 CRm := (x >> 8) & (1<<4 - 1) 651 return Imm_option(CRm) 652 653 case arg_option_ISB_BI_system_CRm: 654 CRm := (x >> 8) & (1<<4 - 1) 655 if CRm == 15 { 656 return Imm_option(CRm) 657 } 658 return Imm{CRm, false} 659 660 case arg_prfop_Rt: 661 Rt := x & (1<<5 - 1) 662 return Imm_prfop(Rt) 663 664 case arg_pstatefield_op1_op2__SPSel_05__DAIFSet_36__DAIFClr_37: 665 op1 := (x >> 16) & (1<<3 - 1) 666 op2 := (x >> 5) & (1<<3 - 1) 667 if (op1 == 0) && (op2 == 5) { 668 return SPSel 669 } else if (op1 == 3) && (op2 == 6) { 670 return DAIFSet 671 } else if (op1 == 3) && (op2 == 7) { 672 return DAIFClr 673 } 674 return nil 675 676 case arg_sysreg_o0_op1_CRn_CRm_op2: 677 op0 := (x >> 19) & (1<<2 - 1) 678 op1 := (x >> 16) & (1<<3 - 1) 679 CRn := (x >> 12) & (1<<4 - 1) 680 CRm := (x >> 8) & (1<<4 - 1) 681 op2 := (x >> 5) & (1<<3 - 1) 682 return Systemreg{uint8(op0), uint8(op1), uint8(CRn), uint8(CRm), uint8(op2)} 683 684 case arg_sysop_AT_SYS_CR_system: 685 //TODO: system instruction 686 return nil 687 688 case arg_sysop_DC_SYS_CR_system: 689 //TODO: system instruction 690 return nil 691 692 case arg_sysop_SYS_CR_system: 693 //TODO: system instruction 694 return nil 695 696 case arg_sysop_TLBI_SYS_CR_system: 697 //TODO: system instruction 698 return nil 699 700 case arg_Bt: 701 return B0 + Reg(x&(1<<5-1)) 702 703 case arg_Dt: 704 return D0 + Reg(x&(1<<5-1)) 705 706 case arg_Dt2: 707 return D0 + Reg((x>>10)&(1<<5-1)) 708 709 case arg_Ht: 710 return H0 + Reg(x&(1<<5-1)) 711 712 case arg_immediate_0_63_immh_immb__UIntimmhimmb64_8: 713 immh := (x >> 19) & (1<<4 - 1) 714 if (immh & 8) == 0 { 715 return nil 716 } 717 immb := (x >> 16) & (1<<3 - 1) 718 return Imm{(immh << 3) + immb - 64, true} 719 720 case arg_immediate_0_width_immh_immb__SEEAdvancedSIMDmodifiedimmediate_0__UIntimmhimmb8_1__UIntimmhimmb16_2__UIntimmhimmb32_4: 721 immh := (x >> 19) & (1<<4 - 1) 722 immb := (x >> 16) & (1<<3 - 1) 723 if immh == 1 { 724 return Imm{(immh << 3) + immb - 8, true} 725 } else if (immh >> 1) == 1 { 726 return Imm{(immh << 3) + immb - 16, true} 727 } else if (immh >> 2) == 1 { 728 return Imm{(immh << 3) + immb - 32, true} 729 } else { 730 return nil 731 } 732 733 case arg_immediate_0_width_immh_immb__SEEAdvancedSIMDmodifiedimmediate_0__UIntimmhimmb8_1__UIntimmhimmb16_2__UIntimmhimmb32_4__UIntimmhimmb64_8: 734 fallthrough 735 736 case arg_immediate_0_width_m1_immh_immb__UIntimmhimmb8_1__UIntimmhimmb16_2__UIntimmhimmb32_4__UIntimmhimmb64_8: 737 immh := (x >> 19) & (1<<4 - 1) 738 immb := (x >> 16) & (1<<3 - 1) 739 if immh == 1 { 740 return Imm{(immh << 3) + immb - 8, true} 741 } else if (immh >> 1) == 1 { 742 return Imm{(immh << 3) + immb - 16, true} 743 } else if (immh >> 2) == 1 { 744 return Imm{(immh << 3) + immb - 32, true} 745 } else if (immh >> 3) == 1 { 746 return Imm{(immh << 3) + immb - 64, true} 747 } else { 748 return nil 749 } 750 751 case arg_immediate_0_width_size__8_0__16_1__32_2: 752 size := (x >> 22) & (1<<2 - 1) 753 switch size { 754 case 0: 755 return Imm{8, true} 756 case 1: 757 return Imm{16, true} 758 case 2: 759 return Imm{32, true} 760 default: 761 return nil 762 } 763 764 case arg_immediate_1_64_immh_immb__128UIntimmhimmb_8: 765 immh := (x >> 19) & (1<<4 - 1) 766 if (immh & 8) == 0 { 767 return nil 768 } 769 immb := (x >> 16) & (1<<3 - 1) 770 return Imm{128 - ((immh << 3) + immb), true} 771 772 case arg_immediate_1_width_immh_immb__16UIntimmhimmb_1__32UIntimmhimmb_2__64UIntimmhimmb_4: 773 fallthrough 774 775 case arg_immediate_1_width_immh_immb__SEEAdvancedSIMDmodifiedimmediate_0__16UIntimmhimmb_1__32UIntimmhimmb_2__64UIntimmhimmb_4: 776 immh := (x >> 19) & (1<<4 - 1) 777 immb := (x >> 16) & (1<<3 - 1) 778 if immh == 1 { 779 return Imm{16 - ((immh << 3) + immb), true} 780 } else if (immh >> 1) == 1 { 781 return Imm{32 - ((immh << 3) + immb), true} 782 } else if (immh >> 2) == 1 { 783 return Imm{64 - ((immh << 3) + immb), true} 784 } else { 785 return nil 786 } 787 788 case arg_immediate_1_width_immh_immb__SEEAdvancedSIMDmodifiedimmediate_0__16UIntimmhimmb_1__32UIntimmhimmb_2__64UIntimmhimmb_4__128UIntimmhimmb_8: 789 immh := (x >> 19) & (1<<4 - 1) 790 immb := (x >> 16) & (1<<3 - 1) 791 if immh == 1 { 792 return Imm{16 - ((immh << 3) + immb), true} 793 } else if (immh >> 1) == 1 { 794 return Imm{32 - ((immh << 3) + immb), true} 795 } else if (immh >> 2) == 1 { 796 return Imm{64 - ((immh << 3) + immb), true} 797 } else if (immh >> 3) == 1 { 798 return Imm{128 - ((immh << 3) + immb), true} 799 } else { 800 return nil 801 } 802 803 case arg_immediate_8x8_a_b_c_d_e_f_g_h: 804 var imm uint64 805 if x&(1<<5) != 0 { 806 imm = (1 << 8) - 1 807 } else { 808 imm = 0 809 } 810 if x&(1<<6) != 0 { 811 imm += ((1 << 8) - 1) << 8 812 } 813 if x&(1<<7) != 0 { 814 imm += ((1 << 8) - 1) << 16 815 } 816 if x&(1<<8) != 0 { 817 imm += ((1 << 8) - 1) << 24 818 } 819 if x&(1<<9) != 0 { 820 imm += ((1 << 8) - 1) << 32 821 } 822 if x&(1<<16) != 0 { 823 imm += ((1 << 8) - 1) << 40 824 } 825 if x&(1<<17) != 0 { 826 imm += ((1 << 8) - 1) << 48 827 } 828 if x&(1<<18) != 0 { 829 imm += ((1 << 8) - 1) << 56 830 } 831 return Imm64{imm, false} 832 833 case arg_immediate_exp_3_pre_4_a_b_c_d_e_f_g_h: 834 pre := (x >> 5) & (1<<4 - 1) 835 exp := 1 - ((x >> 17) & 1) 836 exp = (exp << 2) + (((x >> 16) & 1) << 1) + ((x >> 9) & 1) 837 s := ((x >> 18) & 1) 838 return Imm_fp{uint8(s), int8(exp) - 3, uint8(pre)} 839 840 case arg_immediate_exp_3_pre_4_imm8: 841 pre := (x >> 13) & (1<<4 - 1) 842 exp := 1 - ((x >> 19) & 1) 843 exp = (exp << 2) + ((x >> 17) & (1<<2 - 1)) 844 s := ((x >> 20) & 1) 845 return Imm_fp{uint8(s), int8(exp) - 3, uint8(pre)} 846 847 case arg_immediate_fbits_min_1_max_0_sub_0_immh_immb__64UIntimmhimmb_4__128UIntimmhimmb_8: 848 fallthrough 849 850 case arg_immediate_fbits_min_1_max_0_sub_0_immh_immb__SEEAdvancedSIMDmodifiedimmediate_0__64UIntimmhimmb_4__128UIntimmhimmb_8: 851 immh := (x >> 19) & (1<<4 - 1) 852 immb := (x >> 16) & (1<<3 - 1) 853 if (immh >> 2) == 1 { 854 return Imm{64 - ((immh << 3) + immb), true} 855 } else if (immh >> 3) == 1 { 856 return Imm{128 - ((immh << 3) + immb), true} 857 } else { 858 return nil 859 } 860 861 case arg_immediate_fbits_min_1_max_32_sub_64_scale: 862 scale := (x >> 10) & (1<<6 - 1) 863 fbits := 64 - scale 864 if fbits > 32 { 865 return nil 866 } 867 return Imm{fbits, true} 868 869 case arg_immediate_fbits_min_1_max_64_sub_64_scale: 870 scale := (x >> 10) & (1<<6 - 1) 871 fbits := 64 - scale 872 return Imm{fbits, true} 873 874 case arg_immediate_floatzero: 875 return Imm{0, true} 876 877 case arg_immediate_index_Q_imm4__imm4lt20gt_00__imm4_10: 878 Q := (x >> 30) & 1 879 imm4 := (x >> 11) & (1<<4 - 1) 880 if Q == 1 || (imm4>>3) == 0 { 881 return Imm{imm4, true} 882 } else { 883 return nil 884 } 885 886 case arg_immediate_MSL__a_b_c_d_e_f_g_h_cmode__8_0__16_1: 887 var shift uint8 888 imm8 := (x >> 16) & (1<<3 - 1) 889 imm8 = (imm8 << 5) | ((x >> 5) & (1<<5 - 1)) 890 if (x>>12)&1 == 0 { 891 shift = 8 + 128 892 } else { 893 shift = 16 + 128 894 } 895 return ImmShift{uint16(imm8), shift} 896 897 case arg_immediate_OptLSL__a_b_c_d_e_f_g_h_cmode__0_0__8_1: 898 imm8 := (x >> 16) & (1<<3 - 1) 899 imm8 = (imm8 << 5) | ((x >> 5) & (1<<5 - 1)) 900 cmode1 := (x >> 13) & 1 901 shift := 8 * cmode1 902 return ImmShift{uint16(imm8), uint8(shift)} 903 904 case arg_immediate_OptLSL__a_b_c_d_e_f_g_h_cmode__0_0__8_1__16_2__24_3: 905 imm8 := (x >> 16) & (1<<3 - 1) 906 imm8 = (imm8 << 5) | ((x >> 5) & (1<<5 - 1)) 907 cmode1 := (x >> 13) & (1<<2 - 1) 908 shift := 8 * cmode1 909 return ImmShift{uint16(imm8), uint8(shift)} 910 911 case arg_immediate_OptLSLZero__a_b_c_d_e_f_g_h: 912 imm8 := (x >> 16) & (1<<3 - 1) 913 imm8 = (imm8 << 5) | ((x >> 5) & (1<<5 - 1)) 914 return ImmShift{uint16(imm8), 0} 915 916 case arg_immediate_zero: 917 return Imm{0, true} 918 919 case arg_Qd: 920 return Q0 + Reg(x&(1<<5-1)) 921 922 case arg_Qn: 923 return Q0 + Reg((x>>5)&(1<<5-1)) 924 925 case arg_Qt: 926 return Q0 + Reg(x&(1<<5-1)) 927 928 case arg_Qt2: 929 return Q0 + Reg((x>>10)&(1<<5-1)) 930 931 case arg_Rn_16_5__W_1__W_2__W_4__X_8: 932 imm5 := (x >> 16) & (1<<5 - 1) 933 if ((imm5 & 1) == 1) || ((imm5 & 2) == 2) || ((imm5 & 4) == 4) { 934 return W0 + Reg((x>>5)&(1<<5-1)) 935 } else if (imm5 & 8) == 8 { 936 return X0 + Reg((x>>5)&(1<<5-1)) 937 } else { 938 return nil 939 } 940 941 case arg_St: 942 return S0 + Reg(x&(1<<5-1)) 943 944 case arg_St2: 945 return S0 + Reg((x>>10)&(1<<5-1)) 946 947 case arg_Vd_16_5__B_1__H_2__S_4__D_8: 948 imm5 := (x >> 16) & (1<<5 - 1) 949 Rd := x & (1<<5 - 1) 950 if imm5&1 == 1 { 951 return B0 + Reg(Rd) 952 } else if imm5&2 == 2 { 953 return H0 + Reg(Rd) 954 } else if imm5&4 == 4 { 955 return S0 + Reg(Rd) 956 } else if imm5&8 == 8 { 957 return D0 + Reg(Rd) 958 } else { 959 return nil 960 } 961 962 case arg_Vd_19_4__B_1__H_2__S_4: 963 immh := (x >> 19) & (1<<4 - 1) 964 Rd := x & (1<<5 - 1) 965 if immh == 1 { 966 return B0 + Reg(Rd) 967 } else if immh>>1 == 1 { 968 return H0 + Reg(Rd) 969 } else if immh>>2 == 1 { 970 return S0 + Reg(Rd) 971 } else { 972 return nil 973 } 974 975 case arg_Vd_19_4__B_1__H_2__S_4__D_8: 976 immh := (x >> 19) & (1<<4 - 1) 977 Rd := x & (1<<5 - 1) 978 if immh == 1 { 979 return B0 + Reg(Rd) 980 } else if immh>>1 == 1 { 981 return H0 + Reg(Rd) 982 } else if immh>>2 == 1 { 983 return S0 + Reg(Rd) 984 } else if immh>>3 == 1 { 985 return D0 + Reg(Rd) 986 } else { 987 return nil 988 } 989 990 case arg_Vd_19_4__D_8: 991 immh := (x >> 19) & (1<<4 - 1) 992 Rd := x & (1<<5 - 1) 993 if immh>>3 == 1 { 994 return D0 + Reg(Rd) 995 } else { 996 return nil 997 } 998 999 case arg_Vd_19_4__S_4__D_8: 1000 immh := (x >> 19) & (1<<4 - 1) 1001 Rd := x & (1<<5 - 1) 1002 if immh>>2 == 1 { 1003 return S0 + Reg(Rd) 1004 } else if immh>>3 == 1 { 1005 return D0 + Reg(Rd) 1006 } else { 1007 return nil 1008 } 1009 1010 case arg_Vd_22_1__S_0: 1011 sz := (x >> 22) & 1 1012 Rd := x & (1<<5 - 1) 1013 if sz == 0 { 1014 return S0 + Reg(Rd) 1015 } else { 1016 return nil 1017 } 1018 1019 case arg_Vd_22_1__S_0__D_1: 1020 sz := (x >> 22) & 1 1021 Rd := x & (1<<5 - 1) 1022 if sz == 0 { 1023 return S0 + Reg(Rd) 1024 } else { 1025 return D0 + Reg(Rd) 1026 } 1027 1028 case arg_Vd_22_1__S_1: 1029 sz := (x >> 22) & 1 1030 Rd := x & (1<<5 - 1) 1031 if sz == 1 { 1032 return S0 + Reg(Rd) 1033 } else { 1034 return nil 1035 } 1036 1037 case arg_Vd_22_2__B_0__H_1__S_2: 1038 size := (x >> 22) & (1<<2 - 1) 1039 Rd := x & (1<<5 - 1) 1040 if size == 0 { 1041 return B0 + Reg(Rd) 1042 } else if size == 1 { 1043 return H0 + Reg(Rd) 1044 } else if size == 2 { 1045 return S0 + Reg(Rd) 1046 } else { 1047 return nil 1048 } 1049 1050 case arg_Vd_22_2__B_0__H_1__S_2__D_3: 1051 size := (x >> 22) & (1<<2 - 1) 1052 Rd := x & (1<<5 - 1) 1053 if size == 0 { 1054 return B0 + Reg(Rd) 1055 } else if size == 1 { 1056 return H0 + Reg(Rd) 1057 } else if size == 2 { 1058 return S0 + Reg(Rd) 1059 } else { 1060 return D0 + Reg(Rd) 1061 } 1062 1063 case arg_Vd_22_2__D_3: 1064 size := (x >> 22) & (1<<2 - 1) 1065 Rd := x & (1<<5 - 1) 1066 if size == 3 { 1067 return D0 + Reg(Rd) 1068 } else { 1069 return nil 1070 } 1071 1072 case arg_Vd_22_2__H_0__S_1__D_2: 1073 size := (x >> 22) & (1<<2 - 1) 1074 Rd := x & (1<<5 - 1) 1075 if size == 0 { 1076 return H0 + Reg(Rd) 1077 } else if size == 1 { 1078 return S0 + Reg(Rd) 1079 } else if size == 2 { 1080 return D0 + Reg(Rd) 1081 } else { 1082 return nil 1083 } 1084 1085 case arg_Vd_22_2__H_1__S_2: 1086 size := (x >> 22) & (1<<2 - 1) 1087 Rd := x & (1<<5 - 1) 1088 if size == 1 { 1089 return H0 + Reg(Rd) 1090 } else if size == 2 { 1091 return S0 + Reg(Rd) 1092 } else { 1093 return nil 1094 } 1095 1096 case arg_Vd_22_2__S_1__D_2: 1097 size := (x >> 22) & (1<<2 - 1) 1098 Rd := x & (1<<5 - 1) 1099 if size == 1 { 1100 return S0 + Reg(Rd) 1101 } else if size == 2 { 1102 return D0 + Reg(Rd) 1103 } else { 1104 return nil 1105 } 1106 1107 case arg_Vd_arrangement_16B: 1108 Rd := x & (1<<5 - 1) 1109 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement16B, 0} 1110 1111 case arg_Vd_arrangement_2D: 1112 Rd := x & (1<<5 - 1) 1113 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1114 1115 case arg_Vd_arrangement_4S: 1116 Rd := x & (1<<5 - 1) 1117 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1118 1119 case arg_Vd_arrangement_D_index__1: 1120 Rd := x & (1<<5 - 1) 1121 return RegisterWithArrangementAndIndex{V0 + Reg(Rd), ArrangementD, 1, 0} 1122 1123 case arg_Vd_arrangement_imm5___B_1__H_2__S_4__D_8_index__imm5__imm5lt41gt_1__imm5lt42gt_2__imm5lt43gt_4__imm5lt4gt_8_1: 1124 var a Arrangement 1125 var index uint32 1126 Rd := x & (1<<5 - 1) 1127 imm5 := (x >> 16) & (1<<5 - 1) 1128 if imm5&1 == 1 { 1129 a = ArrangementB 1130 index = imm5 >> 1 1131 } else if imm5&2 == 2 { 1132 a = ArrangementH 1133 index = imm5 >> 2 1134 } else if imm5&4 == 4 { 1135 a = ArrangementS 1136 index = imm5 >> 3 1137 } else if imm5&8 == 8 { 1138 a = ArrangementD 1139 index = imm5 >> 4 1140 } else { 1141 return nil 1142 } 1143 return RegisterWithArrangementAndIndex{V0 + Reg(Rd), a, uint8(index), 0} 1144 1145 case arg_Vd_arrangement_imm5_Q___8B_10__16B_11__4H_20__8H_21__2S_40__4S_41__2D_81: 1146 Rd := x & (1<<5 - 1) 1147 imm5 := (x >> 16) & (1<<5 - 1) 1148 Q := (x >> 30) & 1 1149 if imm5&1 == 1 { 1150 if Q == 0 { 1151 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8B, 0} 1152 } else { 1153 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement16B, 0} 1154 } 1155 } else if imm5&2 == 2 { 1156 if Q == 0 { 1157 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4H, 0} 1158 } else { 1159 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1160 } 1161 } else if imm5&4 == 4 { 1162 if Q == 0 { 1163 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1164 } else { 1165 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1166 } 1167 } else if (imm5&8 == 8) && (Q == 1) { 1168 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1169 } else { 1170 return nil 1171 } 1172 1173 case arg_Vd_arrangement_immh_Q___SEEAdvancedSIMDmodifiedimmediate_00__2S_40__4S_41__2D_81: 1174 Rd := x & (1<<5 - 1) 1175 immh := (x >> 19) & (1<<4 - 1) 1176 Q := (x >> 30) & 1 1177 if immh>>2 == 1 { 1178 if Q == 0 { 1179 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1180 } else { 1181 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1182 } 1183 } else if immh>>3 == 1 { 1184 if Q == 1 { 1185 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1186 } 1187 } 1188 return nil 1189 1190 case arg_Vd_arrangement_immh_Q___SEEAdvancedSIMDmodifiedimmediate_00__8B_10__16B_11__4H_20__8H_21__2S_40__4S_41: 1191 Rd := x & (1<<5 - 1) 1192 immh := (x >> 19) & (1<<4 - 1) 1193 Q := (x >> 30) & 1 1194 if immh == 1 { 1195 if Q == 0 { 1196 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8B, 0} 1197 } else { 1198 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement16B, 0} 1199 } 1200 } else if immh>>1 == 1 { 1201 if Q == 0 { 1202 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4H, 0} 1203 } else { 1204 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1205 } 1206 } else if immh>>2 == 1 { 1207 if Q == 0 { 1208 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1209 } else { 1210 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1211 } 1212 } 1213 return nil 1214 1215 case arg_Vd_arrangement_immh_Q___SEEAdvancedSIMDmodifiedimmediate_00__8B_10__16B_11__4H_20__8H_21__2S_40__4S_41__2D_81: 1216 Rd := x & (1<<5 - 1) 1217 immh := (x >> 19) & (1<<4 - 1) 1218 Q := (x >> 30) & 1 1219 if immh == 1 { 1220 if Q == 0 { 1221 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8B, 0} 1222 } else { 1223 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement16B, 0} 1224 } 1225 } else if immh>>1 == 1 { 1226 if Q == 0 { 1227 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4H, 0} 1228 } else { 1229 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1230 } 1231 } else if immh>>2 == 1 { 1232 if Q == 0 { 1233 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1234 } else { 1235 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1236 } 1237 } else if immh>>3 == 1 { 1238 if Q == 1 { 1239 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1240 } 1241 } 1242 return nil 1243 1244 case arg_Vd_arrangement_immh___SEEAdvancedSIMDmodifiedimmediate_0__8H_1__4S_2__2D_4: 1245 Rd := x & (1<<5 - 1) 1246 immh := (x >> 19) & (1<<4 - 1) 1247 if immh == 1 { 1248 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1249 } else if immh>>1 == 1 { 1250 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1251 } else if immh>>2 == 1 { 1252 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1253 } 1254 return nil 1255 1256 case arg_Vd_arrangement_Q___2S_0__4S_1: 1257 Rd := x & (1<<5 - 1) 1258 Q := (x >> 30) & 1 1259 if Q == 0 { 1260 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1261 } else { 1262 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1263 } 1264 1265 case arg_Vd_arrangement_Q___4H_0__8H_1: 1266 Rd := x & (1<<5 - 1) 1267 Q := (x >> 30) & 1 1268 if Q == 0 { 1269 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4H, 0} 1270 } else { 1271 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1272 } 1273 1274 case arg_Vd_arrangement_Q___8B_0__16B_1: 1275 Rd := x & (1<<5 - 1) 1276 Q := (x >> 30) & 1 1277 if Q == 0 { 1278 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8B, 0} 1279 } else { 1280 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement16B, 0} 1281 } 1282 1283 case arg_Vd_arrangement_Q_sz___2S_00__4S_10__2D_11: 1284 Rd := x & (1<<5 - 1) 1285 Q := (x >> 30) & 1 1286 sz := (x >> 22) & 1 1287 if sz == 0 && Q == 0 { 1288 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1289 } else if sz == 0 && Q == 1 { 1290 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1291 } else if sz == 1 && Q == 1 { 1292 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1293 } 1294 return nil 1295 1296 case arg_Vd_arrangement_size___4S_1__2D_2: 1297 Rd := x & (1<<5 - 1) 1298 size := (x >> 22) & 3 1299 if size == 1 { 1300 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1301 } else if size == 2 { 1302 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1303 } 1304 return nil 1305 1306 case arg_Vd_arrangement_size___8H_0__1Q_3: 1307 Rd := x & (1<<5 - 1) 1308 size := (x >> 22) & 3 1309 if size == 0 { 1310 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1311 } else if size == 3 { 1312 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement1Q, 0} 1313 } 1314 return nil 1315 1316 case arg_Vd_arrangement_size___8H_0__4S_1__2D_2: 1317 Rd := x & (1<<5 - 1) 1318 size := (x >> 22) & 3 1319 if size == 0 { 1320 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1321 } else if size == 1 { 1322 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1323 } else if size == 2 { 1324 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1325 } 1326 return nil 1327 1328 case arg_Vd_arrangement_size_Q___4H_00__8H_01__2S_10__4S_11__1D_20__2D_21: 1329 Rd := x & (1<<5 - 1) 1330 size := (x >> 22) & 3 1331 Q := (x >> 30) & 1 1332 if size == 0 && Q == 0 { 1333 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4H, 0} 1334 } else if size == 0 && Q == 1 { 1335 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1336 } else if size == 1 && Q == 0 { 1337 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1338 } else if size == 1 && Q == 1 { 1339 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1340 } else if size == 2 && Q == 0 { 1341 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement1D, 0} 1342 } else if size == 2 && Q == 1 { 1343 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1344 } 1345 return nil 1346 1347 case arg_Vd_arrangement_size_Q___4H_10__8H_11__2S_20__4S_21: 1348 Rd := x & (1<<5 - 1) 1349 size := (x >> 22) & 3 1350 Q := (x >> 30) & 1 1351 if size == 1 && Q == 0 { 1352 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4H, 0} 1353 } else if size == 1 && Q == 1 { 1354 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1355 } else if size == 2 && Q == 0 { 1356 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1357 } else if size == 2 && Q == 1 { 1358 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1359 } 1360 return nil 1361 1362 case arg_Vd_arrangement_size_Q___8B_00__16B_01: 1363 Rd := x & (1<<5 - 1) 1364 size := (x >> 22) & 3 1365 Q := (x >> 30) & 1 1366 if size == 0 && Q == 0 { 1367 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8B, 0} 1368 } else if size == 0 && Q == 1 { 1369 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement16B, 0} 1370 } 1371 return nil 1372 1373 case arg_Vd_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11: 1374 Rd := x & (1<<5 - 1) 1375 size := (x >> 22) & 3 1376 Q := (x >> 30) & 1 1377 if size == 0 && Q == 0 { 1378 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8B, 0} 1379 } else if size == 0 && Q == 1 { 1380 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement16B, 0} 1381 } else if size == 1 && Q == 0 { 1382 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4H, 0} 1383 } else if size == 1 && Q == 1 { 1384 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1385 } 1386 return nil 1387 1388 case arg_Vd_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21: 1389 Rd := x & (1<<5 - 1) 1390 size := (x >> 22) & 3 1391 Q := (x >> 30) & 1 1392 if size == 0 && Q == 0 { 1393 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8B, 0} 1394 } else if size == 0 && Q == 1 { 1395 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement16B, 0} 1396 } else if size == 1 && Q == 0 { 1397 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4H, 0} 1398 } else if size == 1 && Q == 1 { 1399 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1400 } else if size == 2 && Q == 0 { 1401 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1402 } else if size == 2 && Q == 1 { 1403 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1404 } 1405 return nil 1406 1407 case arg_Vd_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21__2D_31: 1408 Rd := x & (1<<5 - 1) 1409 size := (x >> 22) & 3 1410 Q := (x >> 30) & 1 1411 if size == 0 && Q == 0 { 1412 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8B, 0} 1413 } else if size == 0 && Q == 1 { 1414 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement16B, 0} 1415 } else if size == 1 && Q == 0 { 1416 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4H, 0} 1417 } else if size == 1 && Q == 1 { 1418 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1419 } else if size == 2 && Q == 0 { 1420 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1421 } else if size == 2 && Q == 1 { 1422 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1423 } else if size == 3 && Q == 1 { 1424 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1425 } 1426 return nil 1427 1428 case arg_Vd_arrangement_sz___4S_0__2D_1: 1429 Rd := x & (1<<5 - 1) 1430 sz := (x >> 22) & 1 1431 if sz == 0 { 1432 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1433 } else { 1434 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1435 } 1436 1437 case arg_Vd_arrangement_sz_Q___2S_00__4S_01: 1438 Rd := x & (1<<5 - 1) 1439 sz := (x >> 22) & 1 1440 Q := (x >> 30) & 1 1441 if sz == 0 && Q == 0 { 1442 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1443 } else if sz == 0 && Q == 1 { 1444 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1445 } 1446 return nil 1447 1448 case arg_Vd_arrangement_sz_Q___2S_00__4S_01__2D_11: 1449 Rd := x & (1<<5 - 1) 1450 sz := (x >> 22) & 1 1451 Q := (x >> 30) & 1 1452 if sz == 0 && Q == 0 { 1453 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1454 } else if sz == 0 && Q == 1 { 1455 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1456 } else if sz == 1 && Q == 1 { 1457 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2D, 0} 1458 } 1459 return nil 1460 1461 case arg_Vd_arrangement_sz_Q___2S_10__4S_11: 1462 Rd := x & (1<<5 - 1) 1463 sz := (x >> 22) & 1 1464 Q := (x >> 30) & 1 1465 if sz == 1 && Q == 0 { 1466 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1467 } else if sz == 1 && Q == 1 { 1468 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1469 } 1470 return nil 1471 1472 case arg_Vd_arrangement_sz_Q___4H_00__8H_01__2S_10__4S_11: 1473 Rd := x & (1<<5 - 1) 1474 sz := (x >> 22) & 1 1475 Q := (x >> 30) & 1 1476 if sz == 0 && Q == 0 { 1477 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4H, 0} 1478 } else if sz == 0 && Q == 1 { 1479 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement8H, 0} 1480 } else if sz == 1 && Q == 0 { 1481 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement2S, 0} 1482 } else /* sz == 1 && Q == 1 */ { 1483 return RegisterWithArrangement{V0 + Reg(Rd), Arrangement4S, 0} 1484 } 1485 1486 case arg_Vm_22_1__S_0__D_1: 1487 sz := (x >> 22) & 1 1488 Rm := (x >> 16) & (1<<5 - 1) 1489 if sz == 0 { 1490 return S0 + Reg(Rm) 1491 } else { 1492 return D0 + Reg(Rm) 1493 } 1494 1495 case arg_Vm_22_2__B_0__H_1__S_2__D_3: 1496 size := (x >> 22) & (1<<2 - 1) 1497 Rm := (x >> 16) & (1<<5 - 1) 1498 if size == 0 { 1499 return B0 + Reg(Rm) 1500 } else if size == 1 { 1501 return H0 + Reg(Rm) 1502 } else if size == 2 { 1503 return S0 + Reg(Rm) 1504 } else { 1505 return D0 + Reg(Rm) 1506 } 1507 1508 case arg_Vm_22_2__D_3: 1509 size := (x >> 22) & (1<<2 - 1) 1510 Rm := (x >> 16) & (1<<5 - 1) 1511 if size == 3 { 1512 return D0 + Reg(Rm) 1513 } else { 1514 return nil 1515 } 1516 1517 case arg_Vm_22_2__H_1__S_2: 1518 size := (x >> 22) & (1<<2 - 1) 1519 Rm := (x >> 16) & (1<<5 - 1) 1520 if size == 1 { 1521 return H0 + Reg(Rm) 1522 } else if size == 2 { 1523 return S0 + Reg(Rm) 1524 } else { 1525 return nil 1526 } 1527 1528 case arg_Vm_arrangement_4S: 1529 Rm := (x >> 16) & (1<<5 - 1) 1530 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement4S, 0} 1531 1532 case arg_Vm_arrangement_Q___8B_0__16B_1: 1533 Rm := (x >> 16) & (1<<5 - 1) 1534 Q := (x >> 30) & 1 1535 if Q == 0 { 1536 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement8B, 0} 1537 } else { 1538 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement16B, 0} 1539 } 1540 1541 case arg_Vm_arrangement_size___8H_0__4S_1__2D_2: 1542 Rm := (x >> 16) & (1<<5 - 1) 1543 size := (x >> 22) & 3 1544 if size == 0 { 1545 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement8H, 0} 1546 } else if size == 1 { 1547 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement4S, 0} 1548 } else if size == 2 { 1549 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement2D, 0} 1550 } 1551 return nil 1552 1553 case arg_Vm_arrangement_size___H_1__S_2_index__size_L_H_M__HLM_1__HL_2_1: 1554 var a Arrangement 1555 var index uint32 1556 var vm uint32 1557 Rm := (x >> 16) & (1<<4 - 1) 1558 size := (x >> 22) & 3 1559 H := (x >> 11) & 1 1560 L := (x >> 21) & 1 1561 M := (x >> 20) & 1 1562 if size == 1 { 1563 a = ArrangementH 1564 index = (H << 2) | (L << 1) | M 1565 vm = Rm 1566 } else if size == 2 { 1567 a = ArrangementS 1568 index = (H << 1) | L 1569 vm = (M << 4) | Rm 1570 } else { 1571 return nil 1572 } 1573 return RegisterWithArrangementAndIndex{V0 + Reg(vm), a, uint8(index), 0} 1574 1575 case arg_Vm_arrangement_size_Q___4H_10__8H_11__2S_20__4S_21: 1576 Rm := (x >> 16) & (1<<5 - 1) 1577 size := (x >> 22) & 3 1578 Q := (x >> 30) & 1 1579 if size == 1 && Q == 0 { 1580 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement4H, 0} 1581 } else if size == 1 && Q == 1 { 1582 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement8H, 0} 1583 } else if size == 2 && Q == 0 { 1584 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement2S, 0} 1585 } else if size == 2 && Q == 1 { 1586 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement4S, 0} 1587 } 1588 return nil 1589 1590 case arg_Vm_arrangement_size_Q___8B_00__16B_01: 1591 Rm := (x >> 16) & (1<<5 - 1) 1592 size := (x >> 22) & 3 1593 Q := (x >> 30) & 1 1594 if size == 0 && Q == 0 { 1595 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement8B, 0} 1596 } else if size == 0 && Q == 1 { 1597 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement16B, 0} 1598 } 1599 return nil 1600 1601 case arg_Vm_arrangement_size_Q___8B_00__16B_01__1D_30__2D_31: 1602 Rm := (x >> 16) & (1<<5 - 1) 1603 size := (x >> 22) & 3 1604 Q := (x >> 30) & 1 1605 if size == 0 && Q == 0 { 1606 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement8B, 0} 1607 } else if size == 0 && Q == 1 { 1608 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement16B, 0} 1609 } else if size == 3 && Q == 0 { 1610 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement1D, 0} 1611 } else if size == 3 && Q == 1 { 1612 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement2D, 0} 1613 } 1614 return nil 1615 1616 case arg_Vm_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21: 1617 Rm := (x >> 16) & (1<<5 - 1) 1618 size := (x >> 22) & 3 1619 Q := (x >> 30) & 1 1620 if size == 0 && Q == 0 { 1621 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement8B, 0} 1622 } else if size == 0 && Q == 1 { 1623 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement16B, 0} 1624 } else if size == 1 && Q == 0 { 1625 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement4H, 0} 1626 } else if size == 1 && Q == 1 { 1627 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement8H, 0} 1628 } else if size == 2 && Q == 0 { 1629 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement2S, 0} 1630 } else if size == 2 && Q == 1 { 1631 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement4S, 0} 1632 } 1633 return nil 1634 1635 case arg_Vm_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21__2D_31: 1636 Rm := (x >> 16) & (1<<5 - 1) 1637 size := (x >> 22) & 3 1638 Q := (x >> 30) & 1 1639 if size == 0 && Q == 0 { 1640 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement8B, 0} 1641 } else if size == 0 && Q == 1 { 1642 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement16B, 0} 1643 } else if size == 1 && Q == 0 { 1644 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement4H, 0} 1645 } else if size == 1 && Q == 1 { 1646 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement8H, 0} 1647 } else if size == 2 && Q == 0 { 1648 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement2S, 0} 1649 } else if size == 2 && Q == 1 { 1650 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement4S, 0} 1651 } else if size == 3 && Q == 1 { 1652 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement2D, 0} 1653 } 1654 return nil 1655 1656 case arg_Vm_arrangement_sz_Q___2S_00__4S_01__2D_11: 1657 Rm := (x >> 16) & (1<<5 - 1) 1658 sz := (x >> 22) & 1 1659 Q := (x >> 30) & 1 1660 if sz == 0 && Q == 0 { 1661 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement2S, 0} 1662 } else if sz == 0 && Q == 1 { 1663 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement4S, 0} 1664 } else if sz == 1 && Q == 1 { 1665 return RegisterWithArrangement{V0 + Reg(Rm), Arrangement2D, 0} 1666 } 1667 return nil 1668 1669 case arg_Vm_arrangement_sz___S_0__D_1_index__sz_L_H__HL_00__H_10_1: 1670 var a Arrangement 1671 var index uint32 1672 Rm := (x >> 16) & (1<<5 - 1) 1673 sz := (x >> 22) & 1 1674 H := (x >> 11) & 1 1675 L := (x >> 21) & 1 1676 if sz == 0 { 1677 a = ArrangementS 1678 index = (H << 1) | L 1679 } else if sz == 1 && L == 0 { 1680 a = ArrangementD 1681 index = H 1682 } else { 1683 return nil 1684 } 1685 return RegisterWithArrangementAndIndex{V0 + Reg(Rm), a, uint8(index), 0} 1686 1687 case arg_Vn_19_4__B_1__H_2__S_4__D_8: 1688 immh := (x >> 19) & (1<<4 - 1) 1689 Rn := (x >> 5) & (1<<5 - 1) 1690 if immh == 1 { 1691 return B0 + Reg(Rn) 1692 } else if immh>>1 == 1 { 1693 return H0 + Reg(Rn) 1694 } else if immh>>2 == 1 { 1695 return S0 + Reg(Rn) 1696 } else if immh>>3 == 1 { 1697 return D0 + Reg(Rn) 1698 } else { 1699 return nil 1700 } 1701 1702 case arg_Vn_19_4__D_8: 1703 immh := (x >> 19) & (1<<4 - 1) 1704 Rn := (x >> 5) & (1<<5 - 1) 1705 if immh>>3 == 1 { 1706 return D0 + Reg(Rn) 1707 } else { 1708 return nil 1709 } 1710 1711 case arg_Vn_19_4__H_1__S_2__D_4: 1712 immh := (x >> 19) & (1<<4 - 1) 1713 Rn := (x >> 5) & (1<<5 - 1) 1714 if immh == 1 { 1715 return H0 + Reg(Rn) 1716 } else if immh>>1 == 1 { 1717 return S0 + Reg(Rn) 1718 } else if immh>>2 == 1 { 1719 return D0 + Reg(Rn) 1720 } else { 1721 return nil 1722 } 1723 1724 case arg_Vn_19_4__S_4__D_8: 1725 immh := (x >> 19) & (1<<4 - 1) 1726 Rn := (x >> 5) & (1<<5 - 1) 1727 if immh>>2 == 1 { 1728 return S0 + Reg(Rn) 1729 } else if immh>>3 == 1 { 1730 return D0 + Reg(Rn) 1731 } else { 1732 return nil 1733 } 1734 1735 case arg_Vn_1_arrangement_16B: 1736 Rn := (x >> 5) & (1<<5 - 1) 1737 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 1} 1738 1739 case arg_Vn_22_1__D_1: 1740 sz := (x >> 22) & 1 1741 Rn := (x >> 5) & (1<<5 - 1) 1742 if sz == 1 { 1743 return D0 + Reg(Rn) 1744 } 1745 return nil 1746 1747 case arg_Vn_22_1__S_0__D_1: 1748 sz := (x >> 22) & 1 1749 Rn := (x >> 5) & (1<<5 - 1) 1750 if sz == 0 { 1751 return S0 + Reg(Rn) 1752 } else { 1753 return D0 + Reg(Rn) 1754 } 1755 1756 case arg_Vn_22_2__B_0__H_1__S_2__D_3: 1757 size := (x >> 22) & (1<<2 - 1) 1758 Rn := (x >> 5) & (1<<5 - 1) 1759 if size == 0 { 1760 return B0 + Reg(Rn) 1761 } else if size == 1 { 1762 return H0 + Reg(Rn) 1763 } else if size == 2 { 1764 return S0 + Reg(Rn) 1765 } else { 1766 return D0 + Reg(Rn) 1767 } 1768 1769 case arg_Vn_22_2__D_3: 1770 size := (x >> 22) & (1<<2 - 1) 1771 Rn := (x >> 5) & (1<<5 - 1) 1772 if size == 3 { 1773 return D0 + Reg(Rn) 1774 } else { 1775 return nil 1776 } 1777 1778 case arg_Vn_22_2__H_0__S_1__D_2: 1779 size := (x >> 22) & (1<<2 - 1) 1780 Rn := (x >> 5) & (1<<5 - 1) 1781 if size == 0 { 1782 return H0 + Reg(Rn) 1783 } else if size == 1 { 1784 return S0 + Reg(Rn) 1785 } else if size == 2 { 1786 return D0 + Reg(Rn) 1787 } else { 1788 return nil 1789 } 1790 1791 case arg_Vn_22_2__H_1__S_2: 1792 size := (x >> 22) & (1<<2 - 1) 1793 Rn := (x >> 5) & (1<<5 - 1) 1794 if size == 1 { 1795 return H0 + Reg(Rn) 1796 } else if size == 2 { 1797 return S0 + Reg(Rn) 1798 } else { 1799 return nil 1800 } 1801 1802 case arg_Vn_2_arrangement_16B: 1803 Rn := (x >> 5) & (1<<5 - 1) 1804 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 2} 1805 1806 case arg_Vn_3_arrangement_16B: 1807 Rn := (x >> 5) & (1<<5 - 1) 1808 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 3} 1809 1810 case arg_Vn_4_arrangement_16B: 1811 Rn := (x >> 5) & (1<<5 - 1) 1812 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 4} 1813 1814 case arg_Vn_arrangement_16B: 1815 Rn := (x >> 5) & (1<<5 - 1) 1816 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 0} 1817 1818 case arg_Vn_arrangement_4S: 1819 Rn := (x >> 5) & (1<<5 - 1) 1820 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 1821 1822 case arg_Vn_arrangement_D_index__1: 1823 Rn := (x >> 5) & (1<<5 - 1) 1824 return RegisterWithArrangementAndIndex{V0 + Reg(Rn), ArrangementD, 1, 0} 1825 1826 case arg_Vn_arrangement_D_index__imm5_1: 1827 Rn := (x >> 5) & (1<<5 - 1) 1828 index := (x >> 20) & 1 1829 return RegisterWithArrangementAndIndex{V0 + Reg(Rn), ArrangementD, uint8(index), 0} 1830 1831 case arg_Vn_arrangement_imm5___B_1__H_2_index__imm5__imm5lt41gt_1__imm5lt42gt_2_1: 1832 var a Arrangement 1833 var index uint32 1834 Rn := (x >> 5) & (1<<5 - 1) 1835 imm5 := (x >> 16) & (1<<5 - 1) 1836 if imm5&1 == 1 { 1837 a = ArrangementB 1838 index = imm5 >> 1 1839 } else if imm5&2 == 2 { 1840 a = ArrangementH 1841 index = imm5 >> 2 1842 } else { 1843 return nil 1844 } 1845 return RegisterWithArrangementAndIndex{V0 + Reg(Rn), a, uint8(index), 0} 1846 1847 case arg_Vn_arrangement_imm5___B_1__H_2__S_4__D_8_index__imm5_imm4__imm4lt30gt_1__imm4lt31gt_2__imm4lt32gt_4__imm4lt3gt_8_1: 1848 var a Arrangement 1849 var index uint32 1850 Rn := (x >> 5) & (1<<5 - 1) 1851 imm5 := (x >> 16) & (1<<5 - 1) 1852 imm4 := (x >> 11) & (1<<4 - 1) 1853 if imm5&1 == 1 { 1854 a = ArrangementB 1855 index = imm4 1856 } else if imm5&2 == 2 { 1857 a = ArrangementH 1858 index = imm4 >> 1 1859 } else if imm5&4 == 4 { 1860 a = ArrangementS 1861 index = imm4 >> 2 1862 } else if imm5&8 == 8 { 1863 a = ArrangementD 1864 index = imm4 >> 3 1865 } else { 1866 return nil 1867 } 1868 return RegisterWithArrangementAndIndex{V0 + Reg(Rn), a, uint8(index), 0} 1869 1870 case arg_Vn_arrangement_imm5___B_1__H_2__S_4__D_8_index__imm5__imm5lt41gt_1__imm5lt42gt_2__imm5lt43gt_4__imm5lt4gt_8_1: 1871 var a Arrangement 1872 var index uint32 1873 Rn := (x >> 5) & (1<<5 - 1) 1874 imm5 := (x >> 16) & (1<<5 - 1) 1875 if imm5&1 == 1 { 1876 a = ArrangementB 1877 index = imm5 >> 1 1878 } else if imm5&2 == 2 { 1879 a = ArrangementH 1880 index = imm5 >> 2 1881 } else if imm5&4 == 4 { 1882 a = ArrangementS 1883 index = imm5 >> 3 1884 } else if imm5&8 == 8 { 1885 a = ArrangementD 1886 index = imm5 >> 4 1887 } else { 1888 return nil 1889 } 1890 return RegisterWithArrangementAndIndex{V0 + Reg(Rn), a, uint8(index), 0} 1891 1892 case arg_Vn_arrangement_imm5___B_1__H_2__S_4_index__imm5__imm5lt41gt_1__imm5lt42gt_2__imm5lt43gt_4_1: 1893 var a Arrangement 1894 var index uint32 1895 Rn := (x >> 5) & (1<<5 - 1) 1896 imm5 := (x >> 16) & (1<<5 - 1) 1897 if imm5&1 == 1 { 1898 a = ArrangementB 1899 index = imm5 >> 1 1900 } else if imm5&2 == 2 { 1901 a = ArrangementH 1902 index = imm5 >> 2 1903 } else if imm5&4 == 4 { 1904 a = ArrangementS 1905 index = imm5 >> 3 1906 } else { 1907 return nil 1908 } 1909 return RegisterWithArrangementAndIndex{V0 + Reg(Rn), a, uint8(index), 0} 1910 1911 case arg_Vn_arrangement_imm5___D_8_index__imm5_1: 1912 var a Arrangement 1913 var index uint32 1914 Rn := (x >> 5) & (1<<5 - 1) 1915 imm5 := (x >> 16) & (1<<5 - 1) 1916 if imm5&15 == 8 { 1917 a = ArrangementD 1918 index = imm5 >> 4 1919 } else { 1920 return nil 1921 } 1922 return RegisterWithArrangementAndIndex{V0 + Reg(Rn), a, uint8(index), 0} 1923 1924 case arg_Vn_arrangement_immh_Q___SEEAdvancedSIMDmodifiedimmediate_00__2S_40__4S_41__2D_81: 1925 Rn := (x >> 5) & (1<<5 - 1) 1926 immh := (x >> 19) & (1<<4 - 1) 1927 Q := (x >> 30) & 1 1928 if immh>>2 == 1 { 1929 if Q == 0 { 1930 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 1931 } else { 1932 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 1933 } 1934 } else if immh>>3 == 1 { 1935 if Q == 1 { 1936 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 1937 } 1938 } 1939 return nil 1940 1941 case arg_Vn_arrangement_immh_Q___SEEAdvancedSIMDmodifiedimmediate_00__8B_10__16B_11__4H_20__8H_21__2S_40__4S_41: 1942 Rn := (x >> 5) & (1<<5 - 1) 1943 immh := (x >> 19) & (1<<4 - 1) 1944 Q := (x >> 30) & 1 1945 if immh == 1 { 1946 if Q == 0 { 1947 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8B, 0} 1948 } else { 1949 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 0} 1950 } 1951 } else if immh>>1 == 1 { 1952 if Q == 0 { 1953 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4H, 0} 1954 } else { 1955 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8H, 0} 1956 } 1957 } else if immh>>2 == 1 { 1958 if Q == 0 { 1959 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 1960 } else { 1961 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 1962 } 1963 } 1964 return nil 1965 1966 case arg_Vn_arrangement_immh_Q___SEEAdvancedSIMDmodifiedimmediate_00__8B_10__16B_11__4H_20__8H_21__2S_40__4S_41__2D_81: 1967 Rn := (x >> 5) & (1<<5 - 1) 1968 immh := (x >> 19) & (1<<4 - 1) 1969 Q := (x >> 30) & 1 1970 if immh == 1 { 1971 if Q == 0 { 1972 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8B, 0} 1973 } else { 1974 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 0} 1975 } 1976 } else if immh>>1 == 1 { 1977 if Q == 0 { 1978 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4H, 0} 1979 } else { 1980 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8H, 0} 1981 } 1982 } else if immh>>2 == 1 { 1983 if Q == 0 { 1984 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 1985 } else { 1986 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 1987 } 1988 } else if immh>>3 == 1 { 1989 if Q == 1 { 1990 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 1991 } 1992 } 1993 return nil 1994 1995 case arg_Vn_arrangement_immh___SEEAdvancedSIMDmodifiedimmediate_0__8H_1__4S_2__2D_4: 1996 Rn := (x >> 5) & (1<<5 - 1) 1997 immh := (x >> 19) & (1<<4 - 1) 1998 if immh == 1 { 1999 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8H, 0} 2000 } else if immh>>1 == 1 { 2001 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2002 } else if immh>>2 == 1 { 2003 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 2004 } 2005 return nil 2006 2007 case arg_Vn_arrangement_Q___8B_0__16B_1: 2008 Rn := (x >> 5) & (1<<5 - 1) 2009 Q := (x >> 30) & 1 2010 if Q == 0 { 2011 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8B, 0} 2012 } else { 2013 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 0} 2014 } 2015 2016 case arg_Vn_arrangement_Q_sz___2S_00__4S_10__2D_11: 2017 Rn := (x >> 5) & (1<<5 - 1) 2018 Q := (x >> 30) & 1 2019 sz := (x >> 22) & 1 2020 if sz == 0 && Q == 0 { 2021 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 2022 } else if sz == 0 && Q == 1 { 2023 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2024 } else if sz == 1 && Q == 1 { 2025 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 2026 } 2027 return nil 2028 2029 case arg_Vn_arrangement_Q_sz___4S_10: 2030 Rn := (x >> 5) & (1<<5 - 1) 2031 Q := (x >> 30) & 1 2032 sz := (x >> 22) & 1 2033 if sz == 0 && Q == 1 { 2034 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2035 } 2036 return nil 2037 2038 case arg_Vn_arrangement_S_index__imm5__imm5lt41gt_1__imm5lt42gt_2__imm5lt43gt_4_1: 2039 var index uint32 2040 Rn := (x >> 5) & (1<<5 - 1) 2041 imm5 := (x >> 16) & (1<<5 - 1) 2042 index = imm5 >> 3 2043 return RegisterWithArrangementAndIndex{V0 + Reg(Rn), ArrangementS, uint8(index), 0} 2044 2045 case arg_Vn_arrangement_size___2D_3: 2046 Rn := (x >> 5) & (1<<5 - 1) 2047 size := (x >> 22) & 3 2048 if size == 3 { 2049 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 2050 } 2051 return nil 2052 2053 case arg_Vn_arrangement_size___8H_0__4S_1__2D_2: 2054 Rn := (x >> 5) & (1<<5 - 1) 2055 size := (x >> 22) & 3 2056 if size == 0 { 2057 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8H, 0} 2058 } else if size == 1 { 2059 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2060 } else if size == 2 { 2061 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 2062 } 2063 return nil 2064 2065 case arg_Vn_arrangement_size_Q___4H_10__8H_11__2S_20__4S_21: 2066 Rn := (x >> 5) & (1<<5 - 1) 2067 size := (x >> 22) & 3 2068 Q := (x >> 30) & 1 2069 if size == 1 && Q == 0 { 2070 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4H, 0} 2071 } else if size == 1 && Q == 1 { 2072 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8H, 0} 2073 } else if size == 2 && Q == 0 { 2074 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 2075 } else if size == 2 && Q == 1 { 2076 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2077 } 2078 return nil 2079 2080 case arg_Vn_arrangement_size_Q___8B_00__16B_01: 2081 Rn := (x >> 5) & (1<<5 - 1) 2082 size := (x >> 22) & 3 2083 Q := (x >> 30) & 1 2084 if size == 0 && Q == 0 { 2085 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8B, 0} 2086 } else if size == 0 && Q == 1 { 2087 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 0} 2088 } 2089 return nil 2090 2091 case arg_Vn_arrangement_size_Q___8B_00__16B_01__1D_30__2D_31: 2092 Rn := (x >> 5) & (1<<5 - 1) 2093 size := (x >> 22) & 3 2094 Q := (x >> 30) & 1 2095 if size == 0 && Q == 0 { 2096 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8B, 0} 2097 } else if size == 0 && Q == 1 { 2098 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 0} 2099 } else if size == 3 && Q == 0 { 2100 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement1D, 0} 2101 } else if size == 3 && Q == 1 { 2102 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 2103 } 2104 return nil 2105 2106 case arg_Vn_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11: 2107 Rn := (x >> 5) & (1<<5 - 1) 2108 size := (x >> 22) & 3 2109 Q := (x >> 30) & 1 2110 if size == 0 && Q == 0 { 2111 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8B, 0} 2112 } else if size == 0 && Q == 1 { 2113 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 0} 2114 } else if size == 1 && Q == 0 { 2115 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4H, 0} 2116 } else if size == 1 && Q == 1 { 2117 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8H, 0} 2118 } 2119 return nil 2120 2121 case arg_Vn_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21: 2122 Rn := (x >> 5) & (1<<5 - 1) 2123 size := (x >> 22) & 3 2124 Q := (x >> 30) & 1 2125 if size == 0 && Q == 0 { 2126 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8B, 0} 2127 } else if size == 0 && Q == 1 { 2128 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 0} 2129 } else if size == 1 && Q == 0 { 2130 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4H, 0} 2131 } else if size == 1 && Q == 1 { 2132 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8H, 0} 2133 } else if size == 2 && Q == 0 { 2134 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 2135 } else if size == 2 && Q == 1 { 2136 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2137 } 2138 return nil 2139 2140 case arg_Vn_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21__2D_31: 2141 Rn := (x >> 5) & (1<<5 - 1) 2142 size := (x >> 22) & 3 2143 Q := (x >> 30) & 1 2144 if size == 0 && Q == 0 { 2145 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8B, 0} 2146 } else if size == 0 && Q == 1 { 2147 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 0} 2148 } else if size == 1 && Q == 0 { 2149 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4H, 0} 2150 } else if size == 1 && Q == 1 { 2151 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8H, 0} 2152 } else if size == 2 && Q == 0 { 2153 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 2154 } else if size == 2 && Q == 1 { 2155 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2156 } else if size == 3 && Q == 1 { 2157 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 2158 } 2159 return nil 2160 2161 case arg_Vn_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__4S_21: 2162 Rn := (x >> 5) & (1<<5 - 1) 2163 size := (x >> 22) & 3 2164 Q := (x >> 30) & 1 2165 if size == 0 && Q == 0 { 2166 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8B, 0} 2167 } else if size == 0 && Q == 1 { 2168 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement16B, 0} 2169 } else if size == 1 && Q == 0 { 2170 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4H, 0} 2171 } else if size == 1 && Q == 1 { 2172 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8H, 0} 2173 } else if size == 2 && Q == 1 { 2174 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2175 } 2176 return nil 2177 2178 case arg_Vn_arrangement_sz___2D_1: 2179 Rn := (x >> 5) & (1<<5 - 1) 2180 sz := (x >> 22) & 1 2181 if sz == 1 { 2182 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 2183 } 2184 return nil 2185 2186 case arg_Vn_arrangement_sz___2S_0__2D_1: 2187 Rn := (x >> 5) & (1<<5 - 1) 2188 sz := (x >> 22) & 1 2189 if sz == 0 { 2190 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 2191 } else { 2192 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 2193 } 2194 2195 case arg_Vn_arrangement_sz___4S_0__2D_1: 2196 Rn := (x >> 5) & (1<<5 - 1) 2197 sz := (x >> 22) & 1 2198 if sz == 0 { 2199 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2200 } else { 2201 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 2202 } 2203 2204 case arg_Vn_arrangement_sz_Q___2S_00__4S_01: 2205 Rn := (x >> 5) & (1<<5 - 1) 2206 sz := (x >> 22) & 1 2207 Q := (x >> 30) & 1 2208 if sz == 0 && Q == 0 { 2209 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 2210 } else if sz == 0 && Q == 1 { 2211 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2212 } 2213 return nil 2214 2215 case arg_Vn_arrangement_sz_Q___2S_00__4S_01__2D_11: 2216 Rn := (x >> 5) & (1<<5 - 1) 2217 sz := (x >> 22) & 1 2218 Q := (x >> 30) & 1 2219 if sz == 0 && Q == 0 { 2220 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 2221 } else if sz == 0 && Q == 1 { 2222 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2223 } else if sz == 1 && Q == 1 { 2224 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2D, 0} 2225 } 2226 return nil 2227 2228 case arg_Vn_arrangement_sz_Q___4H_00__8H_01__2S_10__4S_11: 2229 Rn := (x >> 5) & (1<<5 - 1) 2230 sz := (x >> 22) & 1 2231 Q := (x >> 30) & 1 2232 if sz == 0 && Q == 0 { 2233 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4H, 0} 2234 } else if sz == 0 && Q == 1 { 2235 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement8H, 0} 2236 } else if sz == 1 && Q == 0 { 2237 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement2S, 0} 2238 } else /* sz == 1 && Q == 1 */ { 2239 return RegisterWithArrangement{V0 + Reg(Rn), Arrangement4S, 0} 2240 } 2241 2242 case arg_Vt_1_arrangement_B_index__Q_S_size_1: 2243 Rt := x & (1<<5 - 1) 2244 Q := (x >> 30) & 1 2245 S := (x >> 12) & 1 2246 size := (x >> 10) & 3 2247 index := (Q << 3) | (S << 2) | (size) 2248 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementB, uint8(index), 1} 2249 2250 case arg_Vt_1_arrangement_D_index__Q_1: 2251 Rt := x & (1<<5 - 1) 2252 index := (x >> 30) & 1 2253 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementD, uint8(index), 1} 2254 2255 case arg_Vt_1_arrangement_H_index__Q_S_size_1: 2256 Rt := x & (1<<5 - 1) 2257 Q := (x >> 30) & 1 2258 S := (x >> 12) & 1 2259 size := (x >> 11) & 1 2260 index := (Q << 2) | (S << 1) | (size) 2261 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementH, uint8(index), 1} 2262 2263 case arg_Vt_1_arrangement_S_index__Q_S_1: 2264 Rt := x & (1<<5 - 1) 2265 Q := (x >> 30) & 1 2266 S := (x >> 12) & 1 2267 index := (Q << 1) | S 2268 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementS, uint8(index), 1} 2269 2270 case arg_Vt_1_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21__1D_30__2D_31: 2271 Rt := x & (1<<5 - 1) 2272 Q := (x >> 30) & 1 2273 size := (x >> 10) & 3 2274 if size == 0 && Q == 0 { 2275 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8B, 1} 2276 } else if size == 0 && Q == 1 { 2277 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement16B, 1} 2278 } else if size == 1 && Q == 0 { 2279 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4H, 1} 2280 } else if size == 1 && Q == 1 { 2281 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8H, 1} 2282 } else if size == 2 && Q == 0 { 2283 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2S, 1} 2284 } else if size == 2 && Q == 1 { 2285 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4S, 1} 2286 } else if size == 3 && Q == 0 { 2287 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement1D, 1} 2288 } else /* size == 3 && Q == 1 */ { 2289 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2D, 1} 2290 } 2291 2292 case arg_Vt_2_arrangement_B_index__Q_S_size_1: 2293 Rt := x & (1<<5 - 1) 2294 Q := (x >> 30) & 1 2295 S := (x >> 12) & 1 2296 size := (x >> 10) & 3 2297 index := (Q << 3) | (S << 2) | (size) 2298 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementB, uint8(index), 2} 2299 2300 case arg_Vt_2_arrangement_D_index__Q_1: 2301 Rt := x & (1<<5 - 1) 2302 index := (x >> 30) & 1 2303 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementD, uint8(index), 2} 2304 2305 case arg_Vt_2_arrangement_H_index__Q_S_size_1: 2306 Rt := x & (1<<5 - 1) 2307 Q := (x >> 30) & 1 2308 S := (x >> 12) & 1 2309 size := (x >> 11) & 1 2310 index := (Q << 2) | (S << 1) | (size) 2311 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementH, uint8(index), 2} 2312 2313 case arg_Vt_2_arrangement_S_index__Q_S_1: 2314 Rt := x & (1<<5 - 1) 2315 Q := (x >> 30) & 1 2316 S := (x >> 12) & 1 2317 index := (Q << 1) | S 2318 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementS, uint8(index), 2} 2319 2320 case arg_Vt_2_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21__1D_30__2D_31: 2321 Rt := x & (1<<5 - 1) 2322 Q := (x >> 30) & 1 2323 size := (x >> 10) & 3 2324 if size == 0 && Q == 0 { 2325 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8B, 2} 2326 } else if size == 0 && Q == 1 { 2327 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement16B, 2} 2328 } else if size == 1 && Q == 0 { 2329 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4H, 2} 2330 } else if size == 1 && Q == 1 { 2331 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8H, 2} 2332 } else if size == 2 && Q == 0 { 2333 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2S, 2} 2334 } else if size == 2 && Q == 1 { 2335 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4S, 2} 2336 } else if size == 3 && Q == 0 { 2337 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement1D, 2} 2338 } else /* size == 3 && Q == 1 */ { 2339 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2D, 2} 2340 } 2341 2342 case arg_Vt_2_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21__2D_31: 2343 Rt := x & (1<<5 - 1) 2344 Q := (x >> 30) & 1 2345 size := (x >> 10) & 3 2346 if size == 0 && Q == 0 { 2347 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8B, 2} 2348 } else if size == 0 && Q == 1 { 2349 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement16B, 2} 2350 } else if size == 1 && Q == 0 { 2351 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4H, 2} 2352 } else if size == 1 && Q == 1 { 2353 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8H, 2} 2354 } else if size == 2 && Q == 0 { 2355 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2S, 2} 2356 } else if size == 2 && Q == 1 { 2357 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4S, 2} 2358 } else if size == 3 && Q == 1 { 2359 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2D, 2} 2360 } 2361 return nil 2362 2363 case arg_Vt_3_arrangement_B_index__Q_S_size_1: 2364 Rt := x & (1<<5 - 1) 2365 Q := (x >> 30) & 1 2366 S := (x >> 12) & 1 2367 size := (x >> 10) & 3 2368 index := (Q << 3) | (S << 2) | (size) 2369 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementB, uint8(index), 3} 2370 2371 case arg_Vt_3_arrangement_D_index__Q_1: 2372 Rt := x & (1<<5 - 1) 2373 index := (x >> 30) & 1 2374 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementD, uint8(index), 3} 2375 2376 case arg_Vt_3_arrangement_H_index__Q_S_size_1: 2377 Rt := x & (1<<5 - 1) 2378 Q := (x >> 30) & 1 2379 S := (x >> 12) & 1 2380 size := (x >> 11) & 1 2381 index := (Q << 2) | (S << 1) | (size) 2382 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementH, uint8(index), 3} 2383 2384 case arg_Vt_3_arrangement_S_index__Q_S_1: 2385 Rt := x & (1<<5 - 1) 2386 Q := (x >> 30) & 1 2387 S := (x >> 12) & 1 2388 index := (Q << 1) | S 2389 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementS, uint8(index), 3} 2390 2391 case arg_Vt_3_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21__1D_30__2D_31: 2392 Rt := x & (1<<5 - 1) 2393 Q := (x >> 30) & 1 2394 size := (x >> 10) & 3 2395 if size == 0 && Q == 0 { 2396 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8B, 3} 2397 } else if size == 0 && Q == 1 { 2398 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement16B, 3} 2399 } else if size == 1 && Q == 0 { 2400 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4H, 3} 2401 } else if size == 1 && Q == 1 { 2402 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8H, 3} 2403 } else if size == 2 && Q == 0 { 2404 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2S, 3} 2405 } else if size == 2 && Q == 1 { 2406 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4S, 3} 2407 } else if size == 3 && Q == 0 { 2408 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement1D, 3} 2409 } else /* size == 3 && Q == 1 */ { 2410 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2D, 3} 2411 } 2412 2413 case arg_Vt_3_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21__2D_31: 2414 Rt := x & (1<<5 - 1) 2415 Q := (x >> 30) & 1 2416 size := (x >> 10) & 3 2417 if size == 0 && Q == 0 { 2418 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8B, 3} 2419 } else if size == 0 && Q == 1 { 2420 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement16B, 3} 2421 } else if size == 1 && Q == 0 { 2422 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4H, 3} 2423 } else if size == 1 && Q == 1 { 2424 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8H, 3} 2425 } else if size == 2 && Q == 0 { 2426 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2S, 3} 2427 } else if size == 2 && Q == 1 { 2428 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4S, 3} 2429 } else if size == 3 && Q == 1 { 2430 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2D, 3} 2431 } 2432 return nil 2433 2434 case arg_Vt_4_arrangement_B_index__Q_S_size_1: 2435 Rt := x & (1<<5 - 1) 2436 Q := (x >> 30) & 1 2437 S := (x >> 12) & 1 2438 size := (x >> 10) & 3 2439 index := (Q << 3) | (S << 2) | (size) 2440 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementB, uint8(index), 4} 2441 2442 case arg_Vt_4_arrangement_D_index__Q_1: 2443 Rt := x & (1<<5 - 1) 2444 index := (x >> 30) & 1 2445 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementD, uint8(index), 4} 2446 2447 case arg_Vt_4_arrangement_H_index__Q_S_size_1: 2448 Rt := x & (1<<5 - 1) 2449 Q := (x >> 30) & 1 2450 S := (x >> 12) & 1 2451 size := (x >> 11) & 1 2452 index := (Q << 2) | (S << 1) | (size) 2453 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementH, uint8(index), 4} 2454 2455 case arg_Vt_4_arrangement_S_index__Q_S_1: 2456 Rt := x & (1<<5 - 1) 2457 Q := (x >> 30) & 1 2458 S := (x >> 12) & 1 2459 index := (Q << 1) | S 2460 return RegisterWithArrangementAndIndex{V0 + Reg(Rt), ArrangementS, uint8(index), 4} 2461 2462 case arg_Vt_4_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21__1D_30__2D_31: 2463 Rt := x & (1<<5 - 1) 2464 Q := (x >> 30) & 1 2465 size := (x >> 10) & 3 2466 if size == 0 && Q == 0 { 2467 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8B, 4} 2468 } else if size == 0 && Q == 1 { 2469 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement16B, 4} 2470 } else if size == 1 && Q == 0 { 2471 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4H, 4} 2472 } else if size == 1 && Q == 1 { 2473 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8H, 4} 2474 } else if size == 2 && Q == 0 { 2475 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2S, 4} 2476 } else if size == 2 && Q == 1 { 2477 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4S, 4} 2478 } else if size == 3 && Q == 0 { 2479 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement1D, 4} 2480 } else /* size == 3 && Q == 1 */ { 2481 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2D, 4} 2482 } 2483 2484 case arg_Vt_4_arrangement_size_Q___8B_00__16B_01__4H_10__8H_11__2S_20__4S_21__2D_31: 2485 Rt := x & (1<<5 - 1) 2486 Q := (x >> 30) & 1 2487 size := (x >> 10) & 3 2488 if size == 0 && Q == 0 { 2489 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8B, 4} 2490 } else if size == 0 && Q == 1 { 2491 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement16B, 4} 2492 } else if size == 1 && Q == 0 { 2493 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4H, 4} 2494 } else if size == 1 && Q == 1 { 2495 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement8H, 4} 2496 } else if size == 2 && Q == 0 { 2497 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2S, 4} 2498 } else if size == 2 && Q == 1 { 2499 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement4S, 4} 2500 } else if size == 3 && Q == 1 { 2501 return RegisterWithArrangement{V0 + Reg(Rt), Arrangement2D, 4} 2502 } 2503 return nil 2504 2505 case arg_Xns_mem_extend_m__UXTW_2__LSL_3__SXTW_6__SXTX_7__0_0__4_1: 2506 return handle_MemExtend(x, 4, false) 2507 2508 case arg_Xns_mem_offset: 2509 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2510 return MemImmediate{Rn, AddrOffset, 0} 2511 2512 case arg_Xns_mem_optional_imm12_16_unsigned: 2513 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2514 imm12 := (x >> 10) & (1<<12 - 1) 2515 return MemImmediate{Rn, AddrOffset, int32(imm12 << 4)} 2516 2517 case arg_Xns_mem_optional_imm7_16_signed: 2518 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2519 imm7 := (x >> 15) & (1<<7 - 1) 2520 return MemImmediate{Rn, AddrOffset, ((int32(imm7 << 4)) << 21) >> 21} 2521 2522 case arg_Xns_mem_post_fixedimm_1: 2523 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2524 return MemImmediate{Rn, AddrPostIndex, 1} 2525 2526 case arg_Xns_mem_post_fixedimm_12: 2527 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2528 return MemImmediate{Rn, AddrPostIndex, 12} 2529 2530 case arg_Xns_mem_post_fixedimm_16: 2531 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2532 return MemImmediate{Rn, AddrPostIndex, 16} 2533 2534 case arg_Xns_mem_post_fixedimm_2: 2535 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2536 return MemImmediate{Rn, AddrPostIndex, 2} 2537 2538 case arg_Xns_mem_post_fixedimm_24: 2539 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2540 return MemImmediate{Rn, AddrPostIndex, 24} 2541 2542 case arg_Xns_mem_post_fixedimm_3: 2543 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2544 return MemImmediate{Rn, AddrPostIndex, 3} 2545 2546 case arg_Xns_mem_post_fixedimm_32: 2547 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2548 return MemImmediate{Rn, AddrPostIndex, 32} 2549 2550 case arg_Xns_mem_post_fixedimm_4: 2551 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2552 return MemImmediate{Rn, AddrPostIndex, 4} 2553 2554 case arg_Xns_mem_post_fixedimm_6: 2555 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2556 return MemImmediate{Rn, AddrPostIndex, 6} 2557 2558 case arg_Xns_mem_post_fixedimm_8: 2559 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2560 return MemImmediate{Rn, AddrPostIndex, 8} 2561 2562 case arg_Xns_mem_post_imm7_16_signed: 2563 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2564 imm7 := (x >> 15) & (1<<7 - 1) 2565 return MemImmediate{Rn, AddrPostIndex, ((int32(imm7 << 4)) << 21) >> 21} 2566 2567 case arg_Xns_mem_post_Q__16_0__32_1: 2568 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2569 Q := (x >> 30) & 1 2570 return MemImmediate{Rn, AddrPostIndex, int32((Q + 1) * 16)} 2571 2572 case arg_Xns_mem_post_Q__24_0__48_1: 2573 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2574 Q := (x >> 30) & 1 2575 return MemImmediate{Rn, AddrPostIndex, int32((Q + 1) * 24)} 2576 2577 case arg_Xns_mem_post_Q__32_0__64_1: 2578 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2579 Q := (x >> 30) & 1 2580 return MemImmediate{Rn, AddrPostIndex, int32((Q + 1) * 32)} 2581 2582 case arg_Xns_mem_post_Q__8_0__16_1: 2583 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2584 Q := (x >> 30) & 1 2585 return MemImmediate{Rn, AddrPostIndex, int32((Q + 1) * 8)} 2586 2587 case arg_Xns_mem_post_size__1_0__2_1__4_2__8_3: 2588 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2589 size := (x >> 10) & 3 2590 return MemImmediate{Rn, AddrPostIndex, int32(1 << size)} 2591 2592 case arg_Xns_mem_post_size__2_0__4_1__8_2__16_3: 2593 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2594 size := (x >> 10) & 3 2595 return MemImmediate{Rn, AddrPostIndex, int32(2 << size)} 2596 2597 case arg_Xns_mem_post_size__3_0__6_1__12_2__24_3: 2598 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2599 size := (x >> 10) & 3 2600 return MemImmediate{Rn, AddrPostIndex, int32(3 << size)} 2601 2602 case arg_Xns_mem_post_size__4_0__8_1__16_2__32_3: 2603 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2604 size := (x >> 10) & 3 2605 return MemImmediate{Rn, AddrPostIndex, int32(4 << size)} 2606 2607 case arg_Xns_mem_post_Xm: 2608 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2609 Rm := (x >> 16) & (1<<5 - 1) 2610 return MemImmediate{Rn, AddrPostReg, int32(Rm)} 2611 2612 case arg_Xns_mem_wb_imm7_16_signed: 2613 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2614 imm7 := (x >> 15) & (1<<7 - 1) 2615 return MemImmediate{Rn, AddrPreIndex, ((int32(imm7 << 4)) << 21) >> 21} 2616 } 2617 } 2618 2619 // nolint 2620 func handle_ExtendedRegister(x uint32, has_width bool) Arg { 2621 s := (x >> 29) & 1 2622 rm := (x >> 16) & (1<<5 - 1) 2623 option := (x >> 13) & (1<<3 - 1) 2624 imm3 := (x >> 10) & (1<<3 - 1) 2625 rn := (x >> 5) & (1<<5 - 1) 2626 rd := x & (1<<5 - 1) 2627 is_32bit := !has_width 2628 var rea RegExtshiftAmount 2629 if has_width { 2630 if option&0x3 != 0x3 { 2631 rea.reg = W0 + Reg(rm) 2632 } else { 2633 rea.reg = X0 + Reg(rm) 2634 } 2635 } else { 2636 rea.reg = W0 + Reg(rm) 2637 } 2638 switch option { 2639 case 0: 2640 rea.extShift = uxtb 2641 case 1: 2642 rea.extShift = uxth 2643 case 2: 2644 if is_32bit && (rn == 31 || (s == 0 && rd == 31)) { 2645 if imm3 != 0 { 2646 rea.extShift = lsl 2647 } else { 2648 rea.extShift = ExtShift(0) 2649 } 2650 } else { 2651 rea.extShift = uxtw 2652 } 2653 case 3: 2654 if !is_32bit && (rn == 31 || (s == 0 && rd == 31)) { 2655 if imm3 != 0 { 2656 rea.extShift = lsl 2657 } else { 2658 rea.extShift = ExtShift(0) 2659 } 2660 } else { 2661 rea.extShift = uxtx 2662 } 2663 case 4: 2664 rea.extShift = sxtb 2665 case 5: 2666 rea.extShift = sxth 2667 case 6: 2668 rea.extShift = sxtw 2669 case 7: 2670 rea.extShift = sxtx 2671 } 2672 rea.show_zero = false 2673 rea.amount = uint8(imm3) 2674 return rea 2675 } 2676 2677 // nolint 2678 func handle_ImmediateShiftedRegister(x uint32, max uint8, is_w, has_ror bool) Arg { 2679 var rsa RegExtshiftAmount 2680 if is_w { 2681 rsa.reg = W0 + Reg((x>>16)&(1<<5-1)) 2682 } else { 2683 rsa.reg = X0 + Reg((x>>16)&(1<<5-1)) 2684 } 2685 switch (x >> 22) & 0x3 { 2686 case 0: 2687 rsa.extShift = lsl 2688 case 1: 2689 rsa.extShift = lsr 2690 case 2: 2691 rsa.extShift = asr 2692 case 3: 2693 if has_ror { 2694 rsa.extShift = ror 2695 } else { 2696 return nil 2697 } 2698 } 2699 rsa.show_zero = true 2700 rsa.amount = uint8((x >> 10) & (1<<6 - 1)) 2701 if rsa.amount == 0 && rsa.extShift == lsl { 2702 rsa.extShift = ExtShift(0) 2703 } else if rsa.amount > max { 2704 return nil 2705 } 2706 return rsa 2707 } 2708 2709 // nolint 2710 func handle_MemExtend(x uint32, mult uint8, absent bool) Arg { 2711 var extend ExtShift 2712 var Rm Reg 2713 option := (x >> 13) & (1<<3 - 1) 2714 Rn := RegSP(X0) + RegSP(x>>5&(1<<5-1)) 2715 if (option & 1) != 0 { 2716 Rm = Reg(X0) + Reg(x>>16&(1<<5-1)) 2717 } else { 2718 Rm = Reg(W0) + Reg(x>>16&(1<<5-1)) 2719 } 2720 switch option { 2721 default: 2722 return nil 2723 case 2: 2724 extend = uxtw 2725 case 3: 2726 extend = lsl 2727 case 6: 2728 extend = sxtw 2729 case 7: 2730 extend = sxtx 2731 } 2732 amount := (uint8((x >> 12) & 1)) * mult 2733 return MemExtend{Rn, Rm, extend, amount, absent} 2734 } 2735 2736 // nolint 2737 func handle_bitmasks(x uint32, datasize uint8) Arg { 2738 var length, levels, esize, i uint8 2739 var welem, wmask uint64 2740 n := (x >> 22) & 1 2741 imms := uint8((x >> 10) & (1<<6 - 1)) 2742 immr := uint8((x >> 16) & (1<<6 - 1)) 2743 if n != 0 { 2744 length = 6 2745 } else if (imms & 32) == 0 { 2746 length = 5 2747 } else if (imms & 16) == 0 { 2748 length = 4 2749 } else if (imms & 8) == 0 { 2750 length = 3 2751 } else if (imms & 4) == 0 { 2752 length = 2 2753 } else if (imms & 2) == 0 { 2754 length = 1 2755 } else { 2756 return nil 2757 } 2758 levels = 1<<length - 1 2759 s := imms & levels 2760 r := immr & levels 2761 esize = 1 << length 2762 if esize > datasize { 2763 return nil 2764 } 2765 welem = 1<<(s+1) - 1 2766 ror := (welem >> r) | (welem << (esize - r)) 2767 ror &= ((1 << esize) - 1) 2768 wmask = 0 2769 for i = 0; i < datasize; i += esize { 2770 wmask = (wmask << esize) | ror 2771 } 2772 return Imm64{wmask, false} 2773 }