cmake: Allow build system to disable loongarch intrinsics

main
Anonymous Maarten 2023-02-26 00:35:57 +01:00 committed by Anonymous Maarten
parent 99b8313eb1
commit 46de6241d7
6 changed files with 52 additions and 36 deletions

View File

@ -1020,6 +1020,14 @@ if(NOT HAVE_SSE3)
set(SDL_DISABLE_SSE3 1)
endif()
if(NOT HAVE_LSX)
set(SDL_DISABLE_LSX 1)
endif()
if(NOT HAVE_LASX)
set(SDL_DISABLE_LASX 1)
endif()
# TODO: Can't deactivate on FreeBSD? w/o LIBC, SDL_stdinc.h can't define
# anything.
if(SDL_LIBC)

View File

@ -93,13 +93,11 @@ _m_prefetch(void *__P)
#endif
#endif /* compiler version */
#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H)
#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX)
#include <lsxintrin.h>
#define __LSX__
#endif
#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX_H)
#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX)
#include <lasxintrin.h>
#define __LASX__
#endif
#if defined(__AVX__) && !defined(SDL_DISABLE_AVX)
#include <immintrin.h>

View File

@ -592,5 +592,7 @@ typedef unsigned int uintptr_t;
#cmakedefine SDL_DISABLE_SSE3 1
#cmakedefine SDL_DISABLE_AVX 1
#cmakedefine SDL_DISABLE_MMX 1
#cmakedefine SDL_DISABLE_LSX 1
#cmakedefine SDL_DISABLE_LASX 1
#endif /* SDL_build_config_h_ */

View File

@ -211,6 +211,14 @@
#define HAVE_AVX_INTRINSICS 1
#endif
#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX)
#define HAVE_LSX_INTRINSICS 1
#endif
#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX)
#define HAVE_LASX_INTRINSICS 1
#endif
#if defined __clang__
#if (!__has_attribute(target))
#undef HAVE_AVX_INTRINSICS

View File

@ -419,7 +419,7 @@ static SDL_bool yuv_rgb_lsx(
Uint8 *rgb, Uint32 rgb_stride,
YCbCrType yuv_type)
{
#ifdef __loongarch_sx
#if HAVE_LSX_INTRINSICS
if (!SDL_HasLSX()) {
return SDL_FALSE;
}

View File

@ -684,7 +684,7 @@ void rgb24_yuv420_sseu(uint32_t width, uint32_t height,
#endif //HAVE_SSE2_INTRINSICS
#ifdef __loongarch_sx
#if HAVE_LSX_INTRINSICS
#define LSX_FUNCTION_NAME yuv420_rgb24_lsx
#define STD_FUNCTION_NAME yuv420_rgb24_std
@ -716,6 +716,6 @@ void rgb24_yuv420_sseu(uint32_t width, uint32_t height,
#define RGB_FORMAT RGB_FORMAT_ABGR
#include "yuv_rgb_lsx_func.h"
#endif //__loongarch_sx
#endif //HAVE_LSX_INTRINSICS
#endif /* SDL_HAVE_YUV */