Bug 917991 - IonMonkey: Replace movsd with loadDouble and storeDouble as appropriate. r=jandem

This commit is contained in:
Dan Gohman 2013-09-24 20:08:57 -07:00
parent 09734ab1fd
commit ca6574447f
8 changed files with 27 additions and 24 deletions

View File

@ -231,7 +231,7 @@ CodeGeneratorX86Shared::visitAsmJSPassStackArg(LAsmJSPassStackArg *ins)
if (ins->arg()->isGeneralReg())
masm.storePtr(ToRegister(ins->arg()), dst);
else
masm.movsd(ToFloatRegister(ins->arg()), Operand(dst));
masm.storeDouble(ToFloatRegister(ins->arg()), dst);
}
return true;
}

View File

@ -417,6 +417,9 @@ class MacroAssemblerX86Shared : public Assembler
void storeFloat(FloatRegister src, const BaseIndex &dest) {
movss(src, Operand(dest));
}
void storeFloat(FloatRegister src, const Operand &dest) {
movss(src, dest);
}
void moveFloat(FloatRegister src, FloatRegister dest) {
movss(src, dest);
}

View File

@ -209,10 +209,10 @@ MoveEmitterX86::breakCycle(const MoveOperand &to, Move::Kind kind)
// the original move to continue.
if (kind == Move::DOUBLE) {
if (to.isMemory()) {
masm.movsd(toOperand(to), ScratchFloatReg);
masm.movsd(ScratchFloatReg, cycleSlot());
masm.loadDouble(toOperand(to), ScratchFloatReg);
masm.storeDouble(ScratchFloatReg, cycleSlot());
} else {
masm.movsd(to.floatReg(), cycleSlot());
masm.storeDouble(to.floatReg(), cycleSlot());
}
} else {
if (to.isMemory())
@ -233,10 +233,10 @@ MoveEmitterX86::completeCycle(const MoveOperand &to, Move::Kind kind)
// saved value of B, to A.
if (kind == Move::DOUBLE) {
if (to.isMemory()) {
masm.movsd(cycleSlot(), ScratchFloatReg);
masm.movsd(ScratchFloatReg, toOperand(to));
masm.loadDouble(cycleSlot(), ScratchFloatReg);
masm.storeDouble(ScratchFloatReg, toOperand(to));
} else {
masm.movsd(cycleSlot(), to.floatReg());
masm.loadDouble(cycleSlot(), to.floatReg());
}
} else {
if (to.isMemory()) {
@ -292,12 +292,12 @@ MoveEmitterX86::emitDoubleMove(const MoveOperand &from, const MoveOperand &to)
if (from.isFloatReg()) {
masm.movsd(from.floatReg(), toOperand(to));
} else if (to.isFloatReg()) {
masm.movsd(toOperand(from), to.floatReg());
masm.loadDouble(toOperand(from), to.floatReg());
} else {
// Memory to memory float move.
JS_ASSERT(from.isMemory());
masm.movsd(toOperand(from), ScratchFloatReg);
masm.movsd(ScratchFloatReg, toOperand(to));
masm.loadDouble(toOperand(from), ScratchFloatReg);
masm.storeDouble(ScratchFloatReg, toOperand(to));
}
}

View File

@ -196,7 +196,7 @@ CodeGeneratorX64::storeUnboxedValue(const LAllocation *value, MIRType valueType,
Operand dest, MIRType slotType)
{
if (valueType == MIRType_Double) {
masm.movsd(ToFloatRegister(value), dest);
masm.storeDouble(ToFloatRegister(value), dest);
return;
}
@ -418,7 +418,7 @@ CodeGeneratorX64::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins)
if (vt == ArrayBufferView::TYPE_FLOAT32) {
FloatRegister dest = ToFloatRegister(ins->output());
uint32_t before = masm.size();
masm.movss(srcAddr, dest);
masm.loadFloat(srcAddr, dest);
uint32_t after = masm.size();
masm.cvtss2sd(dest, dest);
return skipNote || gen->noteHeapAccess(AsmJSHeapAccess(before, after, vt, ToAnyRegister(ins->output())));
@ -432,7 +432,7 @@ CodeGeneratorX64::visitAsmJSLoadHeap(LAsmJSLoadHeap *ins)
case ArrayBufferView::TYPE_UINT16: masm.movzwl(srcAddr, ToRegister(ins->output())); break;
case ArrayBufferView::TYPE_INT32:
case ArrayBufferView::TYPE_UINT32: masm.movl(srcAddr, ToRegister(ins->output())); break;
case ArrayBufferView::TYPE_FLOAT64: masm.movsd(srcAddr, ToFloatRegister(ins->output())); break;
case ArrayBufferView::TYPE_FLOAT64: masm.loadDouble(srcAddr, ToFloatRegister(ins->output())); break;
default: MOZ_ASSUME_UNREACHABLE("unexpected array type");
}
uint32_t after = masm.size();
@ -462,7 +462,7 @@ CodeGeneratorX64::visitAsmJSStoreHeap(LAsmJSStoreHeap *ins)
if (vt == ArrayBufferView::TYPE_FLOAT32) {
masm.convertDoubleToFloat(ToFloatRegister(ins->value()), ScratchFloatReg);
uint32_t before = masm.size();
masm.movss(ScratchFloatReg, dstAddr);
masm.storeFloat(ScratchFloatReg, dstAddr);
uint32_t after = masm.size();
return skipNote || gen->noteHeapAccess(AsmJSHeapAccess(before, after));
}
@ -486,7 +486,7 @@ CodeGeneratorX64::visitAsmJSStoreHeap(LAsmJSStoreHeap *ins)
case ArrayBufferView::TYPE_UINT16: masm.movw(ToRegister(ins->value()), dstAddr); break;
case ArrayBufferView::TYPE_INT32:
case ArrayBufferView::TYPE_UINT32: masm.movl(ToRegister(ins->value()), dstAddr); break;
case ArrayBufferView::TYPE_FLOAT64: masm.movsd(ToFloatRegister(ins->value()), dstAddr); break;
case ArrayBufferView::TYPE_FLOAT64: masm.storeDouble(ToFloatRegister(ins->value()), dstAddr); break;
default: MOZ_ASSUME_UNREACHABLE("unexpected array type");
}
}

View File

@ -902,7 +902,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
unboxInt32(Operand(src), dest);
}
void unboxDouble(const Address &src, const FloatRegister &dest) {
movsd(Operand(src), dest);
loadDouble(Operand(src), dest);
}
void unboxArgObjMagic(const ValueOperand &src, const Register &dest) {
@ -1075,7 +1075,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
convertInt32ToDouble(operand, dest);
jump(&end);
bind(&notInt32);
movsd(operand, dest);
loadDouble(operand, dest);
bind(&end);
}

View File

@ -185,7 +185,7 @@ CodeGeneratorX86::visitStoreSlotT(LStoreSlotT *store)
emitPreBarrier(Address(base, offset), store->mir()->slotType());
if (valueType == MIRType_Double) {
masm.movsd(ToFloatRegister(value), Operand(base, offset));
masm.storeDouble(ToFloatRegister(value), Operand(base, offset));
return true;
}
@ -237,7 +237,7 @@ CodeGeneratorX86::storeElementTyped(const LAllocation *value, MIRType valueType,
Operand dest = createArrayElementOperand(elements, index);
if (valueType == MIRType_Double) {
masm.movsd(ToFloatRegister(value), dest);
masm.storeDouble(ToFloatRegister(value), dest);
return;
}
@ -710,7 +710,7 @@ CodeGeneratorX86::postAsmJSCall(LAsmJSCall *lir)
masm.reserveStack(sizeof(double));
masm.fstp(Operand(esp, 0));
masm.movsd(Operand(esp, 0), ReturnFloatReg);
masm.loadDouble(Operand(esp, 0), ReturnFloatReg);
masm.freeStack(sizeof(double));
}
@ -796,7 +796,7 @@ CodeGeneratorX86::visitOutOfLineTruncate(OutOfLineTruncate *ool)
if (Assembler::HasSSE3()) {
// Push double.
masm.subl(Imm32(sizeof(double)), esp);
masm.movsd(input, Operand(esp, 0));
masm.storeDouble(input, Operand(esp, 0));
static const uint32_t EXPONENT_MASK = 0x7ff00000;
static const uint32_t EXPONENT_SHIFT = DoubleExponentShift - 32;

View File

@ -236,7 +236,7 @@ MacroAssemblerX86::callWithABIPost(uint32_t stackAdjust, Result result)
if (result == DOUBLE) {
reserveStack(sizeof(double));
fstp(Operand(esp, 0));
movsd(Operand(esp, 0), ReturnFloatReg);
loadDouble(Operand(esp, 0), ReturnFloatReg);
freeStack(sizeof(double));
}
if (dynamicAlignment_)

View File

@ -768,7 +768,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
movl(payloadOf(src), dest);
}
void unboxDouble(const Address &src, const FloatRegister &dest) {
movsd(Operand(src), dest);
loadDouble(Operand(src), dest);
}
void unboxBoolean(const ValueOperand &src, const Register &dest) {
movl(src.payloadReg(), dest);
@ -915,7 +915,7 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
convertInt32ToDouble(ToPayload(operand), dest);
jump(&end);
bind(&notInt32);
movsd(operand, dest);
loadDouble(operand, dest);
bind(&end);
}