Bug 1438727: [Part 15] Implement flexible shift macroassembler helpers r=tcampbell

--HG--
extra : rebase_source : 7c9f3cc7651d2ce8067df328705ff0d219d2c9eb
This commit is contained in:
Matthew Gaudet 2018-05-08 18:31:04 -04:00
Родитель 6968e15c35
Коммит 3356cf50eb
5 изменённых файлов: 99 добавлений и 0 удалений

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

@ -913,6 +913,11 @@ class MacroAssembler : public MacroAssemblerSpecific
inline void rshift32(Register shift, Register srcDest) PER_SHARED_ARCH;
inline void rshift32Arithmetic(Register shift, Register srcDest) PER_SHARED_ARCH;
// These variants may use the stack, but do not have the above constraint.
inline void flexibleLshift32(Register shift, Register srcDest) PER_SHARED_ARCH;
inline void flexibleRshift32(Register shift, Register srcDest) PER_SHARED_ARCH;
inline void flexibleRshift32Arithmetic(Register shift, Register srcDest) PER_SHARED_ARCH;
inline void lshift64(Register shift, Register64 srcDest) PER_ARCH;
inline void rshift64(Register shift, Register64 srcDest) PER_ARCH;
inline void rshift64Arithmetic(Register shift, Register64 srcDest) PER_ARCH;

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

@ -756,6 +756,12 @@ MacroAssembler::lshift32(Register src, Register dest)
ma_lsl(src, dest, dest);
}
void
MacroAssembler::flexibleLshift32(Register src, Register dest)
{
lshift32(src,dest);
}
void
MacroAssembler::lshift32(Imm32 imm, Register dest)
{
@ -777,6 +783,12 @@ MacroAssembler::rshift32(Register src, Register dest)
ma_lsr(src, dest, dest);
}
void
MacroAssembler::flexibleRshift32(Register src, Register dest)
{
rshift32(src,dest);
}
void
MacroAssembler::rshift32(Imm32 imm, Register dest)
{
@ -852,6 +864,12 @@ MacroAssembler::rshift32Arithmetic(Imm32 imm, Register dest)
rshiftPtrArithmetic(imm, dest);
}
void
MacroAssembler::flexibleRshift32Arithmetic(Register src, Register dest)
{
rshift32Arithmetic(src,dest);
}
void
MacroAssembler::rshift64(Imm32 imm, Register64 dest)
{

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

@ -691,6 +691,12 @@ MacroAssembler::lshift32(Register shift, Register dest)
Lsl(ARMRegister(dest, 32), ARMRegister(dest, 32), ARMRegister(shift, 32));
}
void
MacroAssembler::flexibleLshift32(Register src, Register dest)
{
lshift32(src,dest);
}
void
MacroAssembler::lshift32(Imm32 imm, Register dest)
{
@ -718,6 +724,12 @@ MacroAssembler::rshift32(Register shift, Register dest)
Lsr(ARMRegister(dest, 32), ARMRegister(dest, 32), ARMRegister(shift, 32));
}
void
MacroAssembler::flexibleRshift32(Register src, Register dest)
{
rshift32(src,dest);
}
void
MacroAssembler::rshift32(Imm32 imm, Register dest)
{
@ -745,6 +757,12 @@ MacroAssembler::rshift32Arithmetic(Imm32 imm, Register dest)
Asr(ARMRegister(dest, 32), ARMRegister(dest, 32), imm.value);
}
void
MacroAssembler::flexibleRshift32Arithmetic(Register src, Register dest)
{
rshift32Arithmetic(src,dest);
}
void
MacroAssembler::rshift64(Imm32 imm, Register64 dest)
{

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

@ -335,6 +335,12 @@ MacroAssembler::lshift32(Register src, Register dest)
ma_sll(dest, dest, src);
}
void
MacroAssembler::flexibleLshift32(Register src, Register dest)
{
lshift32(src,dest);
}
void
MacroAssembler::lshift32(Imm32 imm, Register dest)
{
@ -347,6 +353,12 @@ MacroAssembler::rshift32(Register src, Register dest)
ma_srl(dest, dest, src);
}
void
MacroAssembler::flexibleRshift32(Register src, Register dest)
{
rshift32(src,dest);
}
void
MacroAssembler::rshift32(Imm32 imm, Register dest)
{
@ -359,6 +371,12 @@ MacroAssembler::rshift32Arithmetic(Register src, Register dest)
ma_sra(dest, dest, src);
}
void
MacroAssembler::flexibleRshift32Arithmetic(Register src, Register dest)
{
rshift32Arithmetic(src,dest);
}
void
MacroAssembler::rshift32Arithmetic(Imm32 imm, Register dest)
{

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

@ -420,6 +420,34 @@ MacroAssembler::lshift32(Register shift, Register srcDest)
shll_cl(srcDest);
}
inline void
FlexibleShift32(MacroAssembler& masm, Register shift, Register dest, bool left, bool arithmetic = false)
{
if (shift != ecx) {
if (dest != ecx)
masm.push(ecx);
masm.mov(shift, ecx);
}
if (left) {
masm.lshift32(ecx, dest);
} else {
if (arithmetic)
masm.rshift32Arithmetic(ecx, dest);
else
masm.rshift32(ecx, dest);
}
if (shift != ecx && dest != ecx)
masm.pop(ecx);
}
void
MacroAssembler::flexibleLshift32(Register shift, Register srcDest)
{
FlexibleShift32(*this, shift, srcDest, true);
}
void
MacroAssembler::rshift32(Register shift, Register srcDest)
{
@ -427,6 +455,12 @@ MacroAssembler::rshift32(Register shift, Register srcDest)
shrl_cl(srcDest);
}
void
MacroAssembler::flexibleRshift32(Register shift, Register srcDest)
{
FlexibleShift32(*this, shift, srcDest, false, false);
}
void
MacroAssembler::rshift32Arithmetic(Register shift, Register srcDest)
{
@ -434,6 +468,12 @@ MacroAssembler::rshift32Arithmetic(Register shift, Register srcDest)
sarl_cl(srcDest);
}
void
MacroAssembler::flexibleRshift32Arithmetic(Register shift, Register srcDest)
{
FlexibleShift32(*this, shift, srcDest, false, true);
}
void
MacroAssembler::lshift32(Imm32 shift, Register srcDest)
{