diff options
-rw-r--r-- | config.cmake.h.in | 6 | ||||
-rw-r--r-- | src/libFLAC/include/private/cpu.h | 64 |
2 files changed, 40 insertions, 30 deletions
diff --git a/config.cmake.h.in b/config.cmake.h.in index 9f2bc064..4f424977 100644 --- a/config.cmake.h.in +++ b/config.cmake.h.in @@ -50,8 +50,10 @@ #cmakedefine FLAC__USE_ALTIVEC /* define to enable use of AVX instructions */ -#cmakedefine01 WITH_AVX -#define FLAC__USE_AVX WITH_AVX +#cmakedefine WITH_AVX +#ifdef WITH_AVX + #define FLAC__USE_AVX +#endif /* define to enable use of VSX instructions */ #cmakedefine FLAC__USE_VSX diff --git a/src/libFLAC/include/private/cpu.h b/src/libFLAC/include/private/cpu.h index 0b50839f..638c1b20 100644 --- a/src/libFLAC/include/private/cpu.h +++ b/src/libFLAC/include/private/cpu.h @@ -69,12 +69,14 @@ #define FLAC__SSSE3_SUPPORTED 1 #define FLAC__SSE4_1_SUPPORTED 1 #endif - #if (__INTEL_COMPILER >= 1110) /* Intel C++ Compiler 11.1 */ - #define FLAC__AVX_SUPPORTED 1 - #endif - #if (__INTEL_COMPILER >= 1300) /* Intel C++ Compiler 13.0 */ - #define FLAC__AVX2_SUPPORTED 1 - #define FLAC__FMA_SUPPORTED 1 + #ifdef FLAC__USE_AVX + #if (__INTEL_COMPILER >= 1110) /* Intel C++ Compiler 11.1 */ + #define FLAC__AVX_SUPPORTED 1 + #endif + #if (__INTEL_COMPILER >= 1300) /* Intel C++ Compiler 13.0 */ + #define FLAC__AVX2_SUPPORTED 1 + #define FLAC__FMA_SUPPORTED 1 + #endif #endif #elif defined __clang__ && __has_attribute(__target__) /* clang */ #define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x))) @@ -90,14 +92,16 @@ #if __has_builtin(__builtin_ia32_pmuldq128) #define FLAC__SSE4_1_SUPPORTED 1 #endif - #if __has_builtin(__builtin_ia32_maxps256) - #define FLAC__AVX_SUPPORTED 1 - #endif - #if __has_builtin(__builtin_ia32_pabsd256) - #define FLAC__AVX2_SUPPORTED 1 - #endif - #if __has_builtin(__builtin_ia32_vfmaddps) - #define FLAC__FMA_SUPPORTED 1 + #ifdef FLAC__USE_AVX + #if __has_builtin(__builtin_ia32_maxps256) + #define FLAC__AVX_SUPPORTED 1 + #endif + #if __has_builtin(__builtin_ia32_pabsd256) + #define FLAC__AVX2_SUPPORTED 1 + #endif + #if __has_builtin(__builtin_ia32_vfmaddps) + #define FLAC__FMA_SUPPORTED 1 + #endif #endif #elif defined __GNUC__ && !defined __clang__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) /* GCC 4.9+ */ #define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x))) @@ -118,12 +122,14 @@ #define FLAC__SSSE3_SUPPORTED 1 #define FLAC__SSE4_1_SUPPORTED 1 #endif - #if (_MSC_FULL_VER >= 160040219) /* MS Visual Studio 2010 SP1 */ - #define FLAC__AVX_SUPPORTED 1 - #endif - #if (_MSC_VER >= 1700) /* MS Visual Studio 2012 */ - #define FLAC__AVX2_SUPPORTED 1 - #define FLAC__FMA_SUPPORTED 1 + #ifdef FLAC__USE_AVX + #if (_MSC_FULL_VER >= 160040219) /* MS Visual Studio 2010 SP1 */ + #define FLAC__AVX_SUPPORTED 1 + #endif + #if (_MSC_VER >= 1700) /* MS Visual Studio 2012 */ + #define FLAC__AVX2_SUPPORTED 1 + #define FLAC__FMA_SUPPORTED 1 + #endif #endif #else #define FLAC__SSE_TARGET(x) @@ -139,14 +145,16 @@ #ifdef __SSE4_1__ #define FLAC__SSE4_1_SUPPORTED 1 #endif - #ifdef __AVX__ - #define FLAC__AVX_SUPPORTED 1 - #endif - #ifdef __AVX2__ - #define FLAC__AVX2_SUPPORTED 1 - #endif - #ifdef __FMA__ - #define FLAC__FMA_SUPPORTED 1 + #ifdef FLAC__USE_AVX + #ifdef __AVX__ + #define FLAC__AVX_SUPPORTED 1 + #endif + #ifdef __AVX2__ + #define FLAC__AVX2_SUPPORTED 1 + #endif + #ifdef __FMA__ + #define FLAC__FMA_SUPPORTED 1 + #endif #endif #endif /* compiler version */ #endif /* intrinsics support */ |