diff --git a/configure b/configure index 3b671ebaef..45a05c026e 100755 --- a/configure +++ b/configure @@ -2308,6 +2308,7 @@ HEADERS_LIST=" INTRINSICS_LIST=" intrinsics_neon + intrinsics_sse2 " MATH_FUNCS=" @@ -2737,6 +2738,7 @@ armv6t2_deps="arm" armv8_deps="aarch64" neon_deps_any="aarch64 arm" intrinsics_neon_deps="neon" +intrinsics_sse2_deps="sse2" vfp_deps="arm" vfpv3_deps="vfp" setend_deps="arm" @@ -6432,6 +6434,7 @@ elif enabled loongarch; then fi check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)" +check_cc intrinsics_sse2 emmintrin.h "__m128i test = _mm_setzero_si128()" check_ldflags -Wl,--as-needed check_ldflags -Wl,-z,noexecstack diff --git a/libavutil/x86/intreadwrite.h b/libavutil/x86/intreadwrite.h index 5e57d6a8cd..9bbef00dba 100644 --- a/libavutil/x86/intreadwrite.h +++ b/libavutil/x86/intreadwrite.h @@ -22,6 +22,9 @@ #define AVUTIL_X86_INTREADWRITE_H #include +#if HAVE_INTRINSICS_SSE2 +#include +#endif #include "config.h" #include "libavutil/attributes.h" @@ -43,20 +46,16 @@ static av_always_inline void AV_COPY128(void *d, const void *s) #endif /* __SSE__ */ -#ifdef __SSE2__ +#if HAVE_INTRINSICS_SSE2 #define AV_ZERO128 AV_ZERO128 static av_always_inline void AV_ZERO128(void *d) { - struct v {uint64_t v[2];}; - - __asm__("pxor %%xmm0, %%xmm0 \n\t" - "movdqa %%xmm0, %0 \n\t" - : "=m"(*(struct v*)d) - :: "xmm0"); + __m128i zero = _mm_setzero_si128(); + _mm_store_si128(d, zero); } -#endif /* __SSE2__ */ +#endif /* HAVE_INTRINSICS_SSE2 */ #endif /* HAVE_MMX */