gsdx sw JIT: dynamically select ISA for SetupPrim

This commit is contained in:
Gregory Hainaut 2016-11-19 15:11:16 +01:00
parent 574a2c774e
commit 8fd46e96aa
6 changed files with 60 additions and 34 deletions

View File

@ -22,6 +22,8 @@
#include "stdafx.h"
#include "GSSetupPrimCodeGenerator.h"
using namespace Xbyak;
#if _M_SSE >= 0x501
GSVector8 GSSetupPrimCodeGenerator::m_shift[9];
#else
@ -75,3 +77,14 @@ GSSetupPrimCodeGenerator::GSSetupPrimCodeGenerator(void* param, uint64 key, void
Generate();
}
#if _M_SSE >= 0x501
#else
void GSSetupPrimCodeGenerator::Generate()
{
if(g_cpu.has(util::Cpu::tAVX))
Generate_AVX();
else
Generate_SSE();
}
#endif

View File

@ -23,6 +23,7 @@
#include "GSScanlineEnvironment.h"
#include "GSFunctionMap.h"
#include "GSUtil.h"
class GSSetupPrimCodeGenerator : public GSCodeGenerator
{
@ -35,9 +36,21 @@ class GSSetupPrimCodeGenerator : public GSCodeGenerator
void Generate();
#if _M_SSE < 0x501
void Generate_SSE();
void Depth_SSE();
void Texture_SSE();
void Color_SSE();
void Generate_AVX();
void Depth_AVX();
void Texture_AVX();
void Color_AVX();
#else
void Depth();
void Texture();
void Color();
#endif
public:
GSSetupPrimCodeGenerator(void* param, uint64 key, void* code, size_t maxsize);

View File

@ -23,11 +23,11 @@
#include "GSSetupPrimCodeGenerator.h"
#include "GSVertexSW.h"
#if _M_SSE == 0x500 && (defined(_M_AMD64) || defined(_WIN64))
#if _M_SSE < 0x501 && (defined(_M_AMD64) || defined(_WIN64))
using namespace Xbyak;
void GSSetupPrimCodeGenerator::Generate()
void GSSetupPrimCodeGenerator::Generate_AVX()
{
#ifdef _WIN64
sub(rsp, 8 + 2 * 16);
@ -48,11 +48,11 @@ void GSSetupPrimCodeGenerator::Generate()
}
}
Depth();
Depth_AVX();
Texture();
Texture_AVX();
Color();
Color_AVX();
#ifdef _WIN64
vmovdqa(xmm6, ptr[rsp + 0]);
@ -64,7 +64,7 @@ void GSSetupPrimCodeGenerator::Generate()
ret();
}
void GSSetupPrimCodeGenerator::Depth()
void GSSetupPrimCodeGenerator::Depth_AVX()
{
if(!m_en.z && !m_en.f)
{
@ -158,7 +158,7 @@ void GSSetupPrimCodeGenerator::Depth()
}
}
void GSSetupPrimCodeGenerator::Texture()
void GSSetupPrimCodeGenerator::Texture_AVX()
{
if(!m_en.t)
{
@ -234,7 +234,7 @@ void GSSetupPrimCodeGenerator::Texture()
}
}
void GSSetupPrimCodeGenerator::Color()
void GSSetupPrimCodeGenerator::Color_AVX()
{
if(!m_en.c)
{

View File

@ -23,11 +23,11 @@
#include "GSSetupPrimCodeGenerator.h"
#include "GSVertexSW.h"
#if _M_SSE < 0x500 && (defined(_M_AMD64) || defined(_WIN64))
#if _M_SSE < 0x501 && (defined(_M_AMD64) || defined(_WIN64))
using namespace Xbyak;
void GSSetupPrimCodeGenerator::Generate()
void GSSetupPrimCodeGenerator::Generate_SSE()
{
#ifdef _WIN64
sub(rsp, 8 + 2 * 16);
@ -48,11 +48,11 @@ void GSSetupPrimCodeGenerator::Generate()
}
}
Depth();
Depth_SSE();
Texture();
Texture_SSE();
Color();
Color_SSE();
#ifdef _WIN64
vmovdqa(xmm6, ptr[rsp + 0]);
@ -64,7 +64,7 @@ void GSSetupPrimCodeGenerator::Generate()
ret();
}
void GSSetupPrimCodeGenerator::Depth()
void GSSetupPrimCodeGenerator::Depth_SSE()
{
if(!m_en.z && !m_en.f)
{
@ -163,7 +163,7 @@ void GSSetupPrimCodeGenerator::Depth()
}
}
void GSSetupPrimCodeGenerator::Texture()
void GSSetupPrimCodeGenerator::Texture_SSE()
{
if(!m_en.t)
{
@ -242,7 +242,7 @@ void GSSetupPrimCodeGenerator::Texture()
}
}
void GSSetupPrimCodeGenerator::Color()
void GSSetupPrimCodeGenerator::Color_SSE()
{
if(!m_en.c)
{

View File

@ -23,7 +23,7 @@
#include "GSSetupPrimCodeGenerator.h"
#include "GSVertexSW.h"
#if _M_SSE == 0x500 && !(defined(_M_AMD64) || defined(_WIN64))
#if _M_SSE < 0x501 && !(defined(_M_AMD64) || defined(_WIN64))
using namespace Xbyak;
@ -32,7 +32,7 @@ static const int _vertex = _args + 4;
static const int _index = _args + 8;
static const int _dscan = _args + 12;
void GSSetupPrimCodeGenerator::Generate()
void GSSetupPrimCodeGenerator::Generate_AVX()
{
if((m_en.z || m_en.f) && m_sel.prim != GS_SPRITE_CLASS || m_en.t || m_en.c && m_sel.iip)
{
@ -44,16 +44,16 @@ void GSSetupPrimCodeGenerator::Generate()
}
}
Depth();
Depth_AVX();
Texture();
Texture_AVX();
Color();
Color_AVX();
ret();
}
void GSSetupPrimCodeGenerator::Depth()
void GSSetupPrimCodeGenerator::Depth_AVX()
{
if(!m_en.z && !m_en.f)
{
@ -144,7 +144,7 @@ void GSSetupPrimCodeGenerator::Depth()
}
}
void GSSetupPrimCodeGenerator::Texture()
void GSSetupPrimCodeGenerator::Texture_AVX()
{
if(!m_en.t)
{
@ -213,7 +213,7 @@ void GSSetupPrimCodeGenerator::Texture()
}
}
void GSSetupPrimCodeGenerator::Color()
void GSSetupPrimCodeGenerator::Color_AVX()
{
if(!m_en.c)
{
@ -339,4 +339,4 @@ void GSSetupPrimCodeGenerator::Color()
}
}
#endif
#endif

View File

@ -23,7 +23,7 @@
#include "GSSetupPrimCodeGenerator.h"
#include "GSVertexSW.h"
#if _M_SSE < 0x500 && !(defined(_M_AMD64) || defined(_WIN64))
#if _M_SSE < 0x501 && !(defined(_M_AMD64) || defined(_WIN64))
using namespace Xbyak;
@ -32,7 +32,7 @@ static const int _vertex = _args + 4;
static const int _index = _args + 8;
static const int _dscan = _args + 12;
void GSSetupPrimCodeGenerator::Generate()
void GSSetupPrimCodeGenerator::Generate_SSE()
{
if((m_en.z || m_en.f) && m_sel.prim != GS_SPRITE_CLASS || m_en.t || m_en.c && m_sel.iip)
{
@ -44,16 +44,16 @@ void GSSetupPrimCodeGenerator::Generate()
}
}
Depth();
Depth_SSE();
Texture();
Texture_SSE();
Color();
Color_SSE();
ret();
}
void GSSetupPrimCodeGenerator::Depth()
void GSSetupPrimCodeGenerator::Depth_SSE()
{
if(!m_en.z && !m_en.f)
{
@ -149,7 +149,7 @@ void GSSetupPrimCodeGenerator::Depth()
}
}
void GSSetupPrimCodeGenerator::Texture()
void GSSetupPrimCodeGenerator::Texture_SSE()
{
if(!m_en.t)
{
@ -221,7 +221,7 @@ void GSSetupPrimCodeGenerator::Texture()
}
}
void GSSetupPrimCodeGenerator::Color()
void GSSetupPrimCodeGenerator::Color_SSE()
{
if(!m_en.c)
{
@ -354,4 +354,4 @@ void GSSetupPrimCodeGenerator::Color()
}
}
#endif
#endif