Bug 1290812 - Part 33: Implement the 64bit variant of PopCnt on mips32. r=lth

---
 js/src/jit/MacroAssembler.h                   |  2 +-
 js/src/jit/mips32/MacroAssembler-mips32-inl.h | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)
This commit is contained in:
Shi Dan 2016-10-10 17:08:31 +08:00
Родитель f814a0efa3
Коммит 8fb59f8f90
2 изменённых файлов: 24 добавлений и 1 удалений

Просмотреть файл

@ -930,7 +930,7 @@ class MacroAssembler : public MacroAssemblerSpecific
// temp may be invalid only if the chip has the POPCNT instruction.
inline void popcnt64(Register64 src, Register64 dest, Register temp)
DEFINED_ON(x86, x64, arm, mips64);
DEFINED_ON(x86, x64, arm, mips32, mips64);
// ===============================================================
// Branch functions

Просмотреть файл

@ -663,6 +663,29 @@ MacroAssembler::rotateRight64(Register shift, Register64 src, Register64 dest, R
bind(&done);
}
// ===============================================================
// Bit counting functions
void
MacroAssembler::popcnt64(Register64 src, Register64 dest, Register tmp)
{
MOZ_ASSERT(dest.low != tmp);
MOZ_ASSERT(dest.high != tmp);
MOZ_ASSERT(dest.low != dest.high);
if (dest.low != src.high) {
popcnt32(src.low, dest.low, tmp);
popcnt32(src.high, dest.high, tmp);
} else {
MOZ_ASSERT(dest.high != src.high);
popcnt32(src.low, dest.high, tmp);
popcnt32(src.high, dest.low, tmp);
}
ma_addu(dest.low, dest.high);
move32(Imm32(0), dest.high);
}
// ===============================================================
// Branch functions