From 50d8d06a94e81828ed033bd0d9c3210dca39970a Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 8 Jan 2024 22:39:36 +1000 Subject: [PATCH] GS: Make vector types POD Generates the same code in Release, but slightly difference code in Debug. In Debug, with the default copy assignment operator, it turns into two 8-byte moves. With the overloaded operator, it turns into a function call with a vector move. --- pcsx2/GS/GSVector4.h | 7 ------- pcsx2/GS/GSVector4i.h | 15 +-------------- pcsx2/GS/GSVector8.h | 7 ------- pcsx2/GS/GSVector8i.h | 7 ------- 4 files changed, 1 insertion(+), 35 deletions(-) diff --git a/pcsx2/GS/GSVector4.h b/pcsx2/GS/GSVector4.h index 9a51450da0..b5c61fbbaf 100644 --- a/pcsx2/GS/GSVector4.h +++ b/pcsx2/GS/GSVector4.h @@ -55,8 +55,6 @@ public: GSVector4() = default; - constexpr GSVector4(const GSVector4&) = default; - constexpr static GSVector4 cxpr(float x, float y, float z, float w) { return GSVector4(cxpr_init, x, y, z, w); @@ -177,11 +175,6 @@ public: return GSVector4(_mm_castpd_ps(_mm_set_pd(y, x))); } - __forceinline void operator=(const GSVector4& v) - { - m = v.m; - } - __forceinline void operator=(float f) { #if _M_SSE >= 0x501 diff --git a/pcsx2/GS/GSVector4i.h b/pcsx2/GS/GSVector4i.h index dfc2683842..2c4ac6748c 100644 --- a/pcsx2/GS/GSVector4i.h +++ b/pcsx2/GS/GSVector4i.h @@ -43,10 +43,7 @@ public: __m128i m; }; - __forceinline constexpr GSVector4i() - : x(0), y(0), z(0), w(0) - { - } + GSVector4i() = default; constexpr static GSVector4i cxpr(int x, int y, int z, int w) { @@ -88,11 +85,6 @@ public: { } - __forceinline GSVector4i(const GSVector4i& v) - { - m = v.m; - } - __forceinline explicit GSVector4i(const GSVector2i& v) { m = _mm_loadl_epi64((__m128i*)&v); @@ -125,11 +117,6 @@ public: #endif - __forceinline void operator=(const GSVector4i& v) - { - m = v.m; - } - __forceinline void operator=(int i) { #if _M_SSE >= 0x501 diff --git a/pcsx2/GS/GSVector8.h b/pcsx2/GS/GSVector8.h index 0129c3ffad..6e664c6f46 100644 --- a/pcsx2/GS/GSVector8.h +++ b/pcsx2/GS/GSVector8.h @@ -115,8 +115,6 @@ public: #endif } - constexpr GSVector8(const GSVector8& v) = default; - __forceinline explicit GSVector8(float f) { *this = f; @@ -163,11 +161,6 @@ public: __forceinline static GSVector8 cast(const GSVector4& v); __forceinline static GSVector8 cast(const GSVector4i& v); - __forceinline void operator=(const GSVector8& v) - { - m = v.m; - } - __forceinline void operator=(float f) { #if _M_SSE >= 0x501 diff --git a/pcsx2/GS/GSVector8i.h b/pcsx2/GS/GSVector8i.h index 76ea41c465..2335865fe5 100644 --- a/pcsx2/GS/GSVector8i.h +++ b/pcsx2/GS/GSVector8i.h @@ -90,8 +90,6 @@ public: #endif } - GSVector8i(const GSVector8i& v) = default; - __forceinline explicit GSVector8i(int i) { *this = i; @@ -107,11 +105,6 @@ public: { } - __forceinline void operator=(const GSVector8i& v) - { - m = v.m; - } - __forceinline void operator=(int i) { m = _mm256_broadcastd_epi32(_mm_cvtsi32_si128(i)); // m = _mm256_set1_epi32(i);