Index: src/a64/macro-assembler-a64.cc |
diff --git a/src/a64/macro-assembler-a64.cc b/src/a64/macro-assembler-a64.cc |
index 53c7777ae137b62b162ee3a80050f81891f28f9a..e69597cbff4d49b594ff642853fda37caaffa331 100644 |
--- a/src/a64/macro-assembler-a64.cc |
+++ b/src/a64/macro-assembler-a64.cc |
@@ -4932,6 +4932,22 @@ bool MacroAssembler::IsCodeAgeSequence(byte* sequence) { |
#endif |
+void MacroAssembler::FlooringDiv(Register result, |
+ Register dividend, |
+ int32_t divisor) { |
+ Register tmp = WTmp0(); |
+ ASSERT(!AreAliased(result, dividend, tmp)); |
+ ASSERT(result.Is32Bits() && dividend.Is32Bits()); |
+ MultiplierAndShift ms(divisor); |
+ Mov(tmp, Operand(ms.multiplier())); |
+ Smull(result.X(), dividend, tmp); |
+ Asr(result.X(), result.X(), 32); |
+ if (divisor > 0 && ms.multiplier() < 0) Add(result, result, dividend); |
+ if (divisor < 0 && ms.multiplier() > 0) Sub(result, result, dividend); |
+ if (ms.shift() > 0) Asr(result, result, ms.shift()); |
+} |
+ |
+ |
#undef __ |
#define __ masm-> |