Index: src/arm64/simulator-arm64.cc |
diff --git a/src/arm64/simulator-arm64.cc b/src/arm64/simulator-arm64.cc |
index c7c9f6cedd9105aef766f45f273dfcf8226d9fc1..1ae57e9e2f1fcedba8cd1db7d3eb55e1372cde59 100644 |
--- a/src/arm64/simulator-arm64.cc |
+++ b/src/arm64/simulator-arm64.cc |
@@ -2103,10 +2103,12 @@ void Simulator::VisitExtract(Instruction* instr) { |
unsigned lsb = instr->ImmS(); |
unsigned reg_size = (instr->SixtyFourBits() == 1) ? kXRegSizeInBits |
: kWRegSizeInBits; |
- set_reg(reg_size, |
- instr->Rd(), |
- (static_cast<uint64_t>(reg(reg_size, instr->Rm())) >> lsb) | |
- (reg(reg_size, instr->Rn()) << (reg_size - lsb))); |
+ uint64_t result = reg(reg_size, instr->Rm()); |
+ if (lsb) { |
+ result = (result >> lsb) | (reg(reg_size, instr->Rn()) << (reg_size - lsb)); |
+ } |
+ |
+ set_reg(reg_size, instr->Rd(), result); |
} |