VertexLoaderX64: save XMM0 if the ABI requires it

This commit is contained in:
Tillmann Karras 2015-01-26 00:55:33 +01:00
parent 8416a86b6d
commit 3dbd6cd384
1 changed files with 7 additions and 1 deletions

View File

@ -11,6 +11,8 @@
using namespace Gen; using namespace Gen;
#define VERTEX_LOADER_REGS {XMM0+16}
static const X64Reg src_reg = ABI_PARAM1; static const X64Reg src_reg = ABI_PARAM1;
static const X64Reg dst_reg = ABI_PARAM2; static const X64Reg dst_reg = ABI_PARAM2;
static const X64Reg scratch1 = RAX; static const X64Reg scratch1 = RAX;
@ -293,10 +295,12 @@ void VertexLoaderX64::ReadColor(OpArg data, u64 attribute, int format)
void VertexLoaderX64::GenerateVertexLoader() void VertexLoaderX64::GenerateVertexLoader()
{ {
ABI_PushRegistersAndAdjustStack(VERTEX_LOADER_REGS, 8);
// Backup count since we're going to count it down. // Backup count since we're going to count it down.
PUSH(32, R(ABI_PARAM3)); PUSH(32, R(ABI_PARAM3));
// We use ABI_PARAM3 for scratch2. // ABI_PARAM3 is one of the lower registers, so free it for scratch2.
MOV(32, R(count_reg), R(ABI_PARAM3)); MOV(32, R(count_reg), R(ABI_PARAM3));
if (m_VtxDesc.Position & MASK_INDEXED) if (m_VtxDesc.Position & MASK_INDEXED)
@ -427,6 +431,8 @@ void VertexLoaderX64::GenerateVertexLoader()
// Get the original count. // Get the original count.
POP(32, R(ABI_RETURN)); POP(32, R(ABI_RETURN));
ABI_PopRegistersAndAdjustStack(VERTEX_LOADER_REGS, 8);
if (m_VtxDesc.Position & MASK_INDEXED) if (m_VtxDesc.Position & MASK_INDEXED)
{ {
SUB(32, R(ABI_RETURN), R(skipped_reg)); SUB(32, R(ABI_RETURN), R(skipped_reg));