break;
}
}
- // Fall through, immediate encoding is invalid.
+ M5_FALLTHROUGH;
default:
immValid = false;
break;
return new SubXImm(machInst, rdsp, rnsp, imm);
case 0x3:
return new SubXImmCc(machInst, rdzr, rnsp, imm);
+ default:
+ M5_UNREACHABLE;
}
}
case 0x4:
return new EorXImm(machInst, rdsp, rn, imm);
case 0x3:
return new AndXImmCc(machInst, rdzr, rn, imm);
+ default:
+ M5_UNREACHABLE;
}
}
case 0x5:
return new Movz(machInst, rdzr, imm16, hw * 16);
case 0x3:
return new Movk(machInst, rdzr, imm16, hw * 16);
+ default:
+ M5_UNREACHABLE;
}
}
case 0x6:
return new Ubfm64(machInst, rdzr, rn, immr, imms);
case 0x3:
return new Unknown64(machInst);
+ default:
+ M5_UNREACHABLE;
}
case 0x7:
{
}
}
break;
+ default:
+ M5_UNREACHABLE;
}
} else if (bits(machInst, 25) == 0x1) {
uint8_t opc = bits(machInst, 24, 21);
if (rn != 0x1f)
return new Unknown64(machInst);
return new FailUnimplemented("dret", machInst);
+ default:
+ return new Unknown64(machInst);
}
}
+ M5_FALLTHROUGH;
default:
return new Unknown64(machInst);
}
return new STXRW64(machInst, rt, rnsp, rs);
case 0x3:
return new STXRX64(machInst, rt, rnsp, rs);
+ default:
+ M5_UNREACHABLE;
}
case 0x1:
switch (size) {
return new STLXRW64(machInst, rt, rnsp, rs);
case 0x3:
return new STLXRX64(machInst, rt, rnsp, rs);
+ default:
+ M5_UNREACHABLE;
}
case 0x2:
switch (size) {
return new STXPW64(machInst, rs, rt, rt2, rnsp);
case 0x3:
return new STXPX64(machInst, rs, rt, rt2, rnsp);
+ default:
+ M5_UNREACHABLE;
}
case 0x3:
return new STLXPW64(machInst, rs, rt, rt2, rnsp);
case 0x3:
return new STLXPX64(machInst, rs, rt, rt2, rnsp);
+ default:
+ M5_UNREACHABLE;
}
case 0x4:
return new LDXRW64(machInst, rt, rnsp, rs);
case 0x3:
return new LDXRX64(machInst, rt, rnsp, rs);
+ default:
+ M5_UNREACHABLE;
}
case 0x5:
switch (size) {
return new LDAXRW64(machInst, rt, rnsp, rs);
case 0x3:
return new LDAXRX64(machInst, rt, rnsp, rs);
+ default:
+ M5_UNREACHABLE;
}
case 0x6:
switch (size) {
return new LDXPW64(machInst, rt, rt2, rnsp);
case 0x3:
return new LDXPX64(machInst, rt, rt2, rnsp);
+ default:
+ M5_UNREACHABLE;
}
case 0x7:
return new LDAXPW64(machInst, rt, rt2, rnsp);
case 0x3:
return new LDAXPX64(machInst, rt, rt2, rnsp);
+ default:
+ M5_UNREACHABLE;
}
case 0x9:
return new STLRW64(machInst, rt, rnsp);
case 0x3:
return new STLRX64(machInst, rt, rnsp);
+ default:
+ M5_UNREACHABLE;
}
case 0xd:
switch (size) {
return new LDARW64(machInst, rt, rnsp);
case 0x3:
return new LDARX64(machInst, rt, rnsp);
+ default:
+ M5_UNREACHABLE;
}
default:
return new Unknown64(machInst);
return new Unknown64(machInst);
}
}
+ default:
+ M5_UNREACHABLE;
}
}
}
+ default:
+ M5_UNREACHABLE;
}
return new FailUnimplemented("Unhandled Case1", machInst);
}
return new AndXSRegCc(machInst, rdzr, rn, rm, imm6, type);
case 0x7:
return new BicXSRegCc(machInst, rdzr, rn, rm, imm6, type);
+ default:
+ M5_UNREACHABLE;
}
}
case 0x1:
return new SubXSReg(machInst, rdzr, rn, rm, imm6, type);
case 0x3:
return new SubXSRegCc(machInst, rdzr, rn, rm, imm6, type);
+ default:
+ M5_UNREACHABLE;
}
} else {
if (bits(machInst, 23, 22) != 0 || bits(machInst, 12, 10) > 0x4)
return new SubXEReg(machInst, rdsp, rnsp, rm, type, imm3);
case 0x3:
return new SubXERegCc(machInst, rdzr, rnsp, rm, type, imm3);
+ default:
+ M5_UNREACHABLE;
}
}
}
return new SbcXSReg(machInst, rdzr, rn, rm, 0, LSL);
case 0x3:
return new SbcXSRegCc(machInst, rdzr, rn, rm, 0, LSL);
+ default:
+ M5_UNREACHABLE;
}
}
case 0x1:
return new Csinv64(machInst, rdzr, rn, rm, cond);
case 0x3:
return new Csneg64(machInst, rdzr, rn, rm, cond);
+ default:
+ M5_UNREACHABLE;
}
}
case 0x3:
return new Clz64(machInst, rdzr, rn);
case 0x5:
return new Cls64(machInst, rdzr, rn);
+ default:
+ return new Unknown64(machInst);
}
}
+ default:
+ M5_UNREACHABLE;
}
}
case 0x3:
return new Unknown64(machInst);
}
}
+ default:
+ M5_UNREACHABLE;
}
return new FailUnimplemented("Unhandled Case2", machInst);
}
default:
return new Unknown64(machInst);
}
+ default:
+ return new Unknown64(machInst);
}
} else {
// 30=0, 28:24=11110, 21=1
else
return new Unknown64(machInst);
}
+ default:
+ M5_UNREACHABLE;
}
}
return new FailUnimplemented("Unhandled Case4", machInst);
def format ArmDataProcReg() {{
pclr = '''
- return new %(className)ssRegPclr(machInst, %(dest)s,
- %(op1)s, rm, imm5,
- type);
+ if (%(dest)s == INTREG_PC) {
+ return new %(className)ssRegPclr(machInst, %(dest)s,
+ %(op1)s, rm, imm5,
+ type);
+ } else
'''
instDecode = '''
case %(opcode)#x:
if (immShift) {
if (setCc) {
- if (%(dest)s == INTREG_PC) {
- %(pclr)s
- } else {
+ %(pclr)s {
return new %(className)sRegCc(machInst, %(dest)s,
%(op1)s, rm, imm5, type);
}
def format ArmDataProcImm() {{
pclr = '''
- return new %(className)ssImmPclr(machInst, %(dest)s,
- %(op1)s, imm, false);
+ if (%(dest)s == INTREG_PC) {
+ return new %(className)ssImmPclr(machInst, %(dest)s,
+ %(op1)s, imm, false);
+ } else
'''
adr = '''
- return new AdrImm(machInst, %(dest)s, %(add)s,
- imm, false);
+ if (%(op1)s == INTREG_PC) {
+ return new AdrImm(machInst, %(dest)s, %(add)s,
+ imm, false);
+ } else
'''
instDecode = '''
case %(opcode)#x:
if (setCc) {
- if (%(pclrInst)s && %(dest)s == INTREG_PC) {
- %(pclr)s
- } else {
+ %(pclr)s {
return new %(className)sImmCc(machInst, %(dest)s, %(op1)s,
imm, rotC);
}
} else {
- if (%(adrInst)s && %(op1)s == INTREG_PC) {
- %(adr)s
- } else {
+ %(adr)s {
return new %(className)sImm(machInst, %(dest)s, %(op1)s,
imm, rotC);
}
"opcode": opcode,
"dest": dest,
"op1": op1,
- "adr": "",
- "adrInst": "false" }
+ "adr": "" }
if useDest:
- substDict["pclrInst"] = "true"
substDict["pclr"] = pclr % substDict
else:
- substDict["pclrInst"] = "false"
substDict["pclr"] = ""
return instDecode % substDict
"opcode": opcode,
"dest": "rd",
"op1": "rn",
- "add": add,
- "pclrInst": "true",
- "adrInst": "true" }
+ "add": add }
substDict["pclr"] = pclr % substDict
substDict["adr"] = adr % substDict
return instDecode % substDict
case 0x7:
return new MovRegRegCc(machInst, rd,
INTREG_ZERO, rn, rm, ROR);
+ default:
+ M5_UNREACHABLE;
}
} else if (bits(op2, 3) == 0) {
return new Unknown(machInst);
} else {
return new SubImmCc(machInst, rd, rn, imm3, true);
}
+ default:
+ M5_UNREACHABLE;
}
case 0x4:
if (machInst.itstateMask) {
} else {
return new SubImmCc(machInst, rd8, rd8, imm8, true);
}
+ default:
+ M5_UNREACHABLE;
}
}
'''
} else {
return new MvnRegCc(machInst, rdn, INTREG_ZERO, rm, 0, LSL);
}
+ default:
+ M5_UNREACHABLE;
}
}
'''
(IntRegIndex)(uint32_t)bits(machInst, 6, 3),
COND_UC);
}
+ default:
+ M5_UNREACHABLE;
}
}
'''
return new Uxth(machInst, rd, 0, rm);
case 0x3:
return new Uxtb(machInst, rd, 0, rm);
+ default:
+ M5_UNREACHABLE;
}
}
case 0x1:
((enable ? 1 : 0) << 9);
return new Cps(machInst, mods);
}
+ return new Unknown(machInst);
}
case 0xa:
{
const uint32_t satImm = bits(machInst, 4, 0);
return new Ssat16(machInst, rd, satImm + 1, rn);
}
- // Fall through on purpose...
+ M5_FALLTHROUGH;
case 0x10:
{
const uint32_t satImm = bits(machInst, 4, 0);
const uint32_t satImm = bits(machInst, 4, 0);
return new Usat16(machInst, rd, satImm, rn);
}
- // Fall through on purpose...
+ M5_FALLTHROUGH;
case 0x18:
{
const uint32_t satImm = bits(machInst, 4, 0);
width = 1;
break;
}
- // Fall through on purpose.
+ M5_FALLTHROUGH;
default:
return new Unknown(machInst);
}
} else {
return new VbifD<uint64_t>(machInst, vd, vn, vm);
}
+ default:
+ M5_UNREACHABLE;
}
} else {
switch (c) {
return new VornD<uint64_t>(
machInst, vd, vn, vm);
}
+ default:
+ M5_UNREACHABLE;
}
}
}
return decodeNeonSTwoMiscReg<NVnegD, NVnegQ>(
q, size, machInst, vd, vm);
}
+ default:
+ return new Unknown64(machInst);
}
case 0x2:
switch (bits(b, 4, 1)) {
// If rn == sp, then this is called vpop.
return new VLdmStm(machInst, rn, vd, single,
true, true, true, offset);
+ default:
+ M5_UNREACHABLE;
}
}
case 0x2:
return new VLdmStm(machInst, rn, vd, single,
false, true, true, offset);
}
- // Fall through on purpose
+ M5_FALLTHROUGH;
case 0x3:
const bool up = (bits(machInst, 23) == 1);
const uint32_t imm = bits(machInst, 7, 0) << 2;
case M5OP_PANIC: return new M5panic(machInst);
case M5OP_WORK_BEGIN: return new M5workbegin(machInst);
case M5OP_WORK_END: return new M5workend(machInst);
+ default: return new Unknown(machInst);
}
}
'''
return new %(imm_puw)s(machInst, RT, RN, true, imm);
}
}
+ return new Unknown(machInst);
} else {
return new Unknown(machInst);
}
return new %(imm_pu)s(machInst, RT, RN, true, imm);
case 7:
return new %(imm_puw)s(machInst, RT, RN, true, imm);
+ default:
+ M5_UNREACHABLE;
}
}
'''
return new %(ldrb)s(machInst, rt, rn, true, 0, LSL, rm);
case 0x7:
return new %(ldrsh)s(machInst, rt, rn, true, 0, LSL, rm);
+ default:
+ M5_UNREACHABLE;
}
}
'''
} else {
return new Smlal(machInst, ra, rd, rn, rm);
}
+ default:
+ M5_UNREACHABLE;
}
}
'''
return new SmlabtCc(machInst, rd, rn, rm, ra);
case 0x3:
return new SmlattCc(machInst, rd, rn, rm, ra);
+ default:
+ M5_UNREACHABLE;
}
case 0x1:
if (op) {
return new Smlalbt(machInst, ra, rd, rn, rm);
case 0x3:
return new Smlaltt(machInst, ra, rd, rn, rm);
+ default:
+ M5_UNREACHABLE;
}
case 0x3:
switch (bits(machInst, 6, 5)) {
return new Smulbt(machInst, rd, rn, rm);
case 0x3:
return new Smultt(machInst, rd, rn, rm);
+ default:
+ M5_UNREACHABLE;
}
+ default:
+ M5_UNREACHABLE;
}
}
'''
return new SmlattCc(machInst, rd, rn, rm, ra);
}
}
+ M5_UNREACHABLE;
case 0x2:
if (ra == 0xf) {
if (bits(machInst, 4)) {
} else {
return new Usada8(machInst, rd, rn, rm, ra);
}
+ default:
+ M5_UNREACHABLE;
}
}
'''
else
return new OrnDX<uint64_t>(machInst, vd, vn, vm);
}
+ default:
+ M5_UNREACHABLE;
}
case 0x04:
if (size == 0x3)
return new DupGprXQX<uint64_t>(machInst, vd, vn);
else
return new Unknown64(machInst);
+ default:
+ return new Unknown64(machInst);
}
case 0x3:
index1 = imm5 >> (imm5_pos + 1);
return decodeNeonUTwoMiscScFpReg<FcmltZeroScX>(
size & 0x1, machInst, vd, vn);
case 0x14:
- if (size == 0x3) {
+ switch (size) {
+ case 0x0:
+ return new SqxtnScX<int8_t>(machInst, vd, vn);
+ case 0x1:
+ return new SqxtnScX<int16_t>(machInst, vd, vn);
+ case 0x2:
+ return new SqxtnScX<int32_t>(machInst, vd, vn);
+ case 0x3:
return new Unknown64(machInst);
- } else {
- switch (size) {
- case 0x0:
- return new SqxtnScX<int8_t>(machInst, vd, vn);
- case 0x1:
- return new SqxtnScX<int16_t>(machInst, vd, vn);
- case 0x2:
- return new SqxtnScX<int32_t>(machInst, vd, vn);
- }
+ default:
+ M5_UNREACHABLE;
}
case 0x1a:
if (size < 0x2)
return decodeNeonUTwoMiscScFpReg<FcmleZeroScX>(
size & 0x1, machInst, vd, vn);
case 0x32:
- if (size == 0x3) {
+ switch (size) {
+ case 0x0:
+ return new SqxtunScX<int8_t>(machInst, vd, vn);
+ case 0x1:
+ return new SqxtunScX<int16_t>(machInst, vd, vn);
+ case 0x2:
+ return new SqxtunScX<int32_t>(machInst, vd, vn);
+ case 0x3:
return new Unknown64(machInst);
- } else {
- switch (size) {
- case 0x0:
- return new SqxtunScX<int8_t>(machInst, vd, vn);
- case 0x1:
- return new SqxtunScX<int16_t>(machInst, vd, vn);
- case 0x2:
- return new SqxtunScX<int32_t>(machInst, vd, vn);
- }
+ default:
+ M5_UNREACHABLE;
}
case 0x34:
- if (size == 0x3) {
+ switch (size) {
+ case 0x0:
+ return new UqxtnScX<uint8_t>(machInst, vd, vn);
+ case 0x1:
+ return new UqxtnScX<uint16_t>(machInst, vd, vn);
+ case 0x2:
+ return new UqxtnScX<uint32_t>(machInst, vd, vn);
+ case 0x3:
return new Unknown64(machInst);
- } else {
- switch (size) {
- case 0x0:
- return new UqxtnScX<uint8_t>(machInst, vd, vn);
- case 0x1:
- return new UqxtnScX<uint16_t>(machInst, vd, vn);
- case 0x2:
- return new UqxtnScX<uint32_t>(machInst, vd, vn);
- }
+ default:
+ M5_UNREACHABLE;
}
case 0x36:
if (size != 0x1) {
# define M5_NO_INLINE __attribute__ ((__noinline__))
# define M5_DEPRECATED __attribute__((deprecated))
# define M5_DEPRECATED_MSG(MSG) __attribute__((deprecated(MSG)))
+# define M5_UNREACHABLE __builtin_unreachable()
#endif
#if defined(__clang__)