From 0850a3fab764f4e84ffbd84a66447754db884160 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 13 May 2023 17:23:37 +1000 Subject: [PATCH] Misc: Support building without -fno-operator-names Better to have standard compliance, and MSVC in conformance mode needs it. --- cmake/BuildParameters.cmake | 3 --- .../SW/GSDrawScanlineCodeGenerator.all.cpp | 22 +++++++++---------- pcsx2/GS/Renderers/SW/GSNewCodeGenerator.h | 14 ++++-------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index 05ee34e5bd..82b38bfe26 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -139,9 +139,6 @@ if(MSVC AND NOT USE_CLANG_CL) add_compile_options("$<$:/Zc:externConstexpr>") elseif(NOT MSVC) add_compile_options(-pipe -fvisibility=hidden -pthread -fno-builtin-strcmp -fno-builtin-memcmp -mfpmath=sse) - - # -fno-operator-names should only be for C++ files, not C files. - add_compile_options($<$:-fno-operator-names>) endif() set(CONFIG_REL_NO_DEB $,$>) diff --git a/pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.all.cpp b/pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.all.cpp index 89bcffaa0a..b2d9b38056 100644 --- a/pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.all.cpp +++ b/pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.all.cpp @@ -603,7 +603,7 @@ void GSDrawScanlineCodeGenerator2::Init() // int skip = left & 3; mov(ebx, a1.cvt32()); - and(a1.cvt32(), vecints - 1); + and_(a1.cvt32(), vecints - 1); // left -= skip; @@ -617,7 +617,7 @@ void GSDrawScanlineCodeGenerator2::Init() mov(eax, a0.cvt32()); sar(eax, 31); // GH: 31 to extract the sign of the register - and(eax, a0.cvt32()); + and_(eax, a0.cvt32()); if (isXmm) shl(eax, 4); // * sizeof(m_test[0]) cdqe(); @@ -641,7 +641,7 @@ void GSDrawScanlineCodeGenerator2::Init() else { mov(ebx, a1.cvt32()); // left - xor(a1.cvt32(), a1.cvt32()); // skip + xor_(a1.cvt32(), a1.cvt32()); // skip lea(a0.cvt32(), ptr[a0 - vecints]); // steps } @@ -1006,7 +1006,7 @@ void GSDrawScanlineCodeGenerator2::Step() mov(eax, a0.cvt32()); sar(eax, 31); // GH: 31 to extract the sign of the register - and(eax, a0.cvt32()); + and_(eax, a0.cvt32()); if (isXmm) shl(eax, 4); cdqe(); @@ -1035,7 +1035,7 @@ void GSDrawScanlineCodeGenerator2::TestZ(const XYm& temp1, const XYm& temp2) mov(t2.cvt32(), dword[t1 + 4]); add(t2.cvt32(), dword[t0 + 4]); - and(t2.cvt32(), HALF_VM_SIZE - 1); + and_(t2.cvt32(), HALF_VM_SIZE - 1); // GSVector4i zs = zi; @@ -2411,7 +2411,7 @@ void GSDrawScanlineCodeGenerator2::ReadFrame() mov(ebx, dword[t1]); add(ebx, dword[t0]); - and(ebx, HALF_VM_SIZE - 1); + and_(ebx, HALF_VM_SIZE - 1); if (!m_sel.rfb) { @@ -2513,7 +2513,7 @@ void GSDrawScanlineCodeGenerator2::WriteMask() pmovmskb(edx, xym1); - not(edx); + not_(edx); } /// Inputs: t2=za, edx=fzm, _zm @@ -2840,7 +2840,7 @@ void GSDrawScanlineCodeGenerator2::WriteFrame() // y = (top & 3) << 5 mov(eax, ptr[rsp + _top]); - and(eax, 3); + and_(eax, 3); shl(eax, 5); // rb = rb.add16(m_global.dimx[0 + y]); @@ -3089,9 +3089,9 @@ void GSDrawScanlineCodeGenerator2::WritePixel(const Xmm& src, const AddressReg& movd(eax, src); else pextrd(eax, src, j); - xor(eax, dst); - and(eax, 0xffffff); - xor(dst, eax); + xor_(eax, dst); + and_(eax, 0xffffff); + xor_(dst, eax); break; case 2: if (j == 0) diff --git a/pcsx2/GS/Renderers/SW/GSNewCodeGenerator.h b/pcsx2/GS/Renderers/SW/GSNewCodeGenerator.h index da84a071cc..4f7cbbf9ad 100644 --- a/pcsx2/GS/Renderers/SW/GSNewCodeGenerator.h +++ b/pcsx2/GS/Renderers/SW/GSNewCodeGenerator.h @@ -15,13 +15,7 @@ #pragma once -#if defined(_MSC_VER) && defined(__clang__) -#define and and_ -#define or or_ -#define xor xor_ -#define not not_ #define XBYAK_NO_OP_NAMES -#endif #include "xbyak/xbyak.h" #include "xbyak/xbyak_util.h" @@ -259,16 +253,16 @@ public: void vzeroall() { requireAVX(); actual.vzeroall(); } FORWARD_OO_OI(add) - FORWARD_OO_OI(and) + FORWARD_OO_OI(and_) FORWARD_OO_OI(cmp) - FORWARD_OO_OI(or) + FORWARD_OO_OI(or_) FORWARD_OO_OI(sub) - FORWARD_OO_OI(xor) + FORWARD_OO_OI(xor_) FORWARD(2, BASE, lea, const Reg&, const Address&) FORWARD(2, BASE, mov, const Operand&, size_t) FORWARD(2, BASE, mov, ARGS_OO) FORWARD(2, BASE, movzx, const Reg&, const Operand&) - FORWARD(1, BASE, not, const Operand&) + FORWARD(1, BASE, not_, const Operand&) FORWARD(1, BASE, pop, const Operand&) FORWARD(1, BASE, push, const Operand&) FORWARD(2, BASE, sar, const Operand&, const Reg8&)