cpu.h: detect AVX/FMA intrinsics availability on clang

Previously the FLAC__AVX2_SUPPORTED macro is defined, but actually
AVX2 functions are not used when built with clang because flac only
uses them when FLAC__AVX_SUPPORTED macro is set.

Signed-off-by: NotTsunami
This commit is contained in:
tmkk 2021-04-25 15:09:09 +09:00 committed by Ralph Giles
parent 313ab5852f
commit b358381a10
No known key found for this signature in database
GPG Key ID: 9259A8F2D2D44C84
1 changed files with 6 additions and 0 deletions

View File

@ -90,9 +90,15 @@
#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
#endif
#elif defined __GNUC__ && !defined __clang__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 9)) /* GCC 4.9+ */
#define FLAC__SSE_TARGET(x) __attribute__ ((__target__ (x)))
#define FLAC__SSE_SUPPORTED 1