mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-05 22:30:29 +00:00
Only include arm_sve.h in SVE dedicated c source files.
This commit is contained in:
parent
4a1b12540a
commit
da9489d9e1
4 changed files with 42 additions and 4 deletions
|
|
@ -941,6 +941,10 @@ if(SDL_ASSEMBLY)
|
|||
return 0;
|
||||
}]==] COMPILER_SUPPORTS_ARMSVE2)
|
||||
if(COMPILER_SUPPORTS_ARMSVE2)
|
||||
# IMPORTANT: As not all AArch64 processors support SVE2, we only
|
||||
# attach the following compilation options SVE dedicated
|
||||
# source files.
|
||||
set(SVE2_MARCH_FLAG "-march=armv8-a+sve2")
|
||||
set(HAVE_ARMSVE2 TRUE)
|
||||
endif()
|
||||
cmake_pop_check_state()
|
||||
|
|
@ -954,6 +958,7 @@ if(SDL_ASSEMBLY)
|
|||
"${SDL3_SOURCE_DIR}/src/video/arm/SDL_sve2_blit_A.c"
|
||||
"${SDL3_SOURCE_DIR}/src/video/arm/SDL_sve2_blit_N.c"
|
||||
PROPERTIES
|
||||
COMPILE_FLAGS "${SVE2_MARCH_FLAG}"
|
||||
SKIP_PRECOMPILE_HEADERS ON
|
||||
)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -88,8 +88,7 @@
|
|||
/**
|
||||
* Defined if (and only if) the compiler supports ARM SVE2 intrinsics.
|
||||
*
|
||||
* If this macro is defined, SDL will have already included `<arm_sve.h>` as
|
||||
* appropriate.
|
||||
* Even if this macro is defined, SDL will NOT included `<arm_sve.h>` globally.
|
||||
*
|
||||
* \since This macro is available since SDL 3.6.0.
|
||||
*/
|
||||
|
|
@ -284,8 +283,8 @@ _m_prefetch(void *__P)
|
|||
/* Visual Studio doesn't define __ARM_ARCH, but _M_ARM (if set, always 7), and _M_ARM64 (if set, always 1). */
|
||||
# if defined (_M_ARM64) && 0 /* Please only remove this 0 when MSVC releasing support for SVE2 officially. */
|
||||
# define SDL_SVE2_INTRINSICS 1
|
||||
# include <arm_sve.h>
|
||||
# define __ARM_FEATURE_SVE2 1 /* Set __ARM_FEATURE_SVE2 so that it can be used elsewhere, at compile time */
|
||||
# define __ARM_FEATURE_SVE 1 /* Set __ARM_FEATURE_SVE so that it can be used elsewhere, at compile time */
|
||||
# define __ARM_ARCH 8
|
||||
# endif
|
||||
# elif defined(SDL_PLATFORM_APPLE)
|
||||
|
|
@ -293,7 +292,12 @@ _m_prefetch(void *__P)
|
|||
# elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && (defined(__aarch64__) || defined(_M_ARM64)) && \
|
||||
defined(__has_include) && __has_include(<arm_sve.h>)
|
||||
# define SDL_SVE2_INTRINSICS 1
|
||||
# include <arm_sve.h>
|
||||
/*
|
||||
* IMPORTANT: Please do NOT put #include <arm_sve.h> here. Some versions of LLVM compilers provide arm_sve.h that
|
||||
* raise error when failling in checking the existance of __ARM_FEATURE_SVE, while others are not. To
|
||||
* improve the portability, we only include arm_sve.h in the source files that are dedicated to SVE
|
||||
* accelerations.
|
||||
*/
|
||||
# endif
|
||||
#endif
|
||||
#endif /* compiler version */
|
||||
|
|
|
|||
|
|
@ -19,10 +19,33 @@
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* IMPORTANT: Please do NOT include this header file directly or indirectly
|
||||
* outside the src/video/arm folder.
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(SDL_SVE2_EXTENSION_H) //&& (defined(__ARM_FEATURE_SVE2) && __ARM_FEATURE_SVE2)
|
||||
#define SDL_SVE2_EXTENSION_H
|
||||
|
||||
#include "SDL_sve2_util.h"
|
||||
|
||||
/*
|
||||
* NOTE: Some Android builds didn't attach '-march=armv8-a+sve2' to
|
||||
* SDL_sve2_*.c and hence the macro __ARM_FEATURE_SVE is not
|
||||
* defined by the compiler. This might not be a problem as the
|
||||
* SDL_TARGETING("arch=armv8-a+sve2") enables the feature for
|
||||
* individual functions, until some version of compilers
|
||||
* provides arm_sve.h raising errors then __ARM_FEATURE_SVE
|
||||
* is not defined. Although it should be avoided, as a
|
||||
* workaround, we have to define the __ARM_FEATURE_SVE here as
|
||||
* an ugly hack.
|
||||
*/
|
||||
#if defined(SDL_PLATFORM_ANDROID) && SDL_PLATFORM_ANDROID
|
||||
#ifndef __ARM_FEATURE_SVE
|
||||
#define __ARM_FEATURE_SVE 1
|
||||
#endif
|
||||
#endif
|
||||
#include <arm_sve.h>
|
||||
#include <stdint.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@
|
|||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
/*
|
||||
* IMPORTANT: Please do NOT include this header file directly or indirectly
|
||||
* outside the src/video/arm folder.
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(SD_SVE2_SWIZZLE_H) //&& (defined(__ARM_FEATURE_SVE2) && __ARM_FEATURE_SVE2)
|
||||
#define SD_SVE2_SWIZZLE_H
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue