1 // Copyright (c) 2011-2013 ARM Limited
4 // The license below extends only to copyright in the software and shall
5 // not be construed as granting a license to any other intellectual
6 // property including but not limited to intellectual property relating
7 // to a hardware implementation of the functionality of the software
8 // licensed hereunder. You may use the software subject to the license
9 // terms below provided that you ensure that this notice is replicated
10 // unmodified and in its entirety in all distributions of the software,
11 // modified or unmodified, in source code or in binary form.
13 // Redistribution and use in source and binary forms, with or without
14 // modification, are permitted provided that the following conditions are
15 // met: redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer;
17 // redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution;
20 // neither the name of the copyright holders nor the names of its
21 // contributors may be used to endorse or promote products derived from
22 // this software without specific prior written permission.
24 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
28 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
30 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 // Authors: Gabe Black
44 StaticInstPtr decodeDataProcImm(ExtMachInst machInst);
45 StaticInstPtr decodeBranchExcSys(ExtMachInst machInst);
46 StaticInstPtr decodeLoadsStores(ExtMachInst machInst);
47 StaticInstPtr decodeDataProcReg(ExtMachInst machInst);
49 StaticInstPtr decodeFpAdvSIMD(ExtMachInst machInst);
50 StaticInstPtr decodeFp(ExtMachInst machInst);
51 StaticInstPtr decodeAdvSIMD(ExtMachInst machInst);
52 StaticInstPtr decodeAdvSIMDScalar(ExtMachInst machInst);
54 StaticInstPtr decodeGem5Ops(ExtMachInst machInst);
62 decodeDataProcImm(ExtMachInst machInst)
64 IntRegIndex rd = (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
65 IntRegIndex rdsp = makeSP(rd);
66 IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
67 IntRegIndex rnsp = makeSP(rn);
69 uint8_t opc = bits(machInst, 30, 29);
70 bool sf = bits(machInst, 31);
71 bool n = bits(machInst, 22);
72 uint8_t immr = bits(machInst, 21, 16);
73 uint8_t imms = bits(machInst, 15, 10);
74 switch (bits(machInst, 25, 23)) {
78 uint64_t immlo = bits(machInst, 30, 29);
79 uint64_t immhi = bits(machInst, 23, 5);
80 uint64_t imm = (immlo << 0) | (immhi << 2);
81 if (bits(machInst, 31) == 0)
82 return new AdrXImm(machInst, rd, INTREG_ZERO, sext<21>(imm));
84 return new AdrpXImm(machInst, rd, INTREG_ZERO,
90 uint32_t imm12 = bits(machInst, 21, 10);
91 uint8_t shift = bits(machInst, 23, 22);
95 else if (shift == 0x1)
98 return new Unknown64(machInst);
101 return new AddXImm(machInst, rdsp, rnsp, imm);
103 return new AddXImmCc(machInst, rd, rnsp, imm);
105 return new SubXImm(machInst, rdsp, rnsp, imm);
107 return new SubXImmCc(machInst, rd, rnsp, imm);
113 return new Unknown64(machInst);
114 // len = MSB(n:NOT(imms)), len < 1 is undefined.
118 } else if (imms == 0x3f || imms == 0x3e) {
119 return new Unknown64(machInst);
121 len = findMsbSet(imms ^ 0x3f);
123 // Generate r, s, and size.
124 uint64_t r = bits(immr, len - 1, 0);
125 uint64_t s = bits(imms, len - 1, 0);
126 uint8_t size = 1 << len;
128 return new Unknown64(machInst);
129 // Generate the pattern with s 1s, rotated by r, with size bits.
130 uint64_t pattern = mask(s + 1);
132 pattern = (pattern >> r) | (pattern << (size - r));
133 pattern &= mask(size);
135 uint8_t width = sf ? 64 : 32;
136 // Replicate that to fill up the immediate.
137 for (unsigned i = 1; i < (width / size); i *= 2)
138 pattern |= (pattern << (i * size));
139 uint64_t imm = pattern;
143 return new AndXImm(machInst, rdsp, rn, imm);
145 return new OrrXImm(machInst, rdsp, rn, imm);
147 return new EorXImm(machInst, rdsp, rn, imm);
149 return new AndXImmCc(machInst, rd, rn, imm);
154 IntRegIndex rd = (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
155 uint32_t imm16 = bits(machInst, 20, 5);
156 uint32_t hw = bits(machInst, 22, 21);
159 return new Movn(machInst, rd, imm16, hw * 16);
161 return new Unknown64(machInst);
163 return new Movz(machInst, rd, imm16, hw * 16);
165 return new Movk(machInst, rd, imm16, hw * 16);
169 if ((sf != n) || (!sf && (bits(immr, 5) || bits(imms, 5))))
170 return new Unknown64(machInst);
173 return new Sbfm64(machInst, rd, rn, immr, imms);
175 return new Bfm64(machInst, rd, rn, immr, imms);
177 return new Ubfm64(machInst, rd, rn, immr, imms);
179 return new Unknown64(machInst);
183 IntRegIndex rm = (IntRegIndex)(uint8_t)bits(machInst, 20, 16);
184 if (opc || bits(machInst, 21))
185 return new Unknown64(machInst);
187 return new Extr64(machInst, rd, rn, rm, imms);
190 return new FailUnimplemented("Unhandled Case8", machInst);
199 decodeBranchExcSys(ExtMachInst machInst)
201 switch (bits(machInst, 30, 29)) {
204 int64_t imm = sext<26>(bits(machInst, 25, 0)) << 2;
205 if (bits(machInst, 31) == 0)
206 return new B64(machInst, imm);
208 return new Bl64(machInst, imm);
212 IntRegIndex rt = (IntRegIndex)(uint8_t)bits(machInst, 4, 0);
213 if (bits(machInst, 25) == 0) {
214 int64_t imm = sext<19>(bits(machInst, 23, 5)) << 2;
215 if (bits(machInst, 24) == 0)
216 return new Cbz64(machInst, imm, rt);
218 return new Cbnz64(machInst, imm, rt);
220 uint64_t bitmask = 0x1;
221 bitmask <<= bits(machInst, 23, 19);
222 int64_t imm = sext<14>(bits(machInst, 18, 5)) << 2;
223 if (bits(machInst, 31))
225 if (bits(machInst, 24) == 0)
226 return new Tbz64(machInst, bitmask, imm, rt);
228 return new Tbnz64(machInst, bitmask, imm, rt);
233 if (bits(machInst, 31) == 0) {
234 if (bits(machInst, 25, 24) || bits(machInst, 4))
235 return new Unknown64(machInst);
236 int64_t imm = sext<19>(bits(machInst, 23, 5)) << 2;
237 ConditionCode condCode =
238 (ConditionCode)(uint8_t)(bits(machInst, 3, 0));
239 return new BCond64(machInst, imm, condCode);
240 } else if (bits(machInst, 25, 24) == 0x0) {
241 if (bits(machInst, 4, 2))
242 return new Unknown64(machInst);
243 uint8_t decVal = (bits(machInst, 1, 0) << 0) |
244 (bits(machInst, 23, 21) << 2);
247 return new Svc64(machInst);
249 return new FailUnimplemented("hvc", machInst);
251 return new Smc64(machInst);
253 return new FailUnimplemented("brk", machInst);
255 return new FailUnimplemented("hlt", machInst);
257 return new FailUnimplemented("dcps1", machInst);
259 return new FailUnimplemented("dcps2", machInst);
261 return new FailUnimplemented("dcps3", machInst);
263 return new Unknown64(machInst);
265 } else if (bits(machInst, 25, 22) == 0x4) {
266 // bit 31:22=1101010100
267 bool l = bits(machInst, 21);
268 uint8_t op0 = bits(machInst, 20, 19);
269 uint8_t op1 = bits(machInst, 18, 16);
270 uint8_t crn = bits(machInst, 15, 12);
271 uint8_t crm = bits(machInst, 11, 8);
272 uint8_t op2 = bits(machInst, 7, 5);
273 IntRegIndex rt = (IntRegIndex)(uint8_t)bits(machInst, 4, 0);
277 return new Unknown64(machInst);
278 if (crn == 0x2 && op1 == 0x3) {
281 return new NopInst(machInst);
283 return new YieldInst(machInst);
285 return new WfeInst(machInst);
287 return new WfiInst(machInst);
289 return new SevInst(machInst);
291 return new SevlInst(machInst);
293 return new Unknown64(machInst);
295 } else if (crn == 0x3 && op1 == 0x3) {
298 return new Clrex64(machInst);
300 return new Dsb64(machInst);
302 return new Dmb64(machInst);
304 return new Isb64(machInst);
306 return new Unknown64(machInst);
308 } else if (crn == 0x4) {
310 switch (op1 << 3 | op2) {
313 return new MsrSP64(machInst,
314 (IntRegIndex) MISCREG_SPSEL,
319 return new MsrDAIFSet64(
321 (IntRegIndex) MISCREG_DAIF,
326 return new MsrDAIFClr64(
328 (IntRegIndex) MISCREG_DAIF,
332 return new Unknown64(machInst);
335 return new Unknown64(machInst);
342 // bit 31:22=1101010100, 20:19=11
344 MiscRegIndex miscReg =
345 decodeAArch64SysReg(op0, op1, crn, crm, op2);
347 if ((miscReg == MISCREG_DC_CIVAC_Xt) ||
348 (miscReg == MISCREG_DC_CVAC_Xt) ||
349 (miscReg == MISCREG_DC_ZVA_Xt)) {
350 return new Unknown64(machInst);
353 // Check for invalid registers
354 if (miscReg == MISCREG_UNKNOWN) {
355 return new Unknown64(machInst);
356 } else if (miscRegInfo[miscReg][MISCREG_IMPLEMENTED]) {
357 if (miscReg == MISCREG_NZCV) {
359 return new MrsNZCV64(machInst, rt, (IntRegIndex) miscReg);
361 return new MsrNZCV64(machInst, (IntRegIndex) miscReg, rt);
363 uint32_t iss = msrMrs64IssBuild(read, op0, op1, crn, crm, op2, rt);
364 if (miscReg == MISCREG_DC_ZVA_Xt && !read)
365 return new Dczva(machInst, rt, (IntRegIndex) miscReg, iss);
368 return new Mrs64(machInst, rt, (IntRegIndex) miscReg, iss);
370 return new Msr64(machInst, (IntRegIndex) miscReg, rt, iss);
371 } else if (miscRegInfo[miscReg][MISCREG_WARN_NOT_FAIL]) {
372 std::string full_mnem = csprintf("%s %s",
373 read ? "mrs" : "msr", miscRegName[miscReg]);
374 return new WarnUnimplemented(read ? "mrs" : "msr",
375 machInst, full_mnem);
377 return new FailUnimplemented(csprintf("%s %s",
378 read ? "mrs" : "msr", miscRegName[miscReg]).c_str(),
384 } else if (bits(machInst, 25) == 0x1) {
385 uint8_t opc = bits(machInst, 24, 21);
386 uint8_t op2 = bits(machInst, 20, 16);
387 uint8_t op3 = bits(machInst, 15, 10);
388 IntRegIndex rn = (IntRegIndex)(uint8_t)bits(machInst, 9, 5);
389 uint8_t op4 = bits(machInst, 4, 0);
390 if (op2 != 0x1f || op3 != 0x0 || op4 != 0x0)
391 return new Unknown64(machInst);
394 return new Br64(machInst, rn);
396 return new Blr64(machInst, rn);
398 return new Ret64(machInst, rn);
401 return new Unknown64(machInst);
402 return new Eret64(machInst);
405 return new Unknown64(machInst);
406 return new FailUnimplemented("dret", machInst);
410 return new Unknown64(machInst);
412 return new FailUnimplemented("Unhandled Case7", machInst);
421 decodeLoadsStores(ExtMachInst machInst)
424 switch (bits(machInst, 29, 28)) {
426 if (bits(machInst, 26) == 0) {
427 if (bits(machInst, 24) != 0)
428 return new Unknown64(machInst);
429 IntRegIndex rt = (IntRegIndex)(uint8_t)bits(machInst, 4, 0);
430 IntRegIndex rn = (IntRegIndex)(uint8_t)bits(machInst, 9, 5);
431 IntRegIndex rnsp = makeSP(rn);
432 IntRegIndex rt2 = (IntRegIndex)(uint8_t)bits(machInst, 14, 10);
433 IntRegIndex rs = (IntRegIndex)(uint8_t)bits(machInst, 20, 16);
434 uint8_t opc = (bits(machInst, 15) << 0) |
435 (bits(machInst, 23, 21) << 1);
436 uint8_t size = bits(machInst, 31, 30);
441 return new STXRB64(machInst, rt, rnsp, rs);
443 return new STXRH64(machInst, rt, rnsp, rs);
445 return new STXRW64(machInst, rt, rnsp, rs);
447 return new STXRX64(machInst, rt, rnsp, rs);
452 return new STLXRB64(machInst, rt, rnsp, rs);
454 return new STLXRH64(machInst, rt, rnsp, rs);
456 return new STLXRW64(machInst, rt, rnsp, rs);
458 return new STLXRX64(machInst, rt, rnsp, rs);
464 return new Unknown64(machInst);
466 return new STXPW64(machInst, rs, rt, rt2, rnsp);
468 return new STXPX64(machInst, rs, rt, rt2, rnsp);
475 return new Unknown64(machInst);
477 return new STLXPW64(machInst, rs, rt, rt2, rnsp);
479 return new STLXPX64(machInst, rs, rt, rt2, rnsp);
485 return new LDXRB64(machInst, rt, rnsp, rs);
487 return new LDXRH64(machInst, rt, rnsp, rs);
489 return new LDXRW64(machInst, rt, rnsp, rs);
491 return new LDXRX64(machInst, rt, rnsp, rs);
496 return new LDAXRB64(machInst, rt, rnsp, rs);
498 return new LDAXRH64(machInst, rt, rnsp, rs);
500 return new LDAXRW64(machInst, rt, rnsp, rs);
502 return new LDAXRX64(machInst, rt, rnsp, rs);
508 return new Unknown64(machInst);
510 return new LDXPW64(machInst, rt, rt2, rnsp);
512 return new LDXPX64(machInst, rt, rt2, rnsp);
519 return new Unknown64(machInst);
521 return new LDAXPW64(machInst, rt, rt2, rnsp);
523 return new LDAXPX64(machInst, rt, rt2, rnsp);
529 return new STLRB64(machInst, rt, rnsp);
531 return new STLRH64(machInst, rt, rnsp);
533 return new STLRW64(machInst, rt, rnsp);
535 return new STLRX64(machInst, rt, rnsp);
540 return new LDARB64(machInst, rt, rnsp);
542 return new LDARH64(machInst, rt, rnsp);
544 return new LDARW64(machInst, rt, rnsp);
546 return new LDARX64(machInst, rt, rnsp);
549 return new Unknown64(machInst);
551 } else if (bits(machInst, 31)) {
552 return new Unknown64(machInst);
554 return decodeNeonMem(machInst);
558 if (bits(machInst, 24) != 0)
559 return new Unknown64(machInst);
560 uint8_t switchVal = (bits(machInst, 26) << 0) |
561 (bits(machInst, 31, 30) << 1);
562 int64_t imm = sext<19>(bits(machInst, 23, 5)) << 2;
563 IntRegIndex rt = (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
566 return new LDRWL64_LIT(machInst, rt, imm);
568 return new LDRSFP64_LIT(machInst, rt, imm);
570 return new LDRXL64_LIT(machInst, rt, imm);
572 return new LDRDFP64_LIT(machInst, rt, imm);
574 return new LDRSWL64_LIT(machInst, rt, imm);
576 return new BigFpMemLit("ldr", machInst, rt, imm);
578 return new PRFM64_LIT(machInst, rt, imm);
580 return new Unknown64(machInst);
585 uint8_t opc = bits(machInst, 31, 30);
587 return new Unknown64(machInst);
589 bool fp = bits(machInst, 26);
590 bool load = bits(machInst, 22);
594 if ((opc == 1) && !load)
595 return new Unknown64(machInst);
596 size = (opc == 0 || opc == 1) ? 4 : 8;
598 uint8_t type = bits(machInst, 24, 23);
599 int64_t imm = sext<7>(bits(machInst, 21, 15)) * size;
601 IntRegIndex rn = (IntRegIndex)(uint8_t)bits(machInst, 9, 5);
602 IntRegIndex rt = (IntRegIndex)(uint8_t)bits(machInst, 4, 0);
603 IntRegIndex rt2 = (IntRegIndex)(uint8_t)bits(machInst, 14, 10);
605 bool noAlloc = (type == 0);
606 bool signExt = !noAlloc && !fp && opc == 1;
607 PairMemOp::AddrMode mode;
608 const char *mnemonic = NULL;
612 mode = PairMemOp::AddrMd_Offset;
615 mode = PairMemOp::AddrMd_PostIndex;
618 mode = PairMemOp::AddrMd_PreIndex;
621 return new Unknown64(machInst);
637 return new LdpStp(mnemonic, machInst, size, fp, load, noAlloc,
638 signExt, false, false, imm, mode, rn, rt, rt2);
640 // bit 29:27=111, 25=0
643 uint8_t switchVal = (bits(machInst, 23, 22) << 0) |
644 (bits(machInst, 26) << 2) |
645 (bits(machInst, 31, 30) << 3);
646 if (bits(machInst, 24) == 1) {
647 uint64_t imm12 = bits(machInst, 21, 10);
648 IntRegIndex rt = (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
649 IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
650 IntRegIndex rnsp = makeSP(rn);
653 return new STRB64_IMM(machInst, rt, rnsp, imm12);
655 return new LDRB64_IMM(machInst, rt, rnsp, imm12);
657 return new LDRSBX64_IMM(machInst, rt, rnsp, imm12);
659 return new LDRSBW64_IMM(machInst, rt, rnsp, imm12);
661 return new STRBFP64_IMM(machInst, rt, rnsp, imm12);
663 return new LDRBFP64_IMM(machInst, rt, rnsp, imm12);
665 return new BigFpMemImm("str", machInst, false,
666 rt, rnsp, imm12 << 4);
668 return new BigFpMemImm("ldr", machInst, true,
669 rt, rnsp, imm12 << 4);
671 return new STRH64_IMM(machInst, rt, rnsp, imm12 << 1);
673 return new LDRH64_IMM(machInst, rt, rnsp, imm12 << 1);
675 return new LDRSHX64_IMM(machInst, rt, rnsp, imm12 << 1);
677 return new LDRSHW64_IMM(machInst, rt, rnsp, imm12 << 1);
679 return new STRHFP64_IMM(machInst, rt, rnsp, imm12 << 1);
681 return new LDRHFP64_IMM(machInst, rt, rnsp, imm12 << 1);
683 return new STRW64_IMM(machInst, rt, rnsp, imm12 << 2);
685 return new LDRW64_IMM(machInst, rt, rnsp, imm12 << 2);
687 return new LDRSW64_IMM(machInst, rt, rnsp, imm12 << 2);
689 return new STRSFP64_IMM(machInst, rt, rnsp, imm12 << 2);
691 return new LDRSFP64_IMM(machInst, rt, rnsp, imm12 << 2);
693 return new STRX64_IMM(machInst, rt, rnsp, imm12 << 3);
695 return new LDRX64_IMM(machInst, rt, rnsp, imm12 << 3);
697 return new PRFM64_IMM(machInst, rt, rnsp, imm12 << 3);
699 return new STRDFP64_IMM(machInst, rt, rnsp, imm12 << 3);
701 return new LDRDFP64_IMM(machInst, rt, rnsp, imm12 << 3);
703 return new Unknown64(machInst);
705 } else if (bits(machInst, 21) == 1) {
706 if (bits(machInst, 11, 10) != 0x2)
707 return new Unknown64(machInst);
708 if (!bits(machInst, 14))
709 return new Unknown64(machInst);
710 IntRegIndex rt = (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
711 IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
712 IntRegIndex rnsp = makeSP(rn);
713 IntRegIndex rm = (IntRegIndex)(uint32_t)bits(machInst, 20, 16);
715 (ArmExtendType)(uint32_t)bits(machInst, 15, 13);
716 uint8_t s = bits(machInst, 12);
719 return new STRB64_REG(machInst, rt, rnsp, rm, type, 0);
721 return new LDRB64_REG(machInst, rt, rnsp, rm, type, 0);
723 return new LDRSBX64_REG(machInst, rt, rnsp, rm, type, 0);
725 return new LDRSBW64_REG(machInst, rt, rnsp, rm, type, 0);
727 return new STRBFP64_REG(machInst, rt, rnsp, rm, type, 0);
729 return new LDRBFP64_REG(machInst, rt, rnsp, rm, type, 0);
731 return new BigFpMemReg("str", machInst, false,
732 rt, rnsp, rm, type, s * 4);
734 return new BigFpMemReg("ldr", machInst, true,
735 rt, rnsp, rm, type, s * 4);
737 return new STRH64_REG(machInst, rt, rnsp, rm, type, s);
739 return new LDRH64_REG(machInst, rt, rnsp, rm, type, s);
741 return new LDRSHX64_REG(machInst, rt, rnsp, rm, type, s);
743 return new LDRSHW64_REG(machInst, rt, rnsp, rm, type, s);
745 return new STRHFP64_REG(machInst, rt, rnsp, rm, type, s);
747 return new LDRHFP64_REG(machInst, rt, rnsp, rm, type, s);
749 return new STRW64_REG(machInst, rt, rnsp, rm, type, s * 2);
751 return new LDRW64_REG(machInst, rt, rnsp, rm, type, s * 2);
753 return new LDRSW64_REG(machInst, rt, rnsp, rm, type, s * 2);
755 return new STRSFP64_REG(machInst, rt, rnsp, rm, type, s * 2);
757 return new LDRSFP64_REG(machInst, rt, rnsp, rm, type, s * 2);
759 return new STRX64_REG(machInst, rt, rnsp, rm, type, s * 3);
761 return new LDRX64_REG(machInst, rt, rnsp, rm, type, s * 3);
763 return new PRFM64_REG(machInst, rt, rnsp, rm, type, s * 3);
765 return new STRDFP64_REG(machInst, rt, rnsp, rm, type, s * 3);
767 return new LDRDFP64_REG(machInst, rt, rnsp, rm, type, s * 3);
769 return new Unknown64(machInst);
772 // bit 29:27=111, 25:24=00, 21=0
773 switch (bits(machInst, 11, 10)) {
777 (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
779 (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
780 IntRegIndex rnsp = makeSP(rn);
781 uint64_t imm = sext<9>(bits(machInst, 20, 12));
784 return new STURB64_IMM(machInst, rt, rnsp, imm);
786 return new LDURB64_IMM(machInst, rt, rnsp, imm);
788 return new LDURSBX64_IMM(machInst, rt, rnsp, imm);
790 return new LDURSBW64_IMM(machInst, rt, rnsp, imm);
792 return new STURBFP64_IMM(machInst, rt, rnsp, imm);
794 return new LDURBFP64_IMM(machInst, rt, rnsp, imm);
796 return new BigFpMemImm("stur", machInst, false,
799 return new BigFpMemImm("ldur", machInst, true,
802 return new STURH64_IMM(machInst, rt, rnsp, imm);
804 return new LDURH64_IMM(machInst, rt, rnsp, imm);
806 return new LDURSHX64_IMM(machInst, rt, rnsp, imm);
808 return new LDURSHW64_IMM(machInst, rt, rnsp, imm);
810 return new STURHFP64_IMM(machInst, rt, rnsp, imm);
812 return new LDURHFP64_IMM(machInst, rt, rnsp, imm);
814 return new STURW64_IMM(machInst, rt, rnsp, imm);
816 return new LDURW64_IMM(machInst, rt, rnsp, imm);
818 return new LDURSW64_IMM(machInst, rt, rnsp, imm);
820 return new STURSFP64_IMM(machInst, rt, rnsp, imm);
822 return new LDURSFP64_IMM(machInst, rt, rnsp, imm);
824 return new STURX64_IMM(machInst, rt, rnsp, imm);
826 return new LDURX64_IMM(machInst, rt, rnsp, imm);
828 return new PRFUM64_IMM(machInst, rt, rnsp, imm);
830 return new STURDFP64_IMM(machInst, rt, rnsp, imm);
832 return new LDURDFP64_IMM(machInst, rt, rnsp, imm);
834 return new Unknown64(machInst);
837 // bit 29:27=111, 25:24=00, 21=0, 11:10=01
841 (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
843 (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
844 IntRegIndex rnsp = makeSP(rn);
845 uint64_t imm = sext<9>(bits(machInst, 20, 12));
848 return new STRB64_POST(machInst, rt, rnsp, imm);
850 return new LDRB64_POST(machInst, rt, rnsp, imm);
852 return new LDRSBX64_POST(machInst, rt, rnsp, imm);
854 return new LDRSBW64_POST(machInst, rt, rnsp, imm);
856 return new STRBFP64_POST(machInst, rt, rnsp, imm);
858 return new LDRBFP64_POST(machInst, rt, rnsp, imm);
860 return new BigFpMemPost("str", machInst, false,
863 return new BigFpMemPost("ldr", machInst, true,
866 return new STRH64_POST(machInst, rt, rnsp, imm);
868 return new LDRH64_POST(machInst, rt, rnsp, imm);
870 return new LDRSHX64_POST(machInst, rt, rnsp, imm);
872 return new LDRSHW64_POST(machInst, rt, rnsp, imm);
874 return new STRHFP64_POST(machInst, rt, rnsp, imm);
876 return new LDRHFP64_POST(machInst, rt, rnsp, imm);
878 return new STRW64_POST(machInst, rt, rnsp, imm);
880 return new LDRW64_POST(machInst, rt, rnsp, imm);
882 return new LDRSW64_POST(machInst, rt, rnsp, imm);
884 return new STRSFP64_POST(machInst, rt, rnsp, imm);
886 return new LDRSFP64_POST(machInst, rt, rnsp, imm);
888 return new STRX64_POST(machInst, rt, rnsp, imm);
890 return new LDRX64_POST(machInst, rt, rnsp, imm);
892 return new STRDFP64_POST(machInst, rt, rnsp, imm);
894 return new LDRDFP64_POST(machInst, rt, rnsp, imm);
896 return new Unknown64(machInst);
902 (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
904 (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
905 IntRegIndex rnsp = makeSP(rn);
906 uint64_t imm = sext<9>(bits(machInst, 20, 12));
909 return new STTRB64_IMM(machInst, rt, rnsp, imm);
911 return new LDTRB64_IMM(machInst, rt, rnsp, imm);
913 return new LDTRSBX64_IMM(machInst, rt, rnsp, imm);
915 return new LDTRSBW64_IMM(machInst, rt, rnsp, imm);
917 return new STTRH64_IMM(machInst, rt, rnsp, imm);
919 return new LDTRH64_IMM(machInst, rt, rnsp, imm);
921 return new LDTRSHX64_IMM(machInst, rt, rnsp, imm);
923 return new LDTRSHW64_IMM(machInst, rt, rnsp, imm);
925 return new STTRW64_IMM(machInst, rt, rnsp, imm);
927 return new LDTRW64_IMM(machInst, rt, rnsp, imm);
929 return new LDTRSW64_IMM(machInst, rt, rnsp, imm);
931 return new STTRX64_IMM(machInst, rt, rnsp, imm);
933 return new LDTRX64_IMM(machInst, rt, rnsp, imm);
935 return new Unknown64(machInst);
941 (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
943 (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
944 IntRegIndex rnsp = makeSP(rn);
945 uint64_t imm = sext<9>(bits(machInst, 20, 12));
948 return new STRB64_PRE(machInst, rt, rnsp, imm);
950 return new LDRB64_PRE(machInst, rt, rnsp, imm);
952 return new LDRSBX64_PRE(machInst, rt, rnsp, imm);
954 return new LDRSBW64_PRE(machInst, rt, rnsp, imm);
956 return new STRBFP64_PRE(machInst, rt, rnsp, imm);
958 return new LDRBFP64_PRE(machInst, rt, rnsp, imm);
960 return new BigFpMemPre("str", machInst, false,
963 return new BigFpMemPre("ldr", machInst, true,
966 return new STRH64_PRE(machInst, rt, rnsp, imm);
968 return new LDRH64_PRE(machInst, rt, rnsp, imm);
970 return new LDRSHX64_PRE(machInst, rt, rnsp, imm);
972 return new LDRSHW64_PRE(machInst, rt, rnsp, imm);
974 return new STRHFP64_PRE(machInst, rt, rnsp, imm);
976 return new LDRHFP64_PRE(machInst, rt, rnsp, imm);
978 return new STRW64_PRE(machInst, rt, rnsp, imm);
980 return new LDRW64_PRE(machInst, rt, rnsp, imm);
982 return new LDRSW64_PRE(machInst, rt, rnsp, imm);
984 return new STRSFP64_PRE(machInst, rt, rnsp, imm);
986 return new LDRSFP64_PRE(machInst, rt, rnsp, imm);
988 return new STRX64_PRE(machInst, rt, rnsp, imm);
990 return new LDRX64_PRE(machInst, rt, rnsp, imm);
992 return new STRDFP64_PRE(machInst, rt, rnsp, imm);
994 return new LDRDFP64_PRE(machInst, rt, rnsp, imm);
996 return new Unknown64(machInst);
1003 return new FailUnimplemented("Unhandled Case1", machInst);
1012 decodeDataProcReg(ExtMachInst machInst)
1014 uint8_t switchVal = (bits(machInst, 28) << 1) |
1015 (bits(machInst, 24) << 0);
1016 switch (switchVal) {
1019 uint8_t switchVal = (bits(machInst, 21) << 0) |
1020 (bits(machInst, 30, 29) << 1);
1021 ArmShiftType type = (ArmShiftType)(uint8_t)bits(machInst, 23, 22);
1022 uint8_t imm6 = bits(machInst, 15, 10);
1023 bool sf = bits(machInst, 31);
1024 if (!sf && (imm6 & 0x20))
1025 return new Unknown64(machInst);
1026 IntRegIndex rd = (IntRegIndex)(uint8_t)bits(machInst, 4, 0);
1027 IntRegIndex rn = (IntRegIndex)(uint8_t)bits(machInst, 9, 5);
1028 IntRegIndex rm = (IntRegIndex)(uint8_t)bits(machInst, 20, 16);
1030 switch (switchVal) {
1032 return new AndXSReg(machInst, rd, rn, rm, imm6, type);
1034 return new BicXSReg(machInst, rd, rn, rm, imm6, type);
1036 return new OrrXSReg(machInst, rd, rn, rm, imm6, type);
1038 return new OrnXSReg(machInst, rd, rn, rm, imm6, type);
1040 return new EorXSReg(machInst, rd, rn, rm, imm6, type);
1042 return new EonXSReg(machInst, rd, rn, rm, imm6, type);
1044 return new AndXSRegCc(machInst, rd, rn, rm, imm6, type);
1046 return new BicXSRegCc(machInst, rd, rn, rm, imm6, type);
1051 uint8_t switchVal = bits(machInst, 30, 29);
1052 if (bits(machInst, 21) == 0) {
1054 (ArmShiftType)(uint8_t)bits(machInst, 23, 22);
1056 return new Unknown64(machInst);
1057 uint8_t imm6 = bits(machInst, 15, 10);
1058 if (!bits(machInst, 31) && bits(imm6, 5))
1059 return new Unknown64(machInst);
1060 IntRegIndex rd = (IntRegIndex)(uint8_t)bits(machInst, 4, 0);
1061 IntRegIndex rn = (IntRegIndex)(uint8_t)bits(machInst, 9, 5);
1062 IntRegIndex rm = (IntRegIndex)(uint8_t)bits(machInst, 20, 16);
1063 switch (switchVal) {
1065 return new AddXSReg(machInst, rd, rn, rm, imm6, type);
1067 return new AddXSRegCc(machInst, rd, rn, rm, imm6, type);
1069 return new SubXSReg(machInst, rd, rn, rm, imm6, type);
1071 return new SubXSRegCc(machInst, rd, rn, rm, imm6, type);
1074 if (bits(machInst, 23, 22) != 0 || bits(machInst, 12, 10) > 0x4)
1075 return new Unknown64(machInst);
1076 ArmExtendType type =
1077 (ArmExtendType)(uint8_t)bits(machInst, 15, 13);
1078 uint8_t imm3 = bits(machInst, 12, 10);
1079 IntRegIndex rd = (IntRegIndex)(uint8_t)bits(machInst, 4, 0);
1080 IntRegIndex rdsp = makeSP(rd);
1081 IntRegIndex rn = (IntRegIndex)(uint8_t)bits(machInst, 9, 5);
1082 IntRegIndex rnsp = makeSP(rn);
1083 IntRegIndex rm = (IntRegIndex)(uint8_t)bits(machInst, 20, 16);
1085 switch (switchVal) {
1087 return new AddXEReg(machInst, rdsp, rnsp, rm, type, imm3);
1089 return new AddXERegCc(machInst, rd, rnsp, rm, type, imm3);
1091 return new SubXEReg(machInst, rdsp, rnsp, rm, type, imm3);
1093 return new SubXERegCc(machInst, rd, rnsp, rm, type, imm3);
1099 if (bits(machInst, 21) == 1)
1100 return new Unknown64(machInst);
1101 IntRegIndex rd = (IntRegIndex)(uint8_t)bits(machInst, 4, 0);
1102 IntRegIndex rn = (IntRegIndex)(uint8_t)bits(machInst, 9, 5);
1103 IntRegIndex rm = (IntRegIndex)(uint8_t)bits(machInst, 20, 16);
1104 switch (bits(machInst, 23, 22)) {
1107 if (bits(machInst, 15, 10))
1108 return new Unknown64(machInst);
1109 uint8_t switchVal = bits(machInst, 30, 29);
1110 switch (switchVal) {
1112 return new AdcXSReg(machInst, rd, rn, rm, 0, LSL);
1114 return new AdcXSRegCc(machInst, rd, rn, rm, 0, LSL);
1116 return new SbcXSReg(machInst, rd, rn, rm, 0, LSL);
1118 return new SbcXSRegCc(machInst, rd, rn, rm, 0, LSL);
1123 if ((bits(machInst, 4) == 1) ||
1124 (bits(machInst, 10) == 1) ||
1125 (bits(machInst, 29) == 0)) {
1126 return new Unknown64(machInst);
1128 ConditionCode cond =
1129 (ConditionCode)(uint8_t)bits(machInst, 15, 12);
1130 uint8_t flags = bits(machInst, 3, 0);
1131 IntRegIndex rn = (IntRegIndex)(uint8_t)bits(machInst, 9, 5);
1132 if (bits(machInst, 11) == 0) {
1134 (IntRegIndex)(uint8_t)bits(machInst, 20, 16);
1135 if (bits(machInst, 30) == 0) {
1136 return new CcmnReg64(machInst, rn, rm, cond, flags);
1138 return new CcmpReg64(machInst, rn, rm, cond, flags);
1141 uint8_t imm5 = bits(machInst, 20, 16);
1142 if (bits(machInst, 30) == 0) {
1143 return new CcmnImm64(machInst, rn, imm5, cond, flags);
1145 return new CcmpImm64(machInst, rn, imm5, cond, flags);
1151 if (bits(machInst, 29) == 1 ||
1152 bits(machInst, 11) == 1) {
1153 return new Unknown64(machInst);
1155 uint8_t switchVal = (bits(machInst, 10) << 0) |
1156 (bits(machInst, 30) << 1);
1157 IntRegIndex rd = (IntRegIndex)(uint8_t)bits(machInst, 4, 0);
1158 IntRegIndex rn = (IntRegIndex)(uint8_t)bits(machInst, 9, 5);
1159 IntRegIndex rm = (IntRegIndex)(uint8_t)bits(machInst, 20, 16);
1160 ConditionCode cond =
1161 (ConditionCode)(uint8_t)bits(machInst, 15, 12);
1162 switch (switchVal) {
1164 return new Csel64(machInst, rd, rn, rm, cond);
1166 return new Csinc64(machInst, rd, rn, rm, cond);
1168 return new Csinv64(machInst, rd, rn, rm, cond);
1170 return new Csneg64(machInst, rd, rn, rm, cond);
1174 if (bits(machInst, 30) == 0) {
1175 if (bits(machInst, 29) != 0)
1176 return new Unknown64(machInst);
1177 uint8_t switchVal = bits(machInst, 15, 10);
1178 switch (switchVal) {
1180 return new Udiv64(machInst, rd, rn, rm);
1182 return new Sdiv64(machInst, rd, rn, rm);
1184 return new Lslv64(machInst, rd, rn, rm);
1186 return new Lsrv64(machInst, rd, rn, rm);
1188 return new Asrv64(machInst, rd, rn, rm);
1190 return new Rorv64(machInst, rd, rn, rm);
1192 return new Unknown64(machInst);
1195 if (bits(machInst, 20, 16) != 0 ||
1196 bits(machInst, 29) != 0) {
1197 return new Unknown64(machInst);
1199 uint8_t switchVal = bits(machInst, 15, 10);
1200 switch (switchVal) {
1202 return new Rbit64(machInst, rd, rn);
1204 return new Rev1664(machInst, rd, rn);
1206 if (bits(machInst, 31) == 0)
1207 return new Rev64(machInst, rd, rn);
1209 return new Rev3264(machInst, rd, rn);
1211 if (bits(machInst, 31) != 1)
1212 return new Unknown64(machInst);
1213 return new Rev64(machInst, rd, rn);
1215 return new Clz64(machInst, rd, rn);
1217 return new Cls64(machInst, rd, rn);
1224 if (bits(machInst, 30, 29) != 0x0 ||
1225 (bits(machInst, 23, 21) != 0 && bits(machInst, 31) == 0))
1226 return new Unknown64(machInst);
1227 IntRegIndex rd = (IntRegIndex)(uint8_t)bits(machInst, 4, 0);
1228 IntRegIndex rn = (IntRegIndex)(uint8_t)bits(machInst, 9, 5);
1229 IntRegIndex ra = (IntRegIndex)(uint8_t)bits(machInst, 14, 10);
1230 IntRegIndex rm = (IntRegIndex)(uint8_t)bits(machInst, 20, 16);
1231 switch (bits(machInst, 23, 21)) {
1233 if (bits(machInst, 15) == 0)
1234 return new Madd64(machInst, rd, ra, rn, rm);
1236 return new Msub64(machInst, rd, ra, rn, rm);
1238 if (bits(machInst, 15) == 0)
1239 return new Smaddl64(machInst, rd, ra, rn, rm);
1241 return new Smsubl64(machInst, rd, ra, rn, rm);
1243 if (bits(machInst, 15) != 0)
1244 return new Unknown64(machInst);
1245 return new Smulh64(machInst, rd, rn, rm);
1247 if (bits(machInst, 15) == 0)
1248 return new Umaddl64(machInst, rd, ra, rn, rm);
1250 return new Umsubl64(machInst, rd, ra, rn, rm);
1252 if (bits(machInst, 15) != 0)
1253 return new Unknown64(machInst);
1254 return new Umulh64(machInst, rd, rn, rm);
1256 return new Unknown64(machInst);
1260 return new FailUnimplemented("Unhandled Case2", machInst);
1269 decodeAdvSIMD(ExtMachInst machInst)
1271 if (bits(machInst, 24) == 1) {
1272 if (bits(machInst, 10) == 0) {
1273 return decodeNeonIndexedElem(machInst);
1274 } else if (bits(machInst, 23) == 1) {
1275 return new Unknown64(machInst);
1277 if (bits(machInst, 22, 19)) {
1278 return decodeNeonShiftByImm(machInst);
1280 return decodeNeonModImm(machInst);
1283 } else if (bits(machInst, 21) == 1) {
1284 if (bits(machInst, 10) == 1) {
1285 return decodeNeon3Same(machInst);
1286 } else if (bits(machInst, 11) == 0) {
1287 return decodeNeon3Diff(machInst);
1288 } else if (bits(machInst, 20, 17) == 0x0) {
1289 return decodeNeon2RegMisc(machInst);
1290 } else if (bits(machInst, 20, 17) == 0x8) {
1291 return decodeNeonAcrossLanes(machInst);
1293 return new Unknown64(machInst);
1295 } else if (bits(machInst, 24) ||
1296 bits(machInst, 21) ||
1297 bits(machInst, 15)) {
1298 return new Unknown64(machInst);
1299 } else if (bits(machInst, 10) == 1) {
1300 if (bits(machInst, 23, 22))
1301 return new Unknown64(machInst);
1302 return decodeNeonCopy(machInst);
1303 } else if (bits(machInst, 29) == 1) {
1304 return decodeNeonExt(machInst);
1305 } else if (bits(machInst, 11) == 1) {
1306 return decodeNeonZipUzpTrn(machInst);
1307 } else if (bits(machInst, 23, 22) == 0x0) {
1308 return decodeNeonTblTbx(machInst);
1310 return new Unknown64(machInst);
1312 return new FailUnimplemented("Unhandled Case3", machInst);
1322 // bit 30=0, 28:25=1111
1323 decodeFp(ExtMachInst machInst)
1325 if (bits(machInst, 24) == 1) {
1326 if (bits(machInst, 31) || bits(machInst, 29))
1327 return new Unknown64(machInst);
1328 IntRegIndex rd = (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
1329 IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
1330 IntRegIndex rm = (IntRegIndex)(uint32_t)bits(machInst, 20, 16);
1331 IntRegIndex ra = (IntRegIndex)(uint32_t)bits(machInst, 14, 10);
1332 uint8_t switchVal = (bits(machInst, 23, 21) << 1) |
1333 (bits(machInst, 15) << 0);
1334 switch (switchVal) {
1335 case 0x0: // FMADD Sd = Sa + Sn*Sm
1336 return new FMAddS(machInst, rd, rn, rm, ra);
1337 case 0x1: // FMSUB Sd = Sa + (-Sn)*Sm
1338 return new FMSubS(machInst, rd, rn, rm, ra);
1339 case 0x2: // FNMADD Sd = (-Sa) + (-Sn)*Sm
1340 return new FNMAddS(machInst, rd, rn, rm, ra);
1341 case 0x3: // FNMSUB Sd = (-Sa) + Sn*Sm
1342 return new FNMSubS(machInst, rd, rn, rm, ra);
1343 case 0x4: // FMADD Dd = Da + Dn*Dm
1344 return new FMAddD(machInst, rd, rn, rm, ra);
1345 case 0x5: // FMSUB Dd = Da + (-Dn)*Dm
1346 return new FMSubD(machInst, rd, rn, rm, ra);
1347 case 0x6: // FNMADD Dd = (-Da) + (-Dn)*Dm
1348 return new FNMAddD(machInst, rd, rn, rm, ra);
1349 case 0x7: // FNMSUB Dd = (-Da) + Dn*Dm
1350 return new FNMSubD(machInst, rd, rn, rm, ra);
1352 return new Unknown64(machInst);
1354 } else if (bits(machInst, 21) == 0) {
1355 bool s = bits(machInst, 29);
1357 return new Unknown64(machInst);
1358 uint8_t switchVal = bits(machInst, 20, 16);
1359 uint8_t type = bits(machInst, 23, 22);
1360 uint8_t scale = bits(machInst, 15, 10);
1361 IntRegIndex rd = (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
1362 IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
1363 if (bits(machInst, 18, 17) == 3 && scale != 0)
1364 return new Unknown64(machInst);
1365 // 30:24=0011110, 21=0
1366 switch (switchVal) {
1368 return new FailUnimplemented("fcvtns", machInst);
1370 return new FailUnimplemented("fcvtnu", machInst);
1372 switch ( (bits(machInst, 31) << 2) | type ) {
1373 case 0: // SCVTF Sd = convertFromInt(Wn/(2^fbits))
1374 return new FcvtSFixedFpSW(machInst, rd, rn, scale);
1375 case 1: // SCVTF Dd = convertFromInt(Wn/(2^fbits))
1376 return new FcvtSFixedFpDW(machInst, rd, rn, scale);
1377 case 4: // SCVTF Sd = convertFromInt(Xn/(2^fbits))
1378 return new FcvtSFixedFpSX(machInst, rd, rn, scale);
1379 case 5: // SCVTF Dd = convertFromInt(Xn/(2^fbits))
1380 return new FcvtSFixedFpDX(machInst, rd, rn, scale);
1382 return new Unknown64(machInst);
1385 switch ( (bits(machInst, 31) << 2) | type ) {
1386 case 0: // UCVTF Sd = convertFromInt(Wn/(2^fbits))
1387 return new FcvtUFixedFpSW(machInst, rd, rn, scale);
1388 case 1: // UCVTF Dd = convertFromInt(Wn/(2^fbits))
1389 return new FcvtUFixedFpDW(machInst, rd, rn, scale);
1390 case 4: // UCVTF Sd = convertFromInt(Xn/(2^fbits))
1391 return new FcvtUFixedFpSX(machInst, rd, rn, scale);
1392 case 5: // UCVTF Dd = convertFromInt(Xn/(2^fbits))
1393 return new FcvtUFixedFpDX(machInst, rd, rn, scale);
1395 return new Unknown64(machInst);
1398 return new FailUnimplemented("fcvtas", machInst);
1400 return new FailUnimplemented("fcvtau", machInst);
1402 return new FailUnimplemented("fcvtps", machInst);
1404 return new FailUnimplemented("fcvtpu", machInst);
1406 return new FailUnimplemented("fmov elem. to 64", machInst);
1408 return new FailUnimplemented("fmov 64 bit", machInst);
1410 return new FailUnimplemented("fcvtms", machInst);
1412 return new FailUnimplemented("fcvtmu", machInst);
1414 switch ( (bits(machInst, 31) << 2) | type ) {
1415 case 0: // FCVTZS Wd = convertToIntExactTowardZero(Sn*(2^fbits))
1416 return new FcvtFpSFixedSW(machInst, rd, rn, scale);
1417 case 1: // FCVTZS Wd = convertToIntExactTowardZero(Dn*(2^fbits))
1418 return new FcvtFpSFixedDW(machInst, rd, rn, scale);
1419 case 4: // FCVTZS Xd = convertToIntExactTowardZero(Sn*(2^fbits))
1420 return new FcvtFpSFixedSX(machInst, rd, rn, scale);
1421 case 5: // FCVTZS Xd = convertToIntExactTowardZero(Dn*(2^fbits))
1422 return new FcvtFpSFixedDX(machInst, rd, rn, scale);
1424 return new Unknown64(machInst);
1427 switch ( (bits(machInst, 31) << 2) | type ) {
1428 case 0: // FCVTZU Wd = convertToIntExactTowardZero(Sn*(2^fbits))
1429 return new FcvtFpUFixedSW(machInst, rd, rn, scale);
1430 case 1: // FCVTZU Wd = convertToIntExactTowardZero(Dn*(2^fbits))
1431 return new FcvtFpUFixedDW(machInst, rd, rn, scale);
1432 case 4: // FCVTZU Xd = convertToIntExactTowardZero(Sn*(2^fbits))
1433 return new FcvtFpUFixedSX(machInst, rd, rn, scale);
1434 case 5: // FCVTZU Xd = convertToIntExactTowardZero(Dn*(2^fbits))
1435 return new FcvtFpUFixedDX(machInst, rd, rn, scale);
1437 return new Unknown64(machInst);
1441 // 30=0, 28:24=11110, 21=1
1442 uint8_t type = bits(machInst, 23, 22);
1443 uint8_t imm8 = bits(machInst, 20, 13);
1444 IntRegIndex rd = (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
1445 IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
1446 switch (bits(machInst, 11, 10)) {
1448 if (bits(machInst, 12) == 1) {
1449 if (bits(machInst, 31) ||
1450 bits(machInst, 29) ||
1451 bits(machInst, 9, 5)) {
1452 return new Unknown64(machInst);
1454 // 31:29=000, 28:24=11110, 21=1, 12:10=100
1456 // FMOV S[d] = imm8<7>:NOT(imm8<6>):Replicate(imm8<6>,5)
1457 // :imm8<5:0>:Zeros(19)
1458 uint32_t imm = vfp_modified_imm(imm8, false);
1459 return new FmovImmS(machInst, rd, imm);
1460 } else if (type == 1) {
1461 // FMOV D[d] = imm8<7>:NOT(imm8<6>):Replicate(imm8<6>,8)
1462 // :imm8<5:0>:Zeros(48)
1463 uint64_t imm = vfp_modified_imm(imm8, true);
1464 return new FmovImmD(machInst, rd, imm);
1466 return new Unknown64(machInst);
1468 } else if (bits(machInst, 13) == 1) {
1469 if (bits(machInst, 31) ||
1470 bits(machInst, 29) ||
1471 bits(machInst, 15, 14) ||
1472 bits(machInst, 23) ||
1473 bits(machInst, 2, 0)) {
1474 return new Unknown64(machInst);
1476 uint8_t switchVal = (bits(machInst, 4, 3) << 0) |
1477 (bits(machInst, 22) << 2);
1478 IntRegIndex rm = (IntRegIndex)(uint32_t)
1479 bits(machInst, 20, 16);
1480 // 28:23=000111100, 21=1, 15:10=001000, 2:0=000
1481 switch (switchVal) {
1483 // FCMP flags = compareQuiet(Sn,Sm)
1484 return new FCmpRegS(machInst, rn, rm);
1486 // FCMP flags = compareQuiet(Sn,0.0)
1487 return new FCmpImmS(machInst, rn, 0);
1489 // FCMPE flags = compareSignaling(Sn,Sm)
1490 return new FCmpERegS(machInst, rn, rm);
1492 // FCMPE flags = compareSignaling(Sn,0.0)
1493 return new FCmpEImmS(machInst, rn, 0);
1495 // FCMP flags = compareQuiet(Dn,Dm)
1496 return new FCmpRegD(machInst, rn, rm);
1498 // FCMP flags = compareQuiet(Dn,0.0)
1499 return new FCmpImmD(machInst, rn, 0);
1501 // FCMPE flags = compareSignaling(Dn,Dm)
1502 return new FCmpERegD(machInst, rn, rm);
1504 // FCMPE flags = compareSignaling(Dn,0.0)
1505 return new FCmpEImmD(machInst, rn, 0);
1507 return new Unknown64(machInst);
1509 } else if (bits(machInst, 14) == 1) {
1510 if (bits(machInst, 31) || bits(machInst, 29))
1511 return new Unknown64(machInst);
1512 uint8_t opcode = bits(machInst, 20, 15);
1513 // Bits 31:24=00011110, 21=1, 14:10=10000
1518 return new FmovRegS(machInst, rd, rn);
1521 return new FmovRegD(machInst, rd, rn);
1525 // FABS Sd = abs(Sn)
1526 return new FAbsS(machInst, rd, rn);
1528 // FABS Dd = abs(Dn)
1529 return new FAbsD(machInst, rd, rn);
1534 return new FNegS(machInst, rd, rn);
1537 return new FNegD(machInst, rd, rn);
1541 // FSQRT Sd = sqrt(Sn)
1542 return new FSqrtS(machInst, rd, rn);
1544 // FSQRT Dd = sqrt(Dn)
1545 return new FSqrtD(machInst, rd, rn);
1549 // FCVT Sd = convertFormat(Dn)
1550 return new FcvtFpDFpS(machInst, rd, rn);
1552 // FCVT Sd = convertFormat(Hn)
1553 return new FcvtFpHFpS(machInst, rd, rn);
1557 // FCVT Dd = convertFormat(Sn)
1558 return new FCvtFpSFpD(machInst, rd, rn);
1560 // FCVT Dd = convertFormat(Hn)
1561 return new FcvtFpHFpD(machInst, rd, rn);
1565 // FCVT Hd = convertFormat(Sn)
1566 return new FcvtFpSFpH(machInst, rd, rn);
1568 // FCVT Hd = convertFormat(Dn)
1569 return new FcvtFpDFpH(machInst, rd, rn);
1572 if (type == 0) // FRINTN Sd = roundToIntegralTiesToEven(Sn)
1573 return new FRIntNS(machInst, rd, rn);
1574 else if (type == 1) // FRINTN Dd = roundToIntegralTiesToEven(Dn)
1575 return new FRIntND(machInst, rd, rn);
1578 if (type == 0) // FRINTP Sd = roundToIntegralTowardPlusInf(Sn)
1579 return new FRIntPS(machInst, rd, rn);
1580 else if (type == 1) // FRINTP Dd = roundToIntegralTowardPlusInf(Dn)
1581 return new FRIntPD(machInst, rd, rn);
1584 if (type == 0) // FRINTM Sd = roundToIntegralTowardMinusInf(Sn)
1585 return new FRIntMS(machInst, rd, rn);
1586 else if (type == 1) // FRINTM Dd = roundToIntegralTowardMinusInf(Dn)
1587 return new FRIntMD(machInst, rd, rn);
1590 if (type == 0) // FRINTZ Sd = roundToIntegralTowardZero(Sn)
1591 return new FRIntZS(machInst, rd, rn);
1592 else if (type == 1) // FRINTZ Dd = roundToIntegralTowardZero(Dn)
1593 return new FRIntZD(machInst, rd, rn);
1596 if (type == 0) // FRINTA Sd = roundToIntegralTiesToAway(Sn)
1597 return new FRIntAS(machInst, rd, rn);
1598 else if (type == 1) // FRINTA Dd = roundToIntegralTiesToAway(Dn)
1599 return new FRIntAD(machInst, rd, rn);
1602 if (type == 0) // FRINTX Sd = roundToIntegralExact(Sn)
1603 return new FRIntXS(machInst, rd, rn);
1604 else if (type == 1) // FRINTX Dd = roundToIntegralExact(Dn)
1605 return new FRIntXD(machInst, rd, rn);
1608 if (type == 0) // FRINTI Sd = roundToIntegral(Sn)
1609 return new FRIntIS(machInst, rd, rn);
1610 else if (type == 1) // FRINTI Dd = roundToIntegral(Dn)
1611 return new FRIntID(machInst, rd, rn);
1614 return new Unknown64(machInst);
1616 return new Unknown64(machInst);
1617 } else if (bits(machInst, 15) == 1) {
1618 return new Unknown64(machInst);
1620 if (bits(machInst, 29))
1621 return new Unknown64(machInst);
1622 uint8_t rmode = bits(machInst, 20, 19);
1623 uint8_t switchVal1 = bits(machInst, 18, 16);
1624 uint8_t switchVal2 = (type << 1) | bits(machInst, 31);
1625 // 30:24=0011110, 21=1, 15:10=000000
1626 switch (switchVal1) {
1628 switch ((switchVal2 << 2) | rmode) {
1629 case 0x0: //FCVTNS Wd = convertToIntExactTiesToEven(Sn)
1630 return new FcvtFpSIntWSN(machInst, rd, rn);
1631 case 0x1: //FCVTPS Wd = convertToIntExactTowardPlusInf(Sn)
1632 return new FcvtFpSIntWSP(machInst, rd, rn);
1633 case 0x2: //FCVTMS Wd = convertToIntExactTowardMinusInf(Sn)
1634 return new FcvtFpSIntWSM(machInst, rd, rn);
1635 case 0x3: //FCVTZS Wd = convertToIntExactTowardZero(Sn)
1636 return new FcvtFpSIntWSZ(machInst, rd, rn);
1637 case 0x4: //FCVTNS Xd = convertToIntExactTiesToEven(Sn)
1638 return new FcvtFpSIntXSN(machInst, rd, rn);
1639 case 0x5: //FCVTPS Xd = convertToIntExactTowardPlusInf(Sn)
1640 return new FcvtFpSIntXSP(machInst, rd, rn);
1641 case 0x6: //FCVTMS Xd = convertToIntExactTowardMinusInf(Sn)
1642 return new FcvtFpSIntXSM(machInst, rd, rn);
1643 case 0x7: //FCVTZS Xd = convertToIntExactTowardZero(Sn)
1644 return new FcvtFpSIntXSZ(machInst, rd, rn);
1645 case 0x8: //FCVTNS Wd = convertToIntExactTiesToEven(Dn)
1646 return new FcvtFpSIntWDN(machInst, rd, rn);
1647 case 0x9: //FCVTPS Wd = convertToIntExactTowardPlusInf(Dn)
1648 return new FcvtFpSIntWDP(machInst, rd, rn);
1649 case 0xA: //FCVTMS Wd = convertToIntExactTowardMinusInf(Dn)
1650 return new FcvtFpSIntWDM(machInst, rd, rn);
1651 case 0xB: //FCVTZS Wd = convertToIntExactTowardZero(Dn)
1652 return new FcvtFpSIntWDZ(machInst, rd, rn);
1653 case 0xC: //FCVTNS Xd = convertToIntExactTiesToEven(Dn)
1654 return new FcvtFpSIntXDN(machInst, rd, rn);
1655 case 0xD: //FCVTPS Xd = convertToIntExactTowardPlusInf(Dn)
1656 return new FcvtFpSIntXDP(machInst, rd, rn);
1657 case 0xE: //FCVTMS Xd = convertToIntExactTowardMinusInf(Dn)
1658 return new FcvtFpSIntXDM(machInst, rd, rn);
1659 case 0xF: //FCVTZS Xd = convertToIntExactTowardZero(Dn)
1660 return new FcvtFpSIntXDZ(machInst, rd, rn);
1662 return new Unknown64(machInst);
1665 switch ((switchVal2 << 2) | rmode) {
1666 case 0x0: //FCVTNU Wd = convertToIntExactTiesToEven(Sn)
1667 return new FcvtFpUIntWSN(machInst, rd, rn);
1668 case 0x1: //FCVTPU Wd = convertToIntExactTowardPlusInf(Sn)
1669 return new FcvtFpUIntWSP(machInst, rd, rn);
1670 case 0x2: //FCVTMU Wd = convertToIntExactTowardMinusInf(Sn)
1671 return new FcvtFpUIntWSM(machInst, rd, rn);
1672 case 0x3: //FCVTZU Wd = convertToIntExactTowardZero(Sn)
1673 return new FcvtFpUIntWSZ(machInst, rd, rn);
1674 case 0x4: //FCVTNU Xd = convertToIntExactTiesToEven(Sn)
1675 return new FcvtFpUIntXSN(machInst, rd, rn);
1676 case 0x5: //FCVTPU Xd = convertToIntExactTowardPlusInf(Sn)
1677 return new FcvtFpUIntXSP(machInst, rd, rn);
1678 case 0x6: //FCVTMU Xd = convertToIntExactTowardMinusInf(Sn)
1679 return new FcvtFpUIntXSM(machInst, rd, rn);
1680 case 0x7: //FCVTZU Xd = convertToIntExactTowardZero(Sn)
1681 return new FcvtFpUIntXSZ(machInst, rd, rn);
1682 case 0x8: //FCVTNU Wd = convertToIntExactTiesToEven(Dn)
1683 return new FcvtFpUIntWDN(machInst, rd, rn);
1684 case 0x9: //FCVTPU Wd = convertToIntExactTowardPlusInf(Dn)
1685 return new FcvtFpUIntWDP(machInst, rd, rn);
1686 case 0xA: //FCVTMU Wd = convertToIntExactTowardMinusInf(Dn)
1687 return new FcvtFpUIntWDM(machInst, rd, rn);
1688 case 0xB: //FCVTZU Wd = convertToIntExactTowardZero(Dn)
1689 return new FcvtFpUIntWDZ(machInst, rd, rn);
1690 case 0xC: //FCVTNU Xd = convertToIntExactTiesToEven(Dn)
1691 return new FcvtFpUIntXDN(machInst, rd, rn);
1692 case 0xD: //FCVTPU Xd = convertToIntExactTowardPlusInf(Dn)
1693 return new FcvtFpUIntXDP(machInst, rd, rn);
1694 case 0xE: //FCVTMU Xd = convertToIntExactTowardMinusInf(Dn)
1695 return new FcvtFpUIntXDM(machInst, rd, rn);
1696 case 0xF: //FCVTZU Xd = convertToIntExactTowardZero(Dn)
1697 return new FcvtFpUIntXDZ(machInst, rd, rn);
1699 return new Unknown64(machInst);
1703 return new Unknown64(machInst);
1704 switch (switchVal2) {
1705 case 0: // SCVTF Sd = convertFromInt(Wn)
1706 return new FcvtWSIntFpS(machInst, rd, rn);
1707 case 1: // SCVTF Sd = convertFromInt(Xn)
1708 return new FcvtXSIntFpS(machInst, rd, rn);
1709 case 2: // SCVTF Dd = convertFromInt(Wn)
1710 return new FcvtWSIntFpD(machInst, rd, rn);
1711 case 3: // SCVTF Dd = convertFromInt(Xn)
1712 return new FcvtXSIntFpD(machInst, rd, rn);
1714 return new Unknown64(machInst);
1717 switch (switchVal2) {
1718 case 0: // UCVTF Sd = convertFromInt(Wn)
1719 return new FcvtWUIntFpS(machInst, rd, rn);
1720 case 1: // UCVTF Sd = convertFromInt(Xn)
1721 return new FcvtXUIntFpS(machInst, rd, rn);
1722 case 2: // UCVTF Dd = convertFromInt(Wn)
1723 return new FcvtWUIntFpD(machInst, rd, rn);
1724 case 3: // UCVTF Dd = convertFromInt(Xn)
1725 return new FcvtXUIntFpD(machInst, rd, rn);
1727 return new Unknown64(machInst);
1731 return new Unknown64(machInst);
1732 switch (switchVal2) {
1733 case 0: // FCVTAS Wd = convertToIntExactTiesToAway(Sn)
1734 return new FcvtFpSIntWSA(machInst, rd, rn);
1735 case 1: // FCVTAS Xd = convertToIntExactTiesToAway(Sn)
1736 return new FcvtFpSIntXSA(machInst, rd, rn);
1737 case 2: // FCVTAS Wd = convertToIntExactTiesToAway(Dn)
1738 return new FcvtFpSIntWDA(machInst, rd, rn);
1739 case 3: // FCVTAS Wd = convertToIntExactTiesToAway(Dn)
1740 return new FcvtFpSIntXDA(machInst, rd, rn);
1742 return new Unknown64(machInst);
1745 switch (switchVal2) {
1746 case 0: // FCVTAU Wd = convertToIntExactTiesToAway(Sn)
1747 return new FcvtFpUIntWSA(machInst, rd, rn);
1748 case 1: // FCVTAU Xd = convertToIntExactTiesToAway(Sn)
1749 return new FcvtFpUIntXSA(machInst, rd, rn);
1750 case 2: // FCVTAU Wd = convertToIntExactTiesToAway(Dn)
1751 return new FcvtFpUIntWDA(machInst, rd, rn);
1752 case 3: // FCVTAU Xd = convertToIntExactTiesToAway(Dn)
1753 return new FcvtFpUIntXDA(machInst, rd, rn);
1755 return new Unknown64(machInst);
1758 switch (switchVal2) {
1759 case 0: // FMOV Wd = Sn
1761 return new Unknown64(machInst);
1762 return new FmovRegCoreW(machInst, rd, rn);
1763 case 3: // FMOV Xd = Dn
1765 return new Unknown64(machInst);
1766 return new FmovRegCoreX(machInst, rd, rn);
1767 case 5: // FMOV Xd = Vn<127:64>
1769 return new Unknown64(machInst);
1770 return new FmovURegCoreX(machInst, rd, rn);
1772 return new Unknown64(machInst);
1776 switch (switchVal2) {
1777 case 0: // FMOV Sd = Wn
1779 return new Unknown64(machInst);
1780 return new FmovCoreRegW(machInst, rd, rn);
1781 case 3: // FMOV Xd = Dn
1783 return new Unknown64(machInst);
1784 return new FmovCoreRegX(machInst, rd, rn);
1785 case 5: // FMOV Xd = Vn<127:64>
1787 return new Unknown64(machInst);
1788 return new FmovUCoreRegX(machInst, rd, rn);
1790 return new Unknown64(machInst);
1793 default: // Warning! missing cases in switch statement above, that still need to be added
1794 return new Unknown64(machInst);
1799 if (bits(machInst, 31) ||
1800 bits(machInst, 29) ||
1801 bits(machInst, 23)) {
1802 return new Unknown64(machInst);
1804 IntRegIndex rm = (IntRegIndex)(uint32_t) bits(machInst, 20, 16);
1805 IntRegIndex rn = (IntRegIndex)(uint32_t) bits(machInst, 9, 5);
1806 uint8_t imm = (IntRegIndex)(uint32_t) bits(machInst, 3, 0);
1807 ConditionCode cond =
1808 (ConditionCode)(uint8_t)(bits(machInst, 15, 12));
1809 uint8_t switchVal = (bits(machInst, 4) << 0) |
1810 (bits(machInst, 22) << 1);
1811 // 31:23=000111100, 21=1, 11:10=01
1812 switch (switchVal) {
1814 // FCCMP flags = if cond the compareQuiet(Sn,Sm) else #nzcv
1815 return new FCCmpRegS(machInst, rn, rm, cond, imm);
1817 // FCCMP flags = if cond then compareSignaling(Sn,Sm)
1819 return new FCCmpERegS(machInst, rn, rm, cond, imm);
1821 // FCCMP flags = if cond then compareQuiet(Dn,Dm) else #nzcv
1822 return new FCCmpRegD(machInst, rn, rm, cond, imm);
1824 // FCCMP flags = if cond then compareSignaling(Dn,Dm)
1826 return new FCCmpERegD(machInst, rn, rm, cond, imm);
1828 return new Unknown64(machInst);
1833 if (bits(machInst, 31) ||
1834 bits(machInst, 29) ||
1835 bits(machInst, 23)) {
1836 return new Unknown64(machInst);
1838 IntRegIndex rd = (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
1839 IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
1840 IntRegIndex rm = (IntRegIndex)(uint32_t)bits(machInst, 20, 16);
1841 uint8_t switchVal = (bits(machInst, 15, 12) << 0) |
1842 (bits(machInst, 22) << 4);
1843 switch (switchVal) {
1844 case 0x00: // FMUL Sd = Sn * Sm
1845 return new FMulS(machInst, rd, rn, rm);
1846 case 0x10: // FMUL Dd = Dn * Dm
1847 return new FMulD(machInst, rd, rn, rm);
1848 case 0x01: // FDIV Sd = Sn / Sm
1849 return new FDivS(machInst, rd, rn, rm);
1850 case 0x11: // FDIV Dd = Dn / Dm
1851 return new FDivD(machInst, rd, rn, rm);
1852 case 0x02: // FADD Sd = Sn + Sm
1853 return new FAddS(machInst, rd, rn, rm);
1854 case 0x12: // FADD Dd = Dn + Dm
1855 return new FAddD(machInst, rd, rn, rm);
1856 case 0x03: // FSUB Sd = Sn - Sm
1857 return new FSubS(machInst, rd, rn, rm);
1858 case 0x13: // FSUB Dd = Dn - Dm
1859 return new FSubD(machInst, rd, rn, rm);
1860 case 0x04: // FMAX Sd = max(Sn, Sm)
1861 return new FMaxS(machInst, rd, rn, rm);
1862 case 0x14: // FMAX Dd = max(Dn, Dm)
1863 return new FMaxD(machInst, rd, rn, rm);
1864 case 0x05: // FMIN Sd = min(Sn, Sm)
1865 return new FMinS(machInst, rd, rn, rm);
1866 case 0x15: // FMIN Dd = min(Dn, Dm)
1867 return new FMinD(machInst, rd, rn, rm);
1868 case 0x06: // FMAXNM Sd = maxNum(Sn, Sm)
1869 return new FMaxNMS(machInst, rd, rn, rm);
1870 case 0x16: // FMAXNM Dd = maxNum(Dn, Dm)
1871 return new FMaxNMD(machInst, rd, rn, rm);
1872 case 0x07: // FMINNM Sd = minNum(Sn, Sm)
1873 return new FMinNMS(machInst, rd, rn, rm);
1874 case 0x17: // FMINNM Dd = minNum(Dn, Dm)
1875 return new FMinNMD(machInst, rd, rn, rm);
1876 case 0x08: // FNMUL Sd = -(Sn * Sm)
1877 return new FNMulS(machInst, rd, rn, rm);
1878 case 0x18: // FNMUL Dd = -(Dn * Dm)
1879 return new FNMulD(machInst, rd, rn, rm);
1881 return new Unknown64(machInst);
1886 if (bits(machInst, 31) || bits(machInst, 29))
1887 return new Unknown64(machInst);
1888 uint8_t type = bits(machInst, 23, 22);
1889 IntRegIndex rd = (IntRegIndex)(uint32_t)bits(machInst, 4, 0);
1890 IntRegIndex rn = (IntRegIndex)(uint32_t)bits(machInst, 9, 5);
1891 IntRegIndex rm = (IntRegIndex)(uint32_t)bits(machInst, 20, 16);
1892 ConditionCode cond =
1893 (ConditionCode)(uint8_t)(bits(machInst, 15, 12));
1894 if (type == 0) // FCSEL Sd = if cond then Sn else Sm
1895 return new FCSelS(machInst, rd, rn, rm, cond);
1896 else if (type == 1) // FCSEL Dd = if cond then Dn else Dm
1897 return new FCSelD(machInst, rd, rn, rm, cond);
1899 return new Unknown64(machInst);
1903 return new FailUnimplemented("Unhandled Case4", machInst);
1912 decodeAdvSIMDScalar(ExtMachInst machInst)
1914 if (bits(machInst, 24) == 1) {
1915 if (bits(machInst, 10) == 0) {
1916 return decodeNeonScIndexedElem(machInst);
1917 } else if (bits(machInst, 23) == 0) {
1918 return decodeNeonScShiftByImm(machInst);
1920 } else if (bits(machInst, 21) == 1) {
1921 if (bits(machInst, 10) == 1) {
1922 return decodeNeonSc3Same(machInst);
1923 } else if (bits(machInst, 11) == 0) {
1924 return decodeNeonSc3Diff(machInst);
1925 } else if (bits(machInst, 20, 17) == 0x0) {
1926 return decodeNeonSc2RegMisc(machInst);
1927 } else if (bits(machInst, 20, 17) == 0x8) {
1928 return decodeNeonScPwise(machInst);
1930 return new Unknown64(machInst);
1932 } else if (bits(machInst, 23, 22) == 0 &&
1933 bits(machInst, 15) == 0 &&
1934 bits(machInst, 10) == 1) {
1935 return decodeNeonScCopy(machInst);
1937 return new Unknown64(machInst);
1939 return new FailUnimplemented("Unhandled Case6", machInst);
1948 decodeFpAdvSIMD(ExtMachInst machInst)
1951 if (bits(machInst, 28) == 0) {
1952 if (bits(machInst, 31) == 0) {
1953 return decodeAdvSIMD(machInst);
1955 return new Unknown64(machInst);
1957 } else if (bits(machInst, 30) == 0) {
1958 return decodeFp(machInst);
1959 } else if (bits(machInst, 31) == 0) {
1960 return decodeAdvSIMDScalar(machInst);
1962 return new Unknown64(machInst);
1972 decodeGem5Ops(ExtMachInst machInst)
1974 const uint32_t m5func = bits(machInst, 23, 16);
1976 case 0x00: return new Arm(machInst);
1977 case 0x01: return new Quiesce(machInst);
1978 case 0x02: return new QuiesceNs64(machInst);
1979 case 0x03: return new QuiesceCycles64(machInst);
1980 case 0x04: return new QuiesceTime64(machInst);
1981 case 0x07: return new Rpns64(machInst);
1982 case 0x09: return new WakeCPU64(machInst);
1983 case 0x10: return new Deprecated_ivlb(machInst);
1984 case 0x11: return new Deprecated_ivle(machInst);
1985 case 0x20: return new Deprecated_exit (machInst);
1986 case 0x21: return new M5exit64(machInst);
1987 case 0x31: return new Loadsymbol(machInst);
1988 case 0x30: return new Initparam64(machInst);
1989 case 0x40: return new Resetstats64(machInst);
1990 case 0x41: return new Dumpstats64(machInst);
1991 case 0x42: return new Dumpresetstats64(machInst);
1992 case 0x43: return new M5checkpoint64(machInst);
1993 case 0x4F: return new M5writefile64(machInst);
1994 case 0x50: return new M5readfile64(machInst);
1995 case 0x51: return new M5break(machInst);
1996 case 0x52: return new M5switchcpu(machInst);
1997 case 0x53: return new M5addsymbol64(machInst);
1998 case 0x54: return new M5panic(machInst);
1999 case 0x5a: return new M5workbegin64(machInst);
2000 case 0x5b: return new M5workend64(machInst);
2001 default: return new Unknown64(machInst);
2007 def format Aarch64() {{
2010 using namespace Aarch64;
2011 if (bits(machInst, 27) == 0x0) {
2012 if (bits(machInst, 28) == 0x0)
2013 return new Unknown64(machInst);
2014 else if (bits(machInst, 26) == 0)
2016 return decodeDataProcImm(machInst);
2019 return decodeBranchExcSys(machInst);
2020 } else if (bits(machInst, 25) == 0) {
2022 return decodeLoadsStores(machInst);
2023 } else if (bits(machInst, 26) == 0) {
2025 return decodeDataProcReg(machInst);
2026 } else if (bits(machInst, 24) == 1 &&
2027 bits(machInst, 31, 28) == 0xF) {
2028 return decodeGem5Ops(machInst);
2031 return decodeFpAdvSIMD(machInst);