Bug 1308846 - Baldr: MIPS: Implement loadConstantDouble/Float32(wasm::RawFXX). r=bbouvier

---
 .../jit/mips-shared/MacroAssembler-mips-shared.cpp |  9 ++++++
 .../jit/mips-shared/MacroAssembler-mips-shared.h   |  1 +
 js/src/jit/mips32/MacroAssembler-mips32.cpp        | 34 ++++++++++++++++++++++
 js/src/jit/mips32/MacroAssembler-mips32.h          |  2 ++
 js/src/jit/mips64/MacroAssembler-mips64.cpp        | 15 ++++++++++
 js/src/jit/mips64/MacroAssembler-mips64.h          |  2 ++
 6 files changed, 63 insertions(+)
This commit is contained in:
Heiher 2016-10-10 23:34:53 +08:00
Родитель d4cf901767
Коммит 20e13a38d9
6 изменённых файлов: 63 добавлений и 0 удалений

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

@ -998,6 +998,15 @@ MacroAssemblerMIPSShared::ma_lis(FloatRegister dest, float value)
moveToFloat32(ScratchRegister, dest);
}
void
MacroAssemblerMIPSShared::ma_lis(FloatRegister dest, wasm::RawF32 value)
{
Imm32 imm(value.bits());
ma_li(ScratchRegister, imm);
moveToFloat32(ScratchRegister, dest);
}
void
MacroAssemblerMIPSShared::ma_liNegZero(FloatRegister dest)
{

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

@ -165,6 +165,7 @@ class MacroAssemblerMIPSShared : public Assembler
// fp instructions
void ma_lis(FloatRegister dest, float value);
void ma_lis(FloatRegister dest, wasm::RawF32 value);
void ma_liNegZero(FloatRegister dest);
void ma_sd(FloatRegister fd, BaseIndex address);

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

@ -1412,6 +1412,12 @@ MacroAssemblerMIPSCompat::loadConstantFloat32(float f, FloatRegister dest)
ma_lis(dest, f);
}
void
MacroAssemblerMIPSCompat::loadConstantFloat32(wasm::RawF32 f, FloatRegister dest)
{
ma_lis(dest, f);
}
void
MacroAssemblerMIPSCompat::loadInt32OrDouble(const Address& src, FloatRegister dest)
{
@ -1462,6 +1468,34 @@ MacroAssemblerMIPSCompat::loadConstantDouble(double dp, FloatRegister dest)
ma_lid(dest, dp);
}
void
MacroAssemblerMIPSCompat::loadConstantDouble(wasm::RawF64 d, FloatRegister dest)
{
struct DoubleStruct {
uint32_t lo;
uint32_t hi;
} ;
DoubleStruct intStruct = mozilla::BitwiseCast<DoubleStruct>(d.bits());
// put hi part of 64 bit value into the odd register
if (intStruct.hi == 0) {
moveToDoubleHi(zero, dest);
} else {
ScratchRegisterScope scratch(asMasm());
ma_li(scratch, Imm32(intStruct.hi));
moveToDoubleHi(scratch, dest);
}
// put low part of 64 bit value into the even register
if (intStruct.lo == 0) {
moveToDoubleLo(zero, dest);
} else {
ScratchRegisterScope scratch(asMasm());
ma_li(scratch, Imm32(intStruct.lo));
moveToDoubleLo(scratch, dest);
}
}
Register
MacroAssemblerMIPSCompat::extractObject(const Address& address, Register scratch)
{

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

@ -361,10 +361,12 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
void loadInt32OrDouble(Register base, Register index,
FloatRegister dest, int32_t shift = defaultShift);
void loadConstantDouble(double dp, FloatRegister dest);
void loadConstantDouble(wasm::RawF64 d, FloatRegister dest);
void boolValueToFloat32(const ValueOperand& operand, FloatRegister dest);
void int32ValueToFloat32(const ValueOperand& operand, FloatRegister dest);
void loadConstantFloat32(float f, FloatRegister dest);
void loadConstantFloat32(wasm::RawF32 f, FloatRegister dest);
void testNullSet(Condition cond, const ValueOperand& value, Register dest);

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

@ -1657,6 +1657,12 @@ MacroAssemblerMIPS64Compat::loadConstantFloat32(float f, FloatRegister dest)
ma_lis(dest, f);
}
void
MacroAssemblerMIPS64Compat::loadConstantFloat32(wasm::RawF32 f, FloatRegister dest)
{
ma_lis(dest, f);
}
void
MacroAssemblerMIPS64Compat::loadInt32OrDouble(const Address& src, FloatRegister dest)
{
@ -1707,6 +1713,15 @@ MacroAssemblerMIPS64Compat::loadConstantDouble(double dp, FloatRegister dest)
ma_lid(dest, dp);
}
void
MacroAssemblerMIPS64Compat::loadConstantDouble(wasm::RawF64 d, FloatRegister dest)
{
ImmWord imm(d.bits());
ma_li(ScratchRegister, imm);
moveToDouble(ScratchRegister, dest);
}
Register
MacroAssemblerMIPS64Compat::extractObject(const Address& address, Register scratch)
{

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

@ -409,10 +409,12 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
void loadInt32OrDouble(const Address& src, FloatRegister dest);
void loadInt32OrDouble(const BaseIndex& addr, FloatRegister dest);
void loadConstantDouble(double dp, FloatRegister dest);
void loadConstantDouble(wasm::RawF64 d, FloatRegister dest);
void boolValueToFloat32(const ValueOperand& operand, FloatRegister dest);
void int32ValueToFloat32(const ValueOperand& operand, FloatRegister dest);
void loadConstantFloat32(float f, FloatRegister dest);
void loadConstantFloat32(wasm::RawF32 f, FloatRegister dest);
void testNullSet(Condition cond, const ValueOperand& value, Register dest);