Index: src/mips64/simulator-mips64.cc |
diff --git a/src/mips64/simulator-mips64.cc b/src/mips64/simulator-mips64.cc |
index 42b9ee0ed301945433dcd52b5ed8c6b61041ad7b..00d71b60f4ba7a596cb8471ee1ee3885acd6b007 100644 |
--- a/src/mips64/simulator-mips64.cc |
+++ b/src/mips64/simulator-mips64.cc |
@@ -3879,6 +3879,28 @@ void Simulator::DecodeTypeRegisterSPECIAL3() { |
SetResult(rt_reg(), alu_out); |
break; |
} |
+ case DEXTM: { |
+ // Interpret rd field as 5-bit msb of extract. |
+ uint16_t msb = rd_reg(); |
+ // Interpret sa field as 5-bit lsb of extract. |
+ uint16_t lsb = sa(); |
+ uint16_t size = msb + 33; |
+ uint64_t mask = (1ULL << size) - 1; |
+ alu_out = static_cast<int64_t>((rs_u() & (mask << lsb)) >> lsb); |
+ SetResult(rt_reg(), alu_out); |
+ break; |
+ } |
+ case DEXTU: { |
+ // Interpret rd field as 5-bit msb of extract. |
+ uint16_t msb = rd_reg(); |
+ // Interpret sa field as 5-bit lsb of extract. |
+ uint16_t lsb = sa() + 32; |
+ uint16_t size = msb + 1; |
+ uint64_t mask = (1ULL << size) - 1; |
+ alu_out = static_cast<int64_t>((rs_u() & (mask << lsb)) >> lsb); |
+ SetResult(rt_reg(), alu_out); |
+ break; |
+ } |
case BSHFL: { |
int32_t sa = get_instr()->SaFieldRaw() >> kSaShift; |
switch (sa) { |