Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove _M_X86 in favour of _M_X86_64 #10965

Merged
merged 2 commits into from Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 1 addition & 3 deletions CMakeLists.txt
Expand Up @@ -219,9 +219,7 @@ if(ENABLE_GENERIC)
set(_M_GENERIC 1)
add_definitions(-D_M_GENERIC=1)
elseif(_ARCH_64 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64")
set(_M_X86 1)
set(_M_X86_64 1)
add_definitions(-D_M_X86=1)
add_definitions(-D_M_X86_64=1)
check_and_add_flag(HAVE_SSE2 -msse2)
elseif(_ARCH_64 AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64")
Expand Down Expand Up @@ -625,7 +623,7 @@ endif()
# - place the CMakeLists.txt in the first-level subdirectory, e.g.
# Externals/zlib/CMakeLists.txt (that is: NOT in some Src/ subdirectory)
#
if (_M_X86)
if (_M_X86_64)
add_subdirectory(Externals/Bochs_disasm)
endif()
add_subdirectory(Externals/cpp-optparse)
Expand Down
4 changes: 2 additions & 2 deletions Externals/liblzma/config.h
Expand Up @@ -151,7 +151,7 @@
/* Define if you have the iconv() function and it works. */
/* #undef HAVE_ICONV */

#ifdef _M_X86
#ifdef _M_X86_64
/* Define to 1 if you have the <immintrin.h> header file. */
#define HAVE_IMMINTRIN_H 1
#endif
Expand Down Expand Up @@ -367,7 +367,7 @@
sysctl(). */
/* #undef TUKLIB_CPUCORES_SYSCTL */

#ifdef _M_X86
#ifdef _M_X86_64
/* Define to 1 if the system supports fast unaligned access to 16-bit and
32-bit integers. */
#define TUKLIB_FAST_UNALIGNED_ACCESS 1
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Common/CMakeLists.txt
Expand Up @@ -220,7 +220,7 @@ if(_M_ARM_64)
ArmFPURoundMode.cpp
)
else()
if(_M_X86) #X86
if(_M_X86_64) #X86
target_sources(common PRIVATE
x64ABI.cpp
x64ABI.h
Expand Down
26 changes: 1 addition & 25 deletions Source/Core/Common/Hash.cpp
Expand Up @@ -359,30 +359,6 @@ static u64 GetHash64_SSE42_CRC32(const u8* src, u32 len, u32 samples)
return h[0] + (h[1] << 10) + (h[2] << 21) + (h[3] << 32);
}

#elif defined(_M_X86)
Zopolis4 marked this conversation as resolved.
Show resolved Hide resolved

FUNCTION_TARGET_SSE42
static u64 GetHash64_SSE42_CRC32(const u8* src, u32 len, u32 samples)
{
u32 h = len;
u32 Step = (len / 4);
const u32* data = (const u32*)src;
const u32* end = data + Step;
if (samples == 0)
samples = std::max(Step, 1u);
Step = Step / samples;
if (Step < 1)
Step = 1;
while (data < end)
{
h = _mm_crc32_u32(h, data[0]);
data += Step;
}

const u8* data2 = (const u8*)end;
return (u64)_mm_crc32_u32(h, u32(data2[0]));
}

#elif defined(_M_ARM_64)

static u64 GetHash64_ARMv8_CRC32(const u8* src, u32 len, u32 samples)
Expand Down Expand Up @@ -433,7 +409,7 @@ static u64 SetHash64Function(const u8* src, u32 len, u32 samples)
{
if (cpu_info.bCRC32)
{
#if defined(_M_X86_64) || defined(_M_X86)
#if defined(_M_X86_64)
s_texture_hash_func = &GetHash64_SSE42_CRC32;
#elif defined(_M_ARM_64)
s_texture_hash_func = &GetHash64_ARMv8_CRC32;
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/Common/Intrinsics.h
Expand Up @@ -3,7 +3,7 @@

#pragma once

#if defined(_M_X86)
#if defined(_M_X86_64)

/**
* It is assumed that all compilers used to build Dolphin support intrinsics up to and including
Expand Down Expand Up @@ -49,13 +49,13 @@

#endif // defined(_MSC_VER) || defined(__INTEL_COMPILER)

#endif // _M_X86
#endif // _M_X86_64

/**
* Define the FUNCTION_TARGET macros to nothing if they are not needed, or not on an X86 platform.
* This way when a function is defined with FUNCTION_TARGET you don't need to define a second
* version without the macro around a #ifdef guard. Be careful when using intrinsics, as all use
* should still be placed around a #ifdef _M_X86 if the file is compiled on all architectures.
* should still be placed around a #ifdef _M_X86_64 if the file is compiled on all architectures.
*/
#ifndef FUNCTION_TARGET_SSE42
#define FUNCTION_TARGET_SSE42
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/CMakeLists.txt
Expand Up @@ -537,7 +537,7 @@ add_library(core
WiiUtils.h
)

if(_M_X86)
if(_M_X86_64)
target_sources(core PRIVATE
DSP/Jit/x64/DSPEmitter.cpp
DSP/Jit/x64/DSPEmitter.h
Expand Down Expand Up @@ -640,7 +640,7 @@ PRIVATE
)

if ((DEFINED CMAKE_ANDROID_ARCH_ABI AND CMAKE_ANDROID_ARCH_ABI MATCHES "x86|x86_64") OR
(NOT DEFINED CMAKE_ANDROID_ARCH_ABI AND _M_X86))
(NOT DEFINED CMAKE_ANDROID_ARCH_ABI AND _M_X86_64))
target_link_libraries(core PRIVATE bdisasm)
endif()

Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/DSP/Jit/DSPEmitterBase.cpp
Expand Up @@ -3,7 +3,7 @@

#include "Core/DSP/Jit/DSPEmitterBase.h"

#if defined(_M_X86) || defined(_M_X86_64)
#if defined(_M_X86_64)
#include "Core/DSP/Jit/x64/DSPEmitter.h"
#endif

Expand All @@ -13,7 +13,7 @@ DSPEmitter::~DSPEmitter() = default;

std::unique_ptr<DSPEmitter> CreateDSPEmitter([[maybe_unused]] DSPCore& dsp)
{
#if defined(_M_X86) || defined(_M_X86_64)
#if defined(_M_X86_64)
return std::make_unique<x64::DSPEmitter>(dsp);
#else
return std::make_unique<DSPEmitterNull>();
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/HW/DSPLLE/DSPLLE.cpp
Expand Up @@ -120,7 +120,7 @@ static bool FillDSPInitOptions(DSPInitOptions* opts)
return false;

opts->core_type = DSPInitOptions::CoreType::Interpreter;
#ifdef _M_X86
#ifdef _M_X86_64
if (Config::Get(Config::MAIN_DSP_JIT))
opts->core_type = DSPInitOptions::CoreType::JIT64;
#endif
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/Core/PowerPC/JitInterface.cpp
Expand Up @@ -32,7 +32,7 @@
#include "Core/PowerPC/Profiler.h"
#include "Core/System.h"

#if _M_X86
#if _M_X86_64
#include "Core/PowerPC/Jit64/Jit.h"
#endif

Expand Down Expand Up @@ -61,7 +61,7 @@ CPUCoreBase* JitInterface::InitJitCore(PowerPC::CPUCore core)
{
switch (core)
{
#if _M_X86
#if _M_X86_64
case PowerPC::CPUCore::JIT64:
m_jit = std::make_unique<Jit64>(m_system);
break;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/DolphinQt/Debugger/JITWidget.cpp
Expand Up @@ -53,7 +53,7 @@ JITWidget::JITWidget(QWidget* parent) : QDockWidget(parent)

ConnectWidgets();

#if defined(_M_X86)
#if defined(_M_X86_64)
m_disassembler = GetNewDisassembler("x86");
#elif defined(_M_ARM_64)
m_disassembler = GetNewDisassembler("aarch64");
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/UICommon/CMakeLists.txt
Expand Up @@ -38,7 +38,7 @@ PRIVATE
)

if ((DEFINED CMAKE_ANDROID_ARCH_ABI AND CMAKE_ANDROID_ARCH_ABI MATCHES "x86|x86_64") OR
(NOT DEFINED CMAKE_ANDROID_ARCH_ABI AND _M_X86))
(NOT DEFINED CMAKE_ANDROID_ARCH_ABI AND _M_X86_64))
target_link_libraries(uicommon PRIVATE bdisasm)
endif()

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/UICommon/Disassembler.cpp
Expand Up @@ -9,7 +9,7 @@
#include <fmt/format.h>
#include <llvm-c/Disassembler.h>
#include <llvm-c/Target.h>
#elif defined(_M_X86)
#elif defined(_M_X86_64)
#include <disasm.h> // Bochs
#endif

Expand Down Expand Up @@ -117,7 +117,7 @@ std::string HostDisassemblerLLVM::DisassembleHostBlock(const u8* code_start, con

return x86_disasm.str();
}
#elif defined(_M_X86)
#elif defined(_M_X86_64)
class HostDisassemblerX86 : public HostDisassembler
{
public:
Expand Down Expand Up @@ -163,7 +163,7 @@ std::unique_ptr<HostDisassembler> GetNewDisassembler(const std::string& arch)
return std::make_unique<HostDisassemblerLLVM>("aarch64-none-unknown", 4, "cortex-a57");
if (arch == "armv7")
return std::make_unique<HostDisassemblerLLVM>("armv7-none-unknown", 4, "cortex-a15");
#elif defined(_M_X86)
#elif defined(_M_X86_64)
if (arch == "x86")
return std::make_unique<HostDisassemblerX86>();
#endif
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/CMakeLists.txt
Expand Up @@ -216,7 +216,7 @@ PRIVATE
glslang
)

if(_M_X86)
if(_M_X86_64)
target_sources(videocommon PRIVATE
TextureDecoder_x64.cpp
VertexLoaderX64.cpp
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/VideoCommon/TextureCacheBase.cpp
Expand Up @@ -10,7 +10,7 @@
#include <string>
#include <utility>
#include <vector>
#if defined(_M_X86) || defined(_M_X86_64)
#if defined(_M_X86_64)
#include <pmmintrin.h>
#endif

Expand Down Expand Up @@ -2654,15 +2654,15 @@ void TextureCacheBase::UninitializeXFBMemory(u8* dst, u32 stride, u32 bytes_per_
// (Y=1,U=254,V=254) instead of dark green (Y=0,U=0,V=0) in YUV
// like is done in the EFB path.

#if defined(_M_X86) || defined(_M_X86_64)
#if defined(_M_X86_64)
__m128i sixteenBytes = _mm_set1_epi16((s16)(u16)0xFE01);
#endif

for (u32 i = 0; i < num_blocks_y; i++)
{
u32 size = bytes_per_row;
u8* rowdst = dst;
#if defined(_M_X86) || defined(_M_X86_64)
#if defined(_M_X86_64)
while (size >= 16)
{
_mm_storeu_si128((__m128i*)rowdst, sixteenBytes);
Expand Down
2 changes: 1 addition & 1 deletion Source/UnitTests/Common/CMakeLists.txt
Expand Up @@ -18,7 +18,7 @@ add_dolphin_test(SPSCQueueTest SPSCQueueTest.cpp)
add_dolphin_test(StringUtilTest StringUtilTest.cpp)
add_dolphin_test(SwapTest SwapTest.cpp)

if (_M_X86)
if (_M_X86_64)
add_dolphin_test(x64EmitterTest x64EmitterTest.cpp)
target_link_libraries(x64EmitterTest PRIVATE bdisasm)
elseif (_M_ARM_64)
Expand Down
2 changes: 1 addition & 1 deletion Source/UnitTests/Core/CMakeLists.txt
Expand Up @@ -17,7 +17,7 @@ add_dolphin_test(FileSystemTest IOS/FS/FileSystemTest.cpp)

add_dolphin_test(SkylandersTest IOS/USB/SkylandersTest.cpp)

if(_M_X86)
if(_M_X86_64)
add_dolphin_test(PowerPCTest
PowerPC/DivUtilsTest.cpp
PowerPC/Jit64Common/ConvertDoubleToSingle.cpp
Expand Down
2 changes: 1 addition & 1 deletion Source/VSProps/Base.Dolphin.props
Expand Up @@ -33,7 +33,7 @@
<PreprocessorDefinitions>_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING;%(PreprocessorDefinitions)</PreprocessorDefinitions>

<!--Dolphin-specific definitions-->
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">_ARCH_64=1;_M_X86=1;_M_X86_64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='x64'">_ARCH_64=1;_M_X86_64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='ARM64'">_ARCH_64=1;_M_ARM_64=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>USE_UPNP;__LIBUSB__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>USE_ANALYTICS=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down