diff --git a/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp b/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp index be479f4ec4..536752a65a 100644 --- a/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp +++ b/plugins/GSdx/GSDrawScanlineCodeGenerator.cpp @@ -26,7 +26,7 @@ #else void GSDrawScanlineCodeGenerator::Generate() { - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) Generate_AVX(); else Generate_SSE(); @@ -124,7 +124,7 @@ GSDrawScanlineCodeGenerator::GSDrawScanlineCodeGenerator(void* param, uint64 key void GSDrawScanlineCodeGenerator::modulate16(const Xmm& a, const Operand& f, uint8 shift) { - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) { if(shift == 0) { @@ -153,7 +153,7 @@ void GSDrawScanlineCodeGenerator::modulate16(const Xmm& a, const Operand& f, uin void GSDrawScanlineCodeGenerator::lerp16(const Xmm& a, const Xmm& b, const Xmm& f, uint8 shift) { - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) { vpsubw(a, b); modulate16(a, f, shift); @@ -169,7 +169,7 @@ void GSDrawScanlineCodeGenerator::lerp16(const Xmm& a, const Xmm& b, const Xmm& void GSDrawScanlineCodeGenerator::lerp16_4(const Xmm& a, const Xmm& b, const Xmm& f) { - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) { vpsubw(a, b); vpmullw(a, f); @@ -187,13 +187,13 @@ void GSDrawScanlineCodeGenerator::lerp16_4(const Xmm& a, const Xmm& b, const Xmm void GSDrawScanlineCodeGenerator::mix16(const Xmm& a, const Xmm& b, const Xmm& temp) { - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) { vpblendw(a, b, 0xaa); } else { - if(g_cpu.has(util::Cpu::tSSE41)) + if(m_cpu.has(util::Cpu::tSSE41)) { pblendw(a, b, 0xaa); } @@ -210,13 +210,13 @@ void GSDrawScanlineCodeGenerator::mix16(const Xmm& a, const Xmm& b, const Xmm& t void GSDrawScanlineCodeGenerator::clamp16(const Xmm& a, const Xmm& temp) { - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) { vpackuswb(a, a); #if _M_SSE >= 0x501 // Greg: why ? - if(g_cpu.has(util::Cpu::tAVX2)) { + if(m_cpu.has(util::Cpu::tAVX2)) { ASSERT(a.isYMM()); vpermq(Ymm(a.getIdx()), Ymm(a.getIdx()), _MM_SHUFFLE(3, 1, 2, 0)); // this sucks } @@ -226,7 +226,7 @@ void GSDrawScanlineCodeGenerator::clamp16(const Xmm& a, const Xmm& temp) } else { - if(g_cpu.has(util::Cpu::tSSE41)) + if(m_cpu.has(util::Cpu::tSSE41)) { packuswb(a, a); pmovzxbw(a, a); @@ -244,7 +244,7 @@ void GSDrawScanlineCodeGenerator::alltrue(const Xmm& test) { uint32 mask = test.isYMM() ? 0xffffffff : 0xffff; - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) { vpmovmskb(eax, test); cmp(eax, mask); @@ -260,7 +260,7 @@ void GSDrawScanlineCodeGenerator::alltrue(const Xmm& test) void GSDrawScanlineCodeGenerator::blend(const Xmm& a, const Xmm& b, const Xmm& mask) { - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) { vpand(b, mask); vpandn(mask, a); @@ -277,7 +277,7 @@ void GSDrawScanlineCodeGenerator::blend(const Xmm& a, const Xmm& b, const Xmm& m void GSDrawScanlineCodeGenerator::blendr(const Xmm& b, const Xmm& a, const Xmm& mask) { - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) { vpand(b, mask); vpandn(mask, a); @@ -293,9 +293,9 @@ void GSDrawScanlineCodeGenerator::blendr(const Xmm& b, const Xmm& a, const Xmm& void GSDrawScanlineCodeGenerator::blend8(const Xmm& a, const Xmm& b) { - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) vpblendvb(a, a, b, xmm0); - else if(g_cpu.has(util::Cpu::tSSE41)) + else if(m_cpu.has(util::Cpu::tSSE41)) pblendvb(a, b); else blend(a, b, xmm0); @@ -303,11 +303,11 @@ void GSDrawScanlineCodeGenerator::blend8(const Xmm& a, const Xmm& b) void GSDrawScanlineCodeGenerator::blend8r(const Xmm& b, const Xmm& a) { - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) { vpblendvb(b, a, b, xmm0); } - else if(g_cpu.has(util::Cpu::tSSE41)) + else if(m_cpu.has(util::Cpu::tSSE41)) { pblendvb(a, b); movdqa(b, a); @@ -323,7 +323,7 @@ void GSDrawScanlineCodeGenerator::split16_2x8(const Xmm& l, const Xmm& h, const // l = src & 0xFF; (1 left shift + 1 right shift) // h = (src >> 8) & 0xFF; (1 right shift) - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) { if (src == h) { vpsllw(l, src, 8); diff --git a/plugins/GSdx/GSDrawScanlineCodeGenerator.x86.cpp b/plugins/GSdx/GSDrawScanlineCodeGenerator.x86.cpp index 3c9f926f16..b29a5eb3f4 100644 --- a/plugins/GSdx/GSDrawScanlineCodeGenerator.x86.cpp +++ b/plugins/GSdx/GSDrawScanlineCodeGenerator.x86.cpp @@ -1069,7 +1069,7 @@ void GSDrawScanlineCodeGenerator::Wrap_SSE(const Xmm& uv0, const Xmm& uv1) movdqa(xmm4, ptr[&m_local.gd->t.min]); movdqa(xmm5, ptr[&m_local.gd->t.max]); - if(g_cpu.has(util::Cpu::tSSE41)) + if(m_cpu.has(util::Cpu::tSSE41)) { movdqa(xmm0, ptr[&m_local.gd->t.mask]); } @@ -1099,7 +1099,7 @@ void GSDrawScanlineCodeGenerator::Wrap_SSE(const Xmm& uv0, const Xmm& uv1) // clamp.blend8(repeat, m_local.gd->t.mask); - if(g_cpu.has(util::Cpu::tSSE41)) + if(m_cpu.has(util::Cpu::tSSE41)) pblendvb(uv0, xmm1); else blendr(uv0, xmm1, xmm0); @@ -1124,7 +1124,7 @@ void GSDrawScanlineCodeGenerator::Wrap_SSE(const Xmm& uv0, const Xmm& uv1) // clamp.blend8(repeat, m_local.gd->t.mask); - if(g_cpu.has(util::Cpu::tSSE41)) + if(m_cpu.has(util::Cpu::tSSE41)) pblendvb(uv1, xmm1); else blendr(uv1, xmm1, xmm6); @@ -1888,7 +1888,7 @@ void GSDrawScanlineCodeGenerator::WrapLOD_SSE(const Xmm& uv0, const Xmm& uv1) } else { - if(g_cpu.has(util::Cpu::tSSE41)) + if(m_cpu.has(util::Cpu::tSSE41)) { movdqa(xmm0, ptr[&m_local.gd->t.mask]); } @@ -1918,7 +1918,7 @@ void GSDrawScanlineCodeGenerator::WrapLOD_SSE(const Xmm& uv0, const Xmm& uv1) // clamp.blend8(repeat, m_local.gd->t.mask); - if(g_cpu.has(util::Cpu::tSSE41)) + if(m_cpu.has(util::Cpu::tSSE41)) pblendvb(uv0, xmm1); else blendr(uv0, xmm1, xmm0); @@ -1943,7 +1943,7 @@ void GSDrawScanlineCodeGenerator::WrapLOD_SSE(const Xmm& uv0, const Xmm& uv1) // clamp.blend8(repeat, m_local.gd->t.mask); - if(g_cpu.has(util::Cpu::tSSE41)) + if(m_cpu.has(util::Cpu::tSSE41)) pblendvb(uv1, xmm1); else blendr(uv1, xmm1, xmm4); @@ -2630,7 +2630,7 @@ void GSDrawScanlineCodeGenerator::AlphaBlend_SSE() if(m_sel.pabe) { - if(!g_cpu.has(util::Cpu::tSSE41)) + if(!m_cpu.has(util::Cpu::tSSE41)) { // doh, previous blend8r overwrote xmm0 (sse41 uses pblendvb) movdqa(xmm0, xmm4); @@ -2823,7 +2823,7 @@ void GSDrawScanlineCodeGenerator::WritePixel_SSE(const Xmm& src, const Reg32& ad case 0: if(i == 0) movd(dst, src); else { - if(g_cpu.has(util::Cpu::tSSE41)) { + if(m_cpu.has(util::Cpu::tSSE41)) { pextrd(dst, src, i); } else { pshufd(xmm0, src, _MM_SHUFFLE(i, i, i, i)); @@ -2835,7 +2835,7 @@ void GSDrawScanlineCodeGenerator::WritePixel_SSE(const Xmm& src, const Reg32& ad case 1: if(i == 0) movd(eax, src); else { - if(g_cpu.has(util::Cpu::tSSE41)) { + if(m_cpu.has(util::Cpu::tSSE41)) { pextrd(eax, src, i); } else { pshufd(xmm0, src, _MM_SHUFFLE(i, i, i, i)); @@ -2879,7 +2879,7 @@ void GSDrawScanlineCodeGenerator::ReadTexel_SSE(int pixels, int mip_offset) if(m_sel.mmin && !m_sel.lcm) { - if(g_cpu.has(util::Cpu::tSSE41)) + if(m_cpu.has(util::Cpu::tSSE41)) { const int r[] = {5, 6, 2, 4, 0, 1, 3, 7}; @@ -3038,7 +3038,7 @@ void GSDrawScanlineCodeGenerator::ReadTexel_SSE(int pixels, int mip_offset) const int r[] = {5, 6, 2, 4, 0, 1, 3, 5}; - if(g_cpu.has(util::Cpu::tSSE41)) + if(m_cpu.has(util::Cpu::tSSE41)) { for(int i = 0; i < pixels; i++) { @@ -3081,7 +3081,7 @@ void GSDrawScanlineCodeGenerator::ReadTexel_SSE(const Xmm& dst, const Xmm& addr, { const Address& src = m_sel.tlu ? ptr[edx + eax * 4] : ptr[ebx + eax * 4]; - ASSERT(i == 0 || g_cpu.has(util::Cpu::tSSE41)); + ASSERT(i == 0 || m_cpu.has(util::Cpu::tSSE41)); if(i == 0) movd(eax, addr); else pextrd(eax, addr, i); diff --git a/plugins/GSdx/GSSetupPrimCodeGenerator.cpp b/plugins/GSdx/GSSetupPrimCodeGenerator.cpp index ca170bd483..de731c84fa 100644 --- a/plugins/GSdx/GSSetupPrimCodeGenerator.cpp +++ b/plugins/GSdx/GSSetupPrimCodeGenerator.cpp @@ -80,7 +80,7 @@ GSSetupPrimCodeGenerator::GSSetupPrimCodeGenerator(void* param, uint64 key, void #if _M_SSE >= 0x501 Generate_AVX2(); #else - if(g_cpu.has(util::Cpu::tAVX)) + if(m_cpu.has(util::Cpu::tAVX)) Generate_AVX(); else Generate_SSE(); diff --git a/plugins/GSdx/GSUtil.cpp b/plugins/GSdx/GSUtil.cpp index 193a56663f..d7d257553f 100644 --- a/plugins/GSdx/GSUtil.cpp +++ b/plugins/GSdx/GSUtil.cpp @@ -39,9 +39,11 @@ const char* GSUtil::GetLibName() // being optimised by GCC to be unusable by older CPUs. Enjoy! static char name[255]; +#if _M_SSE < 0x501 const char* sw_sse = g_cpu.has(Xbyak::util::Cpu::tAVX) ? "AVX" : g_cpu.has(Xbyak::util::Cpu::tSSE41) ? "SSE41" : g_cpu.has(Xbyak::util::Cpu::tSSSE3) ? "SSSE3" : "SSE2"; +#endif snprintf(name, sizeof(name), "GSdx "