mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-05 05:24:42 +00:00
cmake: Detect AVX + allow build system to disable Intel intrinsics
This commit is contained in:
committed by
Anonymous Maarten
parent
683411e96f
commit
4681240241
@@ -101,21 +101,20 @@ _m_prefetch(void *__P)
|
||||
#include <lasxintrin.h>
|
||||
#define __LASX__
|
||||
#endif
|
||||
#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
|
||||
#if defined(__AVX__) && !defined(SDL_DISABLE_AVX)
|
||||
#include <immintrin.h>
|
||||
#else
|
||||
#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
|
||||
#endif
|
||||
#if defined(__MMX__) && !defined(SDL_DISABLE_MMX)
|
||||
#include <mmintrin.h>
|
||||
#endif
|
||||
#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H)
|
||||
#if defined(__SSE__) && !defined(SDL_DISABLE_SSE)
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H)
|
||||
#if defined(__SSE2__) && !defined(SDL_DISABLE_SSE2)
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H)
|
||||
#if defined(__SSE3__) && !defined(SDL_DISABLE_SSE3)
|
||||
#include <pmmintrin.h>
|
||||
#endif
|
||||
#endif /* HAVE_IMMINTRIN_H */
|
||||
|
||||
#endif /* SDL_intrin_h_ */
|
||||
|
||||
@@ -226,18 +226,6 @@
|
||||
#cmakedefine HAVE_LIBUSB 1
|
||||
#cmakedefine HAVE_O_CLOEXEC 1
|
||||
|
||||
/* Apple platforms might be building universal binaries, where Intel builds
|
||||
can use immintrin.h but other architectures can't. */
|
||||
#ifdef __APPLE__
|
||||
# if defined(__has_include) && (defined(__i386__) || defined(__x86_64))
|
||||
# if __has_include(<immintrin.h>)
|
||||
# define HAVE_IMMINTRIN_H 1
|
||||
# endif
|
||||
# endif
|
||||
#else /* non-Apple platforms can use the normal CMake check for this. */
|
||||
#cmakedefine HAVE_IMMINTRIN_H 1
|
||||
#endif
|
||||
|
||||
#cmakedefine HAVE_LIBUDEV_H 1
|
||||
#cmakedefine HAVE_LIBSAMPLERATE_H 1
|
||||
#cmakedefine HAVE_LIBDECOR_H 1
|
||||
@@ -597,4 +585,11 @@ typedef unsigned int uintptr_t;
|
||||
#endif /* Visual Studio 2008 */
|
||||
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||
|
||||
/* Configure use of intrinsics */
|
||||
|
||||
#cmakedefine SDL_DISABLE_SSE 1
|
||||
#cmakedefine SDL_DISABLE_SSE2 1
|
||||
#cmakedefine SDL_DISABLE_SSE3 1
|
||||
#cmakedefine SDL_DISABLE_AVX 1
|
||||
|
||||
#endif /* SDL_build_config_h_ */
|
||||
|
||||
@@ -138,8 +138,8 @@
|
||||
#define HAVE_SYSCTLBYNAME 1
|
||||
|
||||
#if defined(__has_include) && (defined(__i386__) || defined(__x86_64))
|
||||
# if __has_include(<immintrin.h>)
|
||||
# define HAVE_IMMINTRIN_H 1
|
||||
# if !__has_include(<immintrin.h>)
|
||||
# define SDL_DISABLE_AVX 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
@@ -103,11 +103,12 @@ typedef unsigned int uintptr_t;
|
||||
#define HAVE_TPCSHRD_H 1
|
||||
#define HAVE_SENSORSAPI_H 1
|
||||
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
|
||||
#define HAVE_IMMINTRIN_H 1
|
||||
#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
|
||||
# if __has_include(<immintrin.h>)
|
||||
# define HAVE_IMMINTRIN_H 1
|
||||
# if !__has_include(<immintrin.h>)
|
||||
# define SDL_DISABLE_AVX 1
|
||||
# endif
|
||||
#else
|
||||
# define SDL_DISABLE_AVX 1
|
||||
#endif
|
||||
|
||||
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
|
||||
|
||||
@@ -48,11 +48,12 @@
|
||||
#define HAVE_TPCSHRD_H 1
|
||||
#define HAVE_SENSORSAPI_H 1
|
||||
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
|
||||
#define HAVE_IMMINTRIN_H 1
|
||||
#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
|
||||
# if __has_include(<immintrin.h>)
|
||||
# define HAVE_IMMINTRIN_H 1
|
||||
# if !__has_include(<immintrin.h>)
|
||||
# define SDL_DISABLE_AVX 1
|
||||
# endif
|
||||
#else
|
||||
# define SDL_DISABLE_AVX 1
|
||||
#endif
|
||||
|
||||
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
|
||||
|
||||
@@ -48,11 +48,12 @@
|
||||
/*#define HAVE_TPCSHRD_H 1*/
|
||||
/*#define HAVE_SENSORSAPI_H 1*/
|
||||
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
|
||||
#define HAVE_IMMINTRIN_H 1
|
||||
#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
|
||||
# if __has_include(<immintrin.h>)
|
||||
# define HAVE_IMMINTRIN_H 1
|
||||
# if !__has_include(<immintrin.h>)
|
||||
# define SDL_DISABLE_AVX 1
|
||||
# endif
|
||||
#else
|
||||
# define SDL_DISABLE_AVX 1
|
||||
#endif
|
||||
|
||||
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
|
||||
|
||||
Reference in New Issue
Block a user