build: Fix test for SSE4.1 intrinsics

This change uses the `_mm_blend_epi16` SSE4.1 function used in our code
and fixes false-positive cases, for example, when CXXFLAGS="-mno-sse4.1"
provided.
This commit is contained in:
Hennadii Stepanov 2024-02-12 14:26:00 +00:00
parent 2b260eadf7
commit 6ec1ca7c85
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -504,11 +504,12 @@ TEMP_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$SSE41_CXXFLAGS $CXXFLAGS"
AC_MSG_CHECKING([for SSE4.1 intrinsics])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdint.h>
#include <immintrin.h>
]],[[
__m128i l = _mm_set1_epi32(0);
return _mm_extract_epi32(l, 3);
__m128i a = _mm_set1_epi32(0);
__m128i b = _mm_set1_epi32(1);
__m128i r = _mm_blend_epi16(a, b, 0xFF);
return _mm_extract_epi32(r, 3);
]])],
[ AC_MSG_RESULT([yes]); enable_sse41=yes; AC_DEFINE([ENABLE_SSE41], [1], [Define this symbol to build code that uses SSE4.1 intrinsics]) ],
[ AC_MSG_RESULT([no])]