Index: src/arm64/macro-assembler-arm64-inl.h |
diff --git a/src/arm64/macro-assembler-arm64-inl.h b/src/arm64/macro-assembler-arm64-inl.h |
index fd5172bb0daca27237a59ca5dce311a365dbe91a..3ce4855b8a1b004065acc93553fa33f42ef1291b 100644 |
--- a/src/arm64/macro-assembler-arm64-inl.h |
+++ b/src/arm64/macro-assembler-arm64-inl.h |
@@ -151,7 +151,8 @@ void MacroAssembler::Add(const Register& rd, |
const Register& rn, |
const Operand& operand) { |
ASSERT(allow_macro_instructions_); |
- if (operand.IsImmediate() && (operand.ImmediateValue() < 0)) { |
+ if (operand.IsImmediate() && (operand.ImmediateValue() < 0) && |
+ IsImmAddSub(-operand.ImmediateValue())) { |
AddSubMacro(rd, rn, -operand.ImmediateValue(), LeaveFlags, SUB); |
} else { |
AddSubMacro(rd, rn, operand, LeaveFlags, ADD); |
@@ -162,7 +163,8 @@ void MacroAssembler::Adds(const Register& rd, |
const Register& rn, |
const Operand& operand) { |
ASSERT(allow_macro_instructions_); |
- if (operand.IsImmediate() && (operand.ImmediateValue() < 0)) { |
+ if (operand.IsImmediate() && (operand.ImmediateValue() < 0) && |
+ IsImmAddSub(-operand.ImmediateValue())) { |
AddSubMacro(rd, rn, -operand.ImmediateValue(), SetFlags, SUB); |
} else { |
AddSubMacro(rd, rn, operand, SetFlags, ADD); |
@@ -174,7 +176,8 @@ void MacroAssembler::Sub(const Register& rd, |
const Register& rn, |
const Operand& operand) { |
ASSERT(allow_macro_instructions_); |
- if (operand.IsImmediate() && (operand.ImmediateValue() < 0)) { |
+ if (operand.IsImmediate() && (operand.ImmediateValue() < 0) && |
+ IsImmAddSub(-operand.ImmediateValue())) { |
AddSubMacro(rd, rn, -operand.ImmediateValue(), LeaveFlags, ADD); |
} else { |
AddSubMacro(rd, rn, operand, LeaveFlags, SUB); |
@@ -186,7 +189,8 @@ void MacroAssembler::Subs(const Register& rd, |
const Register& rn, |
const Operand& operand) { |
ASSERT(allow_macro_instructions_); |
- if (operand.IsImmediate() && (operand.ImmediateValue() < 0)) { |
+ if (operand.IsImmediate() && (operand.ImmediateValue() < 0) && |
+ IsImmAddSub(-operand.ImmediateValue())) { |
AddSubMacro(rd, rn, -operand.ImmediateValue(), SetFlags, ADD); |
} else { |
AddSubMacro(rd, rn, operand, SetFlags, SUB); |