From e93c80db4ed3ae5cf5f7e078911ae6faaeb4ed34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 19 Dec 2024 15:22:07 +0100 Subject: [PATCH] Cleaning up our SIMD header includes, using the new header --- Common/TimeUtil.cpp | 2 +- Core/HLE/__sceAudio.cpp | 6 +----- Core/HW/MediaEngine.cpp | 12 ------------ Core/HW/StereoResampler.cpp | 12 +----------- Core/MIPS/IR/IRInterpreter.cpp | 14 +------------- Core/MIPS/MIPSVFPUUtils.cpp | 9 ++++----- Core/MIPS/x86/CompVFPU.cpp | 2 +- Core/Util/AudioFormat.cpp | 13 +------------ GPU/Common/TextureCacheCommon.cpp | 13 +------------ GPU/GLES/TextureCacheGLES.cpp | 4 ---- GPU/GPUState.h | 12 +----------- GPU/Math3D.cpp | 5 +++++ GPU/Math3D.h | 14 +------------- GPU/Software/Lighting.cpp | 6 ++++++ 14 files changed, 24 insertions(+), 100 deletions(-) diff --git a/Common/TimeUtil.cpp b/Common/TimeUtil.cpp index 1c7f17c7a9..57a0f35597 100644 --- a/Common/TimeUtil.cpp +++ b/Common/TimeUtil.cpp @@ -25,7 +25,7 @@ // for _mm_pause #if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64) -#include +#include #endif #include diff --git a/Core/HLE/__sceAudio.cpp b/Core/HLE/__sceAudio.cpp index 4ce1199672..51c5d55836 100644 --- a/Core/HLE/__sceAudio.cpp +++ b/Core/HLE/__sceAudio.cpp @@ -24,11 +24,7 @@ #include "Common/Serialize/SerializeFuncs.h" #include "Common/Data/Collections/FixedSizeQueue.h" #include "Common/System/System.h" - -#ifdef _M_SSE -#include -#endif - +#include "Common/Math/SIMDHeaders.h" #include "Core/Config.h" #include "Core/CoreTiming.h" #include "Core/MemMapHelpers.h" diff --git a/Core/HW/MediaEngine.cpp b/Core/HW/MediaEngine.cpp index 34dfcc8c48..bfe762795c 100644 --- a/Core/HW/MediaEngine.cpp +++ b/Core/HW/MediaEngine.cpp @@ -28,18 +28,6 @@ #include -#ifdef _M_SSE -#include -#endif - -#if PPSSPP_ARCH(ARM_NEON) -#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) -#include -#else -#include -#endif -#endif - #ifdef USE_FFMPEG extern "C" { diff --git a/Core/HW/StereoResampler.cpp b/Core/HW/StereoResampler.cpp index 38909c93e5..793b826f75 100644 --- a/Core/HW/StereoResampler.cpp +++ b/Core/HW/StereoResampler.cpp @@ -40,6 +40,7 @@ #include "Common/Common.h" #include "Common/System/System.h" #include "Common/Log.h" +#include "Common/Math/SIMDHeaders.h" #include "Common/TimeUtil.h" #include "Core/Config.h" #include "Core/ConfigValues.h" @@ -47,17 +48,6 @@ #include "Core/Util/AudioFormat.h" // for clamp_u8 #include "Core/System.h" -#ifdef _M_SSE -#include -#endif -#if PPSSPP_ARCH(ARM_NEON) -#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) -#include -#else -#include -#endif -#endif - StereoResampler::StereoResampler() noexcept : m_maxBufsize(MAX_BUFSIZE_DEFAULT) , m_targetBufsize(TARGET_BUFSIZE_DEFAULT) { diff --git a/Core/MIPS/IR/IRInterpreter.cpp b/Core/MIPS/IR/IRInterpreter.cpp index 766afe6690..2ec166628f 100644 --- a/Core/MIPS/IR/IRInterpreter.cpp +++ b/Core/MIPS/IR/IRInterpreter.cpp @@ -7,19 +7,7 @@ #include "Common/Common.h" #include "Common/Data/Convert/SmallDataConvert.h" #include "Common/Math/math_util.h" - -#ifdef _M_SSE -#include -#endif - -#if PPSSPP_ARCH(ARM_NEON) -#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) -#include -#else -#include -#endif -#endif - +#include "Common/Math/SIMDHeaders.h" #include "Core/Core.h" #include "Core/CoreTiming.h" #include "Core/Debugger/Breakpoints.h" diff --git a/Core/MIPS/MIPSVFPUUtils.cpp b/Core/MIPS/MIPSVFPUUtils.cpp index ef89f89352..ee55a8715b 100644 --- a/Core/MIPS/MIPSVFPUUtils.cpp +++ b/Core/MIPS/MIPSVFPUUtils.cpp @@ -20,6 +20,7 @@ #include "Common/BitScan.h" #include "Common/File/VFS/VFS.h" +#include "Common/Math/SIMDHeaders.h" #include "Common/StringUtils.h" #include "Core/Reporting.h" #include "Core/MIPS/MIPS.h" @@ -711,9 +712,7 @@ static float vfpu_dot_cpp(const float a[4], const float b[4]) { return result.f; } -#if defined(__SSE2__) - -#include +#if PPSSPP_ARCH(SSE2) static inline __m128i mulhi32x4(__m128i a, __m128i b) { __m128i m02 = _mm_mul_epu32(a, b); @@ -873,10 +872,10 @@ static float vfpu_dot_sse2(const float a[4], const float b[4]) return result.f; } -#endif // defined(__SSE2__) +#endif // PPSSPP_ARCH(SSE2) float vfpu_dot(const float a[4], const float b[4]) { -#if defined(__SSE2__) +#if PPSSPP_ARCH(SSE2) return vfpu_dot_sse2(a, b); #else return vfpu_dot_cpp(a, b); diff --git a/Core/MIPS/x86/CompVFPU.cpp b/Core/MIPS/x86/CompVFPU.cpp index 610772e97b..cbb678e2b4 100644 --- a/Core/MIPS/x86/CompVFPU.cpp +++ b/Core/MIPS/x86/CompVFPU.cpp @@ -19,8 +19,8 @@ // short instruction sequences. Surprisingly many are possible. #include "ppsspp_config.h" -#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64) +#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64) #include #include #include diff --git a/Core/Util/AudioFormat.cpp b/Core/Util/AudioFormat.cpp index 8129327db3..317a44b376 100644 --- a/Core/Util/AudioFormat.cpp +++ b/Core/Util/AudioFormat.cpp @@ -19,18 +19,7 @@ #include "Common/Common.h" #include "Common/CPUDetect.h" #include "Core/Util/AudioFormat.h" - -#ifdef _M_SSE -#include -#endif - -#if PPSSPP_ARCH(ARM_NEON) -#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) -#include -#else -#include -#endif -#endif // PPSSPP_ARCH(ARM_NEON) +#include "Common/Math/SIMDHeaders.h" // TODO: This shouldn't be a global. #if PPSSPP_ARCH(ARM_NEON) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 3a0b073a40..4079684cd3 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -26,6 +26,7 @@ #include "Common/LogReporting.h" #include "Common/MemoryUtil.h" #include "Common/StringUtils.h" +#include "Common/Math/SIMDHeaders.h" #include "Common/TimeUtil.h" #include "Common/Math/math_util.h" #include "Common/GPU/thin3d.h" @@ -46,18 +47,6 @@ #include "ext/imgui/imgui_internal.h" #include "ext/imgui/imgui_impl_thin3d.h" - -#if defined(_M_SSE) -#include -#endif -#if PPSSPP_ARCH(ARM_NEON) -#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) -#include -#else -#include -#endif -#endif - // Videos should be updated every few frames, so we forget quickly. #define VIDEO_DECIMATE_AGE 4 diff --git a/GPU/GLES/TextureCacheGLES.cpp b/GPU/GLES/TextureCacheGLES.cpp index 90df708b41..7cb60f8a9e 100644 --- a/GPU/GLES/TextureCacheGLES.cpp +++ b/GPU/GLES/TextureCacheGLES.cpp @@ -33,10 +33,6 @@ #include "GPU/Common/TextureShaderCommon.h" #include "GPU/Common/DrawEngineCommon.h" -#ifdef _M_SSE -#include -#endif - TextureCacheGLES::TextureCacheGLES(Draw::DrawContext *draw, Draw2D *draw2D) : TextureCacheCommon(draw, draw2D) { render_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); diff --git a/GPU/GPUState.h b/GPU/GPUState.h index c15601fdc7..b531833175 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -24,17 +24,7 @@ #include "GPU/GPU.h" #include "GPU/ge_constants.h" #include "GPU/Common/ShaderCommon.h" - -#if defined(_M_SSE) -#include -#endif -#if PPSSPP_ARCH(ARM_NEON) -#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) -#include -#else -#include -#endif -#endif +#include "Common/Math/SIMDHeaders.h" class PointerWrap; diff --git a/GPU/Math3D.cpp b/GPU/Math3D.cpp index c4a6c7ea6d..c380a72022 100644 --- a/GPU/Math3D.cpp +++ b/GPU/Math3D.cpp @@ -18,6 +18,11 @@ #include "Common/Common.h" #include "GPU/Math3D.h" +#if PPSSPP_ARCH(SSE2) +// For the SSE4 stuff. +#include +#endif + namespace Math3D { template<> diff --git a/GPU/Math3D.h b/GPU/Math3D.h index 15ec3ef990..5a3d2f5940 100644 --- a/GPU/Math3D.h +++ b/GPU/Math3D.h @@ -24,19 +24,7 @@ #include "Common/Common.h" #include "Core/Util/AudioFormat.h" // for clamp_u8 #include "Common/Math/fast/fast_matrix.h" - -#if defined(_M_SSE) -#include -#include -#endif - -#if PPSSPP_ARCH(ARM_NEON) -#if defined(_MSC_VER) && PPSSPP_ARCH(ARM64) -#include -#else -#include -#endif -#endif +#include "Common/Math/SIMDHeaders.h" #if PPSSPP_PLATFORM(WINDOWS) && (defined(_MSC_VER) || defined(__clang__) || defined(__INTEL_COMPILER)) #define MATH3D_CALL __vectorcall diff --git a/GPU/Software/Lighting.cpp b/GPU/Software/Lighting.cpp index 49680cc10f..a0681da245 100644 --- a/GPU/Software/Lighting.cpp +++ b/GPU/Software/Lighting.cpp @@ -19,9 +19,15 @@ #include #include "Common/Common.h" #include "Common/CPUDetect.h" +#include "Common/Math/SIMDHeaders.h" #include "GPU/GPUState.h" #include "GPU/Software/Lighting.h" +#if PPSSPP_ARCH(SSE2) +// For the SSE4 stuff. +#include +#endif + namespace Lighting { static inline Vec3f GetLightVec(const u32 lparams[12], int light) {