From b99f38049842471a927b04999e9e86a596abeb18 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 30 Mar 2023 04:00:48 +0200 Subject: [PATCH] intrinsics: add lsx/lasx intrinsic headers when not disabled __attribute__((target(xx))) is not supported by LoongArch64. The following warning is emitted: target attribute is not supported on this machine [-Wattributes] --- CMakeLists.txt | 2 -- include/SDL3/SDL_intrin.h | 17 +++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b82a82aa8..5eb19eb6d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -966,7 +966,6 @@ if(SDL_ASSEMBLY) cmake_pop_check_state() if(COMPILER_SUPPORTS_LSX AND HAVE_LSXINTRIN_H) - target_compile_options(sdl-build-options INTERFACE "-mlsx") set(HAVE_LSX TRUE) endif() endif() @@ -982,7 +981,6 @@ if(SDL_ASSEMBLY) check_include_file("lasxintrin.h" HAVE_LASXINTRIN_H) cmake_pop_check_state() if(COMPILER_SUPPORTS_LASX AND HAVE_LASXINTRIN_H) - target_compile_options(sdl-build-options INTERFACE "-mlasx") set(HAVE_LASX TRUE) endif() endif() diff --git a/include/SDL3/SDL_intrin.h b/include/SDL3/SDL_intrin.h index 928a3060a0..9f9f72246f 100644 --- a/include/SDL3/SDL_intrin.h +++ b/include/SDL3/SDL_intrin.h @@ -99,14 +99,15 @@ _m_prefetch(void *__P) # define SDL_TARGETING(x) #endif -#if defined(__loongarch_sx) && !defined(SDL_DISABLE_LSX) -# define SDL_LSX_INTRINSICS 1 -# include -#endif - -#if defined(__loongarch_asx) && !defined(SDL_DISABLE_LASX) -# define SDL_LASX_INTRINSICS 1 -# include +#if defined(__loongarch64) +# ifndef SDL_DISABLE_LSX +# define SDL_LSX_INTRINSICS 1 +# include +# endif +# ifndef SDL_DISABLE_LASX +# define SDL_LASX_INTRINSICS 1 +# include +# endif #endif #if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)