From ccb69a858fcf1b42ff36605007aeabc3dbb4a8d7 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Thu, 7 Aug 2014 14:33:55 +0200 Subject: [PATCH] V4 JIT: tweak generated int32 to double conversion code If the target is a FP register, and the source is a memory address, do not load the int32 ourselves, but leave it to the assembler to decide what to do. On x86(_64) this is generates a single instruction, while on ARM the assembler will insert a load on its own. For the case where the target is not a FP register, use the return value register as base register for the target address. The advantage is that the address calculation is now independent of the preceding conversion, so it can fit in a different pipeline without dependencies. Change-Id: Ib7cefa636274ba8596e4d11ae0170a091a0def3e Reviewed-by: Simon Hausmann --- src/qml/jit/qv4isel_masm_p.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qml/jit/qv4isel_masm_p.h b/src/qml/jit/qv4isel_masm_p.h index f54b18d..af518a0 100644 --- a/src/qml/jit/qv4isel_masm_p.h +++ b/src/qml/jit/qv4isel_masm_p.h @@ -179,6 +179,15 @@ private: { if (IR::Temp *targetTemp = target->asTemp()) { if (targetTemp->kind == IR::Temp::PhysicalRegister) { + if (IR::Temp *sourceTemp = source->asTemp()) { + if (sourceTemp->kind == IR::Temp::PhysicalRegister) { + _as->convertInt32ToDouble((Assembler::RegisterID) sourceTemp->index, + (Assembler::FPRegisterID) targetTemp->index); + } else { + _as->convertInt32ToDouble(_as->loadAddress(Assembler::ReturnValueRegister, sourceTemp), + (Assembler::FPRegisterID) targetTemp->index); + } + } _as->convertInt32ToDouble(_as->toInt32Register(source, Assembler::ScratchRegister), (Assembler::FPRegisterID) targetTemp->index); return; @@ -187,7 +196,7 @@ private: _as->convertInt32ToDouble(_as->toInt32Register(source, Assembler::ScratchRegister), Assembler::FPGpr0); - _as->storeDouble(Assembler::FPGpr0, _as->loadAddress(Assembler::ScratchRegister, target)); + _as->storeDouble(Assembler::FPGpr0, _as->loadAddress(Assembler::ReturnValueRegister, target)); } void convertUIntToDouble(IR::Expr *source, IR::Expr *target) -- 2.7.4