Index: src/compiler/arm/instruction-selector-arm.cc |
diff --git a/src/compiler/arm/instruction-selector-arm.cc b/src/compiler/arm/instruction-selector-arm.cc |
index 1fdc12b9032862a0663f0930a3f5bfbe3e9beb10..f803d2641490baf288c2d3647652ee874ee90b87 100644 |
--- a/src/compiler/arm/instruction-selector-arm.cc |
+++ b/src/compiler/arm/instruction-selector-arm.cc |
@@ -326,7 +326,8 @@ void VisitMod(InstructionSelector* selector, Node* node, ArchOpcode div_opcode, |
} else { |
InstructionOperand mul_operand = g.TempRegister(); |
selector->Emit(kArmMul, mul_operand, div_operand, right_operand); |
- selector->Emit(kArmSub, result_operand, left_operand, mul_operand); |
+ selector->Emit(kArmSub | AddressingModeField::encode(kMode_Operand2_R), |
+ result_operand, left_operand, mul_operand); |
} |
} |
@@ -1951,9 +1952,13 @@ void InstructionSelector::VisitAtomicStore(Node* node) { |
// static |
MachineOperatorBuilder::Flags |
InstructionSelector::SupportedMachineOperatorFlags() { |
- MachineOperatorBuilder::Flags flags = |
- MachineOperatorBuilder::kInt32DivIsSafe | |
- MachineOperatorBuilder::kUint32DivIsSafe; |
+ MachineOperatorBuilder::Flags flags; |
+ if (CpuFeatures::IsSupported(SUDIV)) { |
+ // The sdiv and udiv instructions correctly return 0 if the divisor is 0, |
+ // but the fall-back implementation does not. |
+ flags |= MachineOperatorBuilder::kInt32DivIsSafe | |
+ MachineOperatorBuilder::kUint32DivIsSafe; |
+ } |
if (CpuFeatures::IsSupported(ARMv7)) { |
flags |= MachineOperatorBuilder::kWord32ReverseBits; |
} |