aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy B. Terriberry <tterribe@xiph.org>2024-02-22 04:49:51 -0800
committerTimothy B. Terriberry <tterribe@xiph.org>2024-02-22 04:53:04 -0800
commit9cf12e92bbd25b2416b340b06090efbde9ad3fa6 (patch)
tree6e009a431b47dac9c778e427c7494e5f1f9dd4b5
parent833688e65dda31b6cfc319b5dcd0a54f3a2ef616 (diff)
downloadlibopus-9cf12e92bbd25b2416b340b06090efbde9ad3fa6.tar.gz
Improve AVX2 compiler support detection.
Commit 735c40706f37 added uses of intrinsics that require at least gcc 9.0 (cf. <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78782>), even though AVX2 support may appear to be available in earlier gcc versions. We were not testing for this. Update the compiler test in configure.ac to use these intrinsics explicitly, so it will error out and disable AVX2 if they are not available.
-rw-r--r--configure.ac9
1 files changed, 8 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 63ae9329..4bfcb6ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -691,10 +691,17 @@ AS_IF([test x"$enable_intrinsics" = x"yes"],[
#include <time.h>
]],
[[
+ unsigned char utest[16] = {1};
__m256 mtest;
+ __m256 mtest1;
+ __m256 mtest2;
mtest = _mm256_set1_ps((float)time(NULL));
mtest = _mm256_fmadd_ps(mtest, mtest, mtest);
- return _mm256_extract_epi16(_mm256_cvttps_epi32(mtest), 0);
+ mtest1 = _mm256_set_m128i(_mm_loadu_si64(utest));
+ mtest2 =
+ _mm256_cvtepi16_epi32(_mm_loadu_si128((__m128i_u *)utest));
+ return _mm256_extract_epi16(_mm256_xor_si256(
+ _mm256_xor_si256(mtest1, mtest2), _mm256_cvttps_epi32(mtest)), 0);
]]
)
AS_IF([test x"$OPUS_X86_MAY_HAVE_AVX2" = x"1" && test x"$OPUS_X86_PRESUME_AVX2" != x"1"],