Index: src/mips64/simulator-mips64.cc |
diff --git a/src/mips64/simulator-mips64.cc b/src/mips64/simulator-mips64.cc |
index 2440770b19aad0c1c4583b739dd2b81b59937426..fc0ae0cb6f0e44c00cc747377abf79cd4c7d4bc0 100644 |
--- a/src/mips64/simulator-mips64.cc |
+++ b/src/mips64/simulator-mips64.cc |
@@ -3696,7 +3696,19 @@ void Simulator::DecodeTypeRegisterSPECIAL2() { |
void Simulator::DecodeTypeRegisterSPECIAL3() { |
int64_t alu_out; |
switch (get_instr()->FunctionFieldRaw()) { |
- case INS: { // Mips32r2 instruction. |
+ case INS: { // Mips64r2 instruction. |
+ // Interpret rd field as 5-bit msb of insert. |
+ uint16_t msb = rd_reg(); |
+ // Interpret sa field as 5-bit lsb of insert. |
+ uint16_t lsb = sa(); |
+ uint16_t size = msb - lsb + 1; |
+ uint64_t mask = (1ULL << size) - 1; |
+ alu_out = static_cast<int32_t>((rt_u() & ~(mask << lsb)) | |
+ ((rs_u() & mask) << lsb)); |
+ SetResult(rt_reg(), alu_out); |
+ break; |
+ } |
+ case DINS: { // Mips64r2 instruction. |
// Interpret rd field as 5-bit msb of insert. |
uint16_t msb = rd_reg(); |
// Interpret sa field as 5-bit lsb of insert. |
@@ -3707,7 +3719,7 @@ void Simulator::DecodeTypeRegisterSPECIAL3() { |
SetResult(rt_reg(), alu_out); |
break; |
} |
- case EXT: { // Mips32r2 instruction. |
+ case EXT: { // Mips64r2 instruction. |
// Interpret rd field as 5-bit msb of extract. |
uint16_t msb = rd_reg(); |
// Interpret sa field as 5-bit lsb of extract. |
@@ -3718,7 +3730,7 @@ void Simulator::DecodeTypeRegisterSPECIAL3() { |
SetResult(rt_reg(), alu_out); |
break; |
} |
- case DEXT: { // Mips32r2 instruction. |
+ case DEXT: { // Mips64r2 instruction. |
// Interpret rd field as 5-bit msb of extract. |
uint16_t msb = rd_reg(); |
// Interpret sa field as 5-bit lsb of extract. |