cmake: Allow build system to disable loongarch intrinsics
This commit is contained in:
parent
99b8313eb1
commit
46de6241d7
6 changed files with 52 additions and 36 deletions
|
@ -1020,6 +1020,14 @@ if(NOT HAVE_SSE3)
|
||||||
set(SDL_DISABLE_SSE3 1)
|
set(SDL_DISABLE_SSE3 1)
|
||||||
endif()
|
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
|
# TODO: Can't deactivate on FreeBSD? w/o LIBC, SDL_stdinc.h can't define
|
||||||
# anything.
|
# anything.
|
||||||
if(SDL_LIBC)
|
if(SDL_LIBC)
|
||||||
|
|
|
@ -93,13 +93,11 @@ _m_prefetch(void *__P)
|
||||||
#endif
|
#endif
|
||||||
#endif /* compiler version */
|
#endif /* compiler version */
|
||||||
|
|
||||||
#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX_H)
|
#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX)
|
||||||
#include <lsxintrin.h>
|
#include <lsxintrin.h>
|
||||||
#define __LSX__
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX_H)
|
#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX)
|
||||||
#include <lasxintrin.h>
|
#include <lasxintrin.h>
|
||||||
#define __LASX__
|
|
||||||
#endif
|
#endif
|
||||||
#if defined(__AVX__) && !defined(SDL_DISABLE_AVX)
|
#if defined(__AVX__) && !defined(SDL_DISABLE_AVX)
|
||||||
#include <immintrin.h>
|
#include <immintrin.h>
|
||||||
|
|
|
@ -592,5 +592,7 @@ typedef unsigned int uintptr_t;
|
||||||
#cmakedefine SDL_DISABLE_SSE3 1
|
#cmakedefine SDL_DISABLE_SSE3 1
|
||||||
#cmakedefine SDL_DISABLE_AVX 1
|
#cmakedefine SDL_DISABLE_AVX 1
|
||||||
#cmakedefine SDL_DISABLE_MMX 1
|
#cmakedefine SDL_DISABLE_MMX 1
|
||||||
|
#cmakedefine SDL_DISABLE_LSX 1
|
||||||
|
#cmakedefine SDL_DISABLE_LASX 1
|
||||||
|
|
||||||
#endif /* SDL_build_config_h_ */
|
#endif /* SDL_build_config_h_ */
|
||||||
|
|
|
@ -211,6 +211,14 @@
|
||||||
#define HAVE_AVX_INTRINSICS 1
|
#define HAVE_AVX_INTRINSICS 1
|
||||||
#endif
|
#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 defined __clang__
|
||||||
#if (!__has_attribute(target))
|
#if (!__has_attribute(target))
|
||||||
#undef HAVE_AVX_INTRINSICS
|
#undef HAVE_AVX_INTRINSICS
|
||||||
|
|
|
@ -419,7 +419,7 @@ static SDL_bool yuv_rgb_lsx(
|
||||||
Uint8 *rgb, Uint32 rgb_stride,
|
Uint8 *rgb, Uint32 rgb_stride,
|
||||||
YCbCrType yuv_type)
|
YCbCrType yuv_type)
|
||||||
{
|
{
|
||||||
#ifdef __loongarch_sx
|
#if HAVE_LSX_INTRINSICS
|
||||||
if (!SDL_HasLSX()) {
|
if (!SDL_HasLSX()) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -684,7 +684,7 @@ void rgb24_yuv420_sseu(uint32_t width, uint32_t height,
|
||||||
|
|
||||||
#endif //HAVE_SSE2_INTRINSICS
|
#endif //HAVE_SSE2_INTRINSICS
|
||||||
|
|
||||||
#ifdef __loongarch_sx
|
#if HAVE_LSX_INTRINSICS
|
||||||
|
|
||||||
#define LSX_FUNCTION_NAME yuv420_rgb24_lsx
|
#define LSX_FUNCTION_NAME yuv420_rgb24_lsx
|
||||||
#define STD_FUNCTION_NAME yuv420_rgb24_std
|
#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
|
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||||
#include "yuv_rgb_lsx_func.h"
|
#include "yuv_rgb_lsx_func.h"
|
||||||
|
|
||||||
#endif //__loongarch_sx
|
#endif //HAVE_LSX_INTRINSICS
|
||||||
|
|
||||||
#endif /* SDL_HAVE_YUV */
|
#endif /* SDL_HAVE_YUV */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue