mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1245112 - Part 9: Move MacroAssembler::branchDouble into generic macro assembler. r=nbp
This commit is contained in:
parent
64b2cb020b
commit
33147eea93
@ -525,6 +525,15 @@ MacroAssembler::canonicalizeFloat(FloatRegister reg)
|
||||
bind(¬NaN);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::canonicalizeDouble(FloatRegister reg)
|
||||
{
|
||||
Label notNaN;
|
||||
branchDouble(DoubleOrdered, reg, reg, ¬NaN);
|
||||
loadConstantDouble(JS::GenericNaN(), reg);
|
||||
bind(¬NaN);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
MacroAssembler::storeObjectOrNull(Register src, const T& dest)
|
||||
|
@ -846,6 +846,9 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||
inline void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail)
|
||||
DEFINED_ON(arm, arm64, mips_shared, x86, x64);
|
||||
|
||||
inline void branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
|
||||
Label* label) PER_SHARED_ARCH;
|
||||
|
||||
template <class L>
|
||||
inline void branchTest32(Condition cond, Register lhs, Register rhs, L label) PER_SHARED_ARCH;
|
||||
template <class L>
|
||||
@ -1120,12 +1123,7 @@ class MacroAssembler : public MacroAssemblerSpecific
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
void canonicalizeDouble(FloatRegister reg) {
|
||||
Label notNaN;
|
||||
branchDouble(DoubleOrdered, reg, reg, ¬NaN);
|
||||
loadConstantDouble(JS::GenericNaN(), reg);
|
||||
bind(¬NaN);
|
||||
}
|
||||
inline void canonicalizeDouble(FloatRegister reg);
|
||||
|
||||
inline void canonicalizeFloat(FloatRegister reg);
|
||||
|
||||
|
@ -610,6 +610,30 @@ MacroAssembler::branchTruncateFloat32(FloatRegister src, Register dest, Label* f
|
||||
ma_b(fail, Assembler::Equal);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
|
||||
Label* label)
|
||||
{
|
||||
compareDouble(lhs, rhs);
|
||||
|
||||
if (cond == DoubleNotEqual) {
|
||||
// Force the unordered cases not to jump.
|
||||
Label unordered;
|
||||
ma_b(&unordered, VFP_Unordered);
|
||||
ma_b(label, VFP_NotEqualOrUnordered);
|
||||
bind(&unordered);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cond == DoubleEqualOrUnordered) {
|
||||
ma_b(label, VFP_Unordered);
|
||||
ma_b(label, VFP_Equal);
|
||||
return;
|
||||
}
|
||||
|
||||
ma_b(label, ConditionFromDoubleCondition(cond));
|
||||
}
|
||||
|
||||
template <class L>
|
||||
void
|
||||
MacroAssembler::branchTest32(Condition cond, Register lhs, Register rhs, L label)
|
||||
|
@ -2491,30 +2491,6 @@ MacroAssemblerARMCompat::compareDouble(FloatRegister lhs, FloatRegister rhs)
|
||||
as_vmrs(pc);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerARMCompat::branchDouble(DoubleCondition cond, FloatRegister lhs,
|
||||
FloatRegister rhs, Label* label)
|
||||
{
|
||||
compareDouble(lhs, rhs);
|
||||
|
||||
if (cond == DoubleNotEqual) {
|
||||
// Force the unordered cases not to jump.
|
||||
Label unordered;
|
||||
ma_b(&unordered, VFP_Unordered);
|
||||
ma_b(label, VFP_NotEqualOrUnordered);
|
||||
bind(&unordered);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cond == DoubleEqualOrUnordered) {
|
||||
ma_b(label, VFP_Unordered);
|
||||
ma_b(label, VFP_Equal);
|
||||
return;
|
||||
}
|
||||
|
||||
ma_b(label, ConditionFromDoubleCondition(cond));
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerARMCompat::compareFloat(FloatRegister lhs, FloatRegister rhs)
|
||||
{
|
||||
|
@ -1451,8 +1451,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
||||
void simulatorStop(const char* msg);
|
||||
|
||||
void compareDouble(FloatRegister lhs, FloatRegister rhs);
|
||||
void branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
|
||||
Label* label);
|
||||
|
||||
void compareFloat(FloatRegister lhs, FloatRegister rhs);
|
||||
|
||||
|
@ -693,6 +693,29 @@ MacroAssembler::branchTruncateFloat32(FloatRegister src, Register dest, Label* f
|
||||
And(dest64, dest64, Operand(0xffffffff));
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
|
||||
Label* label)
|
||||
{
|
||||
compareDouble(cond, lhs, rhs);
|
||||
switch (cond) {
|
||||
case DoubleNotEqual: {
|
||||
Label unordered;
|
||||
// not equal *and* ordered
|
||||
branch(Overflow, &unordered);
|
||||
branch(NotEqual, label);
|
||||
bind(&unordered);
|
||||
break;
|
||||
}
|
||||
case DoubleEqualOrUnordered:
|
||||
branch(Overflow, label);
|
||||
branch(Equal, label);
|
||||
break;
|
||||
default:
|
||||
branch(Condition(cond), label);
|
||||
}
|
||||
}
|
||||
|
||||
template <class L>
|
||||
void
|
||||
MacroAssembler::branchTest32(Condition cond, Register lhs, Register rhs, L label)
|
||||
|
@ -1582,25 +1582,6 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
|
||||
void compareDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs) {
|
||||
Fcmp(ARMFPRegister(lhs, 64), ARMFPRegister(rhs, 64));
|
||||
}
|
||||
void branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs, Label* label) {
|
||||
compareDouble(cond, lhs, rhs);
|
||||
switch (cond) {
|
||||
case DoubleNotEqual: {
|
||||
Label unordered;
|
||||
// not equal *and* ordered
|
||||
branch(Overflow, &unordered);
|
||||
branch(NotEqual, label);
|
||||
bind(&unordered);
|
||||
break;
|
||||
}
|
||||
case DoubleEqualOrUnordered:
|
||||
branch(Overflow, label);
|
||||
branch(Equal, label);
|
||||
break;
|
||||
default:
|
||||
branch(Condition(cond), label);
|
||||
}
|
||||
}
|
||||
|
||||
void compareFloat(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs) {
|
||||
Fcmp(ARMFPRegister(lhs, 32), ARMFPRegister(rhs, 32));
|
||||
|
@ -362,6 +362,13 @@ MacroAssembler::branchTruncateFloat32(FloatRegister src, Register dest, Label* f
|
||||
ma_b(dest, Imm32(INT32_MAX), fail, Assembler::Equal);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
|
||||
Label* label)
|
||||
{
|
||||
ma_bc1d(lhs, rhs, label, cond);
|
||||
}
|
||||
|
||||
template <class L>
|
||||
void
|
||||
MacroAssembler::branchTest32(Condition cond, Register lhs, Register rhs, L label)
|
||||
|
@ -1098,13 +1098,6 @@ MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output)
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerMIPSCompat::branchDouble(DoubleCondition cond, FloatRegister lhs,
|
||||
FloatRegister rhs, Label* label)
|
||||
{
|
||||
ma_bc1d(lhs, rhs, label, cond);
|
||||
}
|
||||
|
||||
// higher level tag testing code
|
||||
Operand
|
||||
MacroAssemblerMIPSCompat::ToPayload(Operand base)
|
||||
|
@ -1074,9 +1074,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
|
||||
|
||||
void breakpoint();
|
||||
|
||||
void branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
|
||||
Label* label);
|
||||
|
||||
void checkStackAlignment();
|
||||
|
||||
void alignStackPointer();
|
||||
|
@ -1238,13 +1238,6 @@ MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output)
|
||||
bind(&done);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerMIPS64Compat::branchDouble(DoubleCondition cond, FloatRegister lhs,
|
||||
FloatRegister rhs, Label* label)
|
||||
{
|
||||
ma_bc1d(lhs, rhs, label, cond);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerMIPS64Compat::branchTestGCThing(Condition cond, const Address& address, Label* label)
|
||||
{
|
||||
|
@ -1084,9 +1084,6 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
|
||||
|
||||
void breakpoint();
|
||||
|
||||
void branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
|
||||
Label* label);
|
||||
|
||||
void checkStackAlignment();
|
||||
|
||||
static void calculateAlignedStackPointer(void** stackPointer);
|
||||
|
@ -246,7 +246,6 @@ class MacroAssemblerNone : public Assembler
|
||||
|
||||
template <typename T, typename S> void branchAdd32(Condition, T, S, Label*) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void branchSub32(Condition, T, S, Label*) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void branchDouble(DoubleCondition, T, S, Label*) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void decBranchPtr(Condition, T, S, Label*) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void mov(T, S) { MOZ_CRASH(); }
|
||||
template <typename T, typename S> void movq(T, S) { MOZ_CRASH(); }
|
||||
|
@ -318,6 +318,29 @@ MacroAssembler::branchFloat(DoubleCondition cond, FloatRegister lhs, FloatRegist
|
||||
j(ConditionFromDoubleCondition(cond), label);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs,
|
||||
Label* label)
|
||||
{
|
||||
compareDouble(cond, lhs, rhs);
|
||||
|
||||
if (cond == DoubleEqual) {
|
||||
Label unordered;
|
||||
j(Parity, &unordered);
|
||||
j(Equal, label);
|
||||
bind(&unordered);
|
||||
return;
|
||||
}
|
||||
if (cond == DoubleNotEqualOrUnordered) {
|
||||
j(NotEqual, label);
|
||||
j(Parity, label);
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!(cond & DoubleConditionBitSpecial));
|
||||
j(ConditionFromDoubleCondition(cond), label);
|
||||
}
|
||||
|
||||
template <class L>
|
||||
void
|
||||
MacroAssembler::branchTest32(Condition cond, Register lhs, Register rhs, L label)
|
||||
|
@ -105,7 +105,7 @@ MacroAssemblerX86Shared::branchNegativeZero(FloatRegister reg,
|
||||
zeroDouble(scratchDouble);
|
||||
|
||||
// If reg is non-zero, jump to nonZero.
|
||||
branchDouble(DoubleNotEqual, reg, scratchDouble, &nonZero);
|
||||
asMasm().branchDouble(DoubleNotEqual, reg, scratchDouble, &nonZero);
|
||||
}
|
||||
// Input register is either zero or negative zero. Retrieve sign of input.
|
||||
vmovmskpd(reg, scratch);
|
||||
|
@ -109,26 +109,6 @@ class MacroAssemblerX86Shared : public Assembler
|
||||
else
|
||||
vucomisd(rhs, lhs);
|
||||
}
|
||||
void branchDouble(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs, Label* label)
|
||||
{
|
||||
compareDouble(cond, lhs, rhs);
|
||||
|
||||
if (cond == DoubleEqual) {
|
||||
Label unordered;
|
||||
j(Parity, &unordered);
|
||||
j(Equal, label);
|
||||
bind(&unordered);
|
||||
return;
|
||||
}
|
||||
if (cond == DoubleNotEqualOrUnordered) {
|
||||
j(NotEqual, label);
|
||||
j(Parity, label);
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!(cond & DoubleConditionBitSpecial));
|
||||
j(ConditionFromDoubleCondition(cond), label);
|
||||
}
|
||||
|
||||
void compareFloat(DoubleCondition cond, FloatRegister lhs, FloatRegister rhs) {
|
||||
if (cond & DoubleConditionBitInvert)
|
||||
|
Loading…
Reference in New Issue
Block a user