Fix -Wundef warnings due to use of unguarded SDL_SSE2_INTRINSICS

This commit is contained in:
Anonymous Maarten committed 2023-03-28 19:29:44 +02:00
1 parent 6d4c9bd107
commit 6ede22cd32
4 files changed
+28 -28

No files matched your search

+4 -4
View File
@@ -23,9 +23,9 @@
#include "SDL_audio_c.h" #include "SDL_audio_c.h"
#include "SDL_audiocvt_c.h" #include "SDL_audiocvt_c.h"
#if defined(__x86_64__) && SDL_SSE2_INTRINSICS #if defined(__x86_64__) && defined(SDL_SSE2_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */ #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */
#elif defined(__MACOS__) && SDL_SSE2_INTRINSICS #elif defined(__MACOS__) && defined(SDL_SSE2_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* macOS/Intel guarantees SSE2. */ #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* macOS/Intel guarantees SSE2. */
#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && defined(SDL_NEON_INTRINSICS) #elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && defined(SDL_NEON_INTRINSICS)
#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */ #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */
@@ -224,7 +224,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo
} }
#endif #endif
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
static void SDLCALL SDL_TARGETING("sse2") SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) static void SDLCALL SDL_TARGETING("sse2") SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{ {
const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1; const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1;
@@ -1173,7 +1173,7 @@ void SDL_ChooseAudioConverters(void)
SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \ SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \
converters_chosen = SDL_TRUE converters_chosen = SDL_TRUE
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
SET_CONVERTER_FUNCS(SSE2); SET_CONVERTER_FUNCS(SSE2);
return; return;
+21 -21
View File
@@ -303,7 +303,7 @@ static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, i
return 0; return 0;
} }
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
static SDL_bool SDL_TARGETING("sse2") yuv_rgb_sse( static SDL_bool SDL_TARGETING("sse2") yuv_rgb_sse(
Uint32 src_format, Uint32 dst_format, Uint32 src_format, Uint32 dst_format,
Uint32 width, Uint32 height, Uint32 width, Uint32 height,
@@ -1122,7 +1122,7 @@ static int SDL_ConvertPixels_SwapUVPlanes(int width, int height, const void *src
return 0; return 0;
} }
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
static int SDL_TARGETING("sse2") SDL_ConvertPixels_PackUVPlanes_to_NV_SSE2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) static int SDL_TARGETING("sse2") SDL_ConvertPixels_PackUVPlanes_to_NV_SSE2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV)
{ {
int x, y; int x, y;
@@ -1441,31 +1441,31 @@ static int SDL_ConvertPixels_SwapNV_std(int width, int height, const void *src,
static int SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) static int SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV)
{ {
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
return SDL_ConvertPixels_PackUVPlanes_to_NV_SSE2(width, height, src, src_pitch, dst, dst_pitch, reverseUV); return SDL_ConvertPixels_PackUVPlanes_to_NV_SSE2(width, height, src, src_pitch, dst, dst_pitch, reverseUV);
} }
#endif #endif
return SDL_ConvertPixels_PackUVPlanes_to_NV_std(width, height, src, src_pitch, dst, dst_pitch, reverseUV); return SDL_ConvertPixels_PackUVPlanes_to_NV_std(width, height, src, src_pitch, dst, dst_pitch, reverseUV);
} }
static int SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) static int SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV)
{ {
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
return SDL_ConvertPixels_SplitNV_to_UVPlanes_SSE2(width, height, src, src_pitch, dst, dst_pitch, reverseUV); return SDL_ConvertPixels_SplitNV_to_UVPlanes_SSE2(width, height, src, src_pitch, dst, dst_pitch, reverseUV);
} }
#endif #endif
return SDL_ConvertPixels_SplitNV_to_UVPlanes_std(width, height, src, src_pitch, dst, dst_pitch, reverseUV); return SDL_ConvertPixels_SplitNV_to_UVPlanes_std(width, height, src, src_pitch, dst, dst_pitch, reverseUV);
} }
static int SDL_ConvertPixels_SwapNV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) static int SDL_ConvertPixels_SwapNV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{ {
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
return SDL_ConvertPixels_SwapNV_SSE2(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_SwapNV_SSE2(width, height, src, src_pitch, dst, dst_pitch);
} }
#endif #endif
return SDL_ConvertPixels_SwapNV_std(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_SwapNV_std(width, height, src, src_pitch, dst, dst_pitch);
} }
@@ -1541,7 +1541,7 @@ static int SDL_ConvertPixels_Planar2x2_to_Planar2x2(int width, int height,
SDL_GetPixelFormatName(dst_format)); SDL_GetPixelFormatName(dst_format));
} }
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
#define PACKED4_TO_PACKED4_ROW_SSE2(shuffle) \ #define PACKED4_TO_PACKED4_ROW_SSE2(shuffle) \
while (x >= 4) { \ while (x >= 4) { \
__m128i yuv = _mm_loadu_si128((__m128i *)srcYUV); \ __m128i yuv = _mm_loadu_si128((__m128i *)srcYUV); \
@@ -1969,61 +1969,61 @@ static int SDL_ConvertPixels_YVYU_to_UYVY_std(int width, int height, const void
static int SDL_ConvertPixels_YUY2_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) static int SDL_ConvertPixels_YUY2_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{ {
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
return SDL_ConvertPixels_YUY2_to_UYVY_SSE2(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_YUY2_to_UYVY_SSE2(width, height, src, src_pitch, dst, dst_pitch);
} }
#endif #endif
return SDL_ConvertPixels_YUY2_to_UYVY_std(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_YUY2_to_UYVY_std(width, height, src, src_pitch, dst, dst_pitch);
} }
static int SDL_ConvertPixels_YUY2_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) static int SDL_ConvertPixels_YUY2_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{ {
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
return SDL_ConvertPixels_YUY2_to_YVYU_SSE2(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_YUY2_to_YVYU_SSE2(width, height, src, src_pitch, dst, dst_pitch);
} }
#endif #endif
return SDL_ConvertPixels_YUY2_to_YVYU_std(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_YUY2_to_YVYU_std(width, height, src, src_pitch, dst, dst_pitch);
} }
static int SDL_ConvertPixels_UYVY_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) static int SDL_ConvertPixels_UYVY_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{ {
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
return SDL_ConvertPixels_UYVY_to_YUY2_SSE2(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_UYVY_to_YUY2_SSE2(width, height, src, src_pitch, dst, dst_pitch);
} }
#endif #endif
return SDL_ConvertPixels_UYVY_to_YUY2_std(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_UYVY_to_YUY2_std(width, height, src, src_pitch, dst, dst_pitch);
} }
static int SDL_ConvertPixels_UYVY_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) static int SDL_ConvertPixels_UYVY_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{ {
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
return SDL_ConvertPixels_UYVY_to_YVYU_SSE2(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_UYVY_to_YVYU_SSE2(width, height, src, src_pitch, dst, dst_pitch);
} }
#endif #endif
return SDL_ConvertPixels_UYVY_to_YVYU_std(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_UYVY_to_YVYU_std(width, height, src, src_pitch, dst, dst_pitch);
} }
static int SDL_ConvertPixels_YVYU_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) static int SDL_ConvertPixels_YVYU_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{ {
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
return SDL_ConvertPixels_YVYU_to_YUY2_SSE2(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_YVYU_to_YUY2_SSE2(width, height, src, src_pitch, dst, dst_pitch);
} }
#endif #endif
return SDL_ConvertPixels_YVYU_to_YUY2_std(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_YVYU_to_YUY2_std(width, height, src, src_pitch, dst, dst_pitch);
} }
static int SDL_ConvertPixels_YVYU_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) static int SDL_ConvertPixels_YVYU_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch)
{ {
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
return SDL_ConvertPixels_YVYU_to_UYVY_SSE2(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_YVYU_to_UYVY_SSE2(width, height, src, src_pitch, dst, dst_pitch);
} }
#endif #endif
return SDL_ConvertPixels_YVYU_to_UYVY_std(width, height, src, src_pitch, dst, dst_pitch); return SDL_ConvertPixels_YVYU_to_UYVY_std(width, height, src, src_pitch, dst, dst_pitch);
} }
+1 -1
View File
@@ -239,7 +239,7 @@ void rgb24_yuv420_std(
} }
} }
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
#define SSE_FUNCTION_NAME yuv420_rgb565_sse #define SSE_FUNCTION_NAME yuv420_rgb565_sse
#define STD_FUNCTION_NAME yuv420_rgb565_std #define STD_FUNCTION_NAME yuv420_rgb565_std
+2 -2
View File
@@ -216,7 +216,7 @@ SDL_TARGETING("sse") static void kernel_floats_add_sse(float *dest, const float
} }
#endif #endif
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
SDL_TARGETING("sse2") static void kernel_doubles_add_sse2(double *dest, const double *a, const double *b, size_t size) { SDL_TARGETING("sse2") static void kernel_doubles_add_sse2(double *dest, const double *a, const double *b, size_t size) {
for (; size >= 2; size -= 2, dest += 2, a += 2, b += 2) { for (; size >= 2; size -= 2, dest += 2, a += 2, b += 2) {
_mm_storeu_pd(dest, _mm_add_pd(_mm_loadu_pd(a), _mm_loadu_pd(b))); _mm_storeu_pd(dest, _mm_add_pd(_mm_loadu_pd(a), _mm_loadu_pd(b)));
@@ -420,7 +420,7 @@ static int intrinsics_testSSE2(void *arg)
{ {
if (SDL_HasSSE2()) { if (SDL_HasSSE2()) {
SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE2 support."); SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE2 support.");
#if SDL_SSE2_INTRINSICS #if defined(SDL_SSE2_INTRINSICS)
{ {
size_t size; size_t size;
double *dest, *a, *b; double *dest, *a, *b;