ARM: Decode the saturation instructions.

This commit is contained in:
Gabe Black 2010-06-02 12:58:06 -05:00
parent 61b8e33225
commit 90c2284714

View file

@ -131,12 +131,20 @@ def format ArmPackUnpackSatReverse() {{
const uint32_t a = bits(machInst, 19, 16);
const uint32_t op2 = bits(machInst, 7, 5);
if (bits(op2, 0) == 0) {
const IntRegIndex rn =
(IntRegIndex)(uint32_t)bits(machInst, 3, 0);
const IntRegIndex rd =
(IntRegIndex)(uint32_t)bits(machInst, 15, 12);
const uint32_t satImm = bits(machInst, 20, 16);
const uint32_t imm = bits(machInst, 11, 7);
const ArmShiftType type =
(ArmShiftType)(uint32_t)bits(machInst, 6, 5);
if (op1 == 0) {
return new WarnUnimplemented("pkh", machInst);
} else if (bits(op1, 2, 1) == 1) {
return new WarnUnimplemented("ssat", machInst);
return new Ssat(machInst, rd, satImm + 1, rn, imm, type);
} else if (bits(op1, 2, 1) == 3) {
return new WarnUnimplemented("usat", machInst);
return new Usat(machInst, rd, satImm, rn, imm, type);
}
return new Unknown(machInst);
}
@ -154,7 +162,12 @@ def format ArmPackUnpackSatReverse() {{
break;
case 0x2:
if (op2 == 0x1) {
return new WarnUnimplemented("ssat16", machInst);
const IntRegIndex rn =
(IntRegIndex)(uint32_t)bits(machInst, 3, 0);
const IntRegIndex rd =
(IntRegIndex)(uint32_t)bits(machInst, 15, 12);
const uint32_t satImm = bits(machInst, 20, 16);
return new Ssat16(machInst, rd, satImm + 1, rn);
} else if (op2 == 0x3) {
if (a == 0xf) {
return new WarnUnimplemented("sxtb", machInst);
@ -191,7 +204,12 @@ def format ArmPackUnpackSatReverse() {{
break;
case 0x6:
if (op2 == 0x1) {
return new WarnUnimplemented("usat16", machInst);
const IntRegIndex rn =
(IntRegIndex)(uint32_t)bits(machInst, 3, 0);
const IntRegIndex rd =
(IntRegIndex)(uint32_t)bits(machInst, 15, 12);
const uint32_t satImm = bits(machInst, 20, 16);
return new Usat16(machInst, rd, satImm, rn);
} else if (op2 == 0x3) {
if (a == 0xf) {
return new WarnUnimplemented("uxtb", machInst);
@ -1108,11 +1126,19 @@ def format Thumb32DataProcPlainBin() {{
}
case 0x12:
if (!(bits(machInst, 14, 12) || bits(machInst, 7, 6))) {
return new WarnUnimplemented("ssat16", machInst);
const uint32_t satImm = bits(machInst, 4, 0);
return new Ssat16(machInst, rd, satImm + 1, rn);
}
// Fall through on purpose...
case 0x10:
return new WarnUnimplemented("ssat", machInst);
{
const uint32_t satImm = bits(machInst, 4, 0);
const uint32_t imm = bits(machInst, 7, 6) |
(bits(machInst, 14, 12) << 2);
const ArmShiftType type =
(ArmShiftType)(uint32_t)bits(machInst, 21, 20);
return new Ssat(machInst, rd, satImm + 1, rn, imm, type);
}
case 0x14:
return new WarnUnimplemented("sbfx", machInst);
case 0x16:
@ -1123,11 +1149,19 @@ def format Thumb32DataProcPlainBin() {{
}
case 0x1a:
if (!(bits(machInst, 14, 12) || bits(machInst, 7, 6))) {
return new WarnUnimplemented("usat16", machInst);
const uint32_t satImm = bits(machInst, 4, 0);
return new Usat16(machInst, rd, satImm, rn);
}
// Fall through on purpose...
case 0x18:
return new WarnUnimplemented("usat", machInst);
{
const uint32_t satImm = bits(machInst, 4, 0);
const uint32_t imm = bits(machInst, 7, 6) |
(bits(machInst, 14, 12) << 2);
const ArmShiftType type =
(ArmShiftType)(uint32_t)bits(machInst, 21, 20);
return new Usat(machInst, rd, satImm, rn, imm, type);
}
case 0x1c:
return new WarnUnimplemented("ubfx", machInst);
default: