[x264-devel] [Git][videolan/x264][master] Enable use of __sync_fetch_and_add() wherever detected instead of just X86
Anton Mitrofanov (@BugMaster)
gitlab at videolan.org
Sun Dec 29 17:35:34 UTC 2024
Anton Mitrofanov pushed to branch master at VideoLAN / x264
Commits:
a64111b1 by Brad Smith at 2024-12-29T12:13:33-05:00
Enable use of __sync_fetch_and_add() wherever detected instead of just X86
Use __sync_fetch_and_add() wherever detected instead of being limited to
just X86.
- - - - -
2 changed files:
- common/osdep.h
- configure
Changes:
=====================================
common/osdep.h
=====================================
@@ -434,7 +434,7 @@ X264_API int x264_threading_init( void );
static ALWAYS_INLINE int x264_pthread_fetch_and_add( int *val, int add, x264_pthread_mutex_t *mutex )
{
#if HAVE_THREAD
-#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 0) && (ARCH_X86 || ARCH_X86_64)
+#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ > 0) && HAVE_SYNC_FETCH_AND_ADD
return __sync_fetch_and_add( val, add );
#else
x264_pthread_mutex_lock( mutex );
=====================================
configure
=====================================
@@ -412,7 +412,7 @@ NL="
CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON AARCH64 BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC INTEL_DISPATCHER \
MSA LSX MMAP WINRT VSX ARM_INLINE_ASM STRTOK_R CLOCK_GETTIME BITDEPTH8 BITDEPTH10 SVE SVE2 ELF_AUX_INFO GETAUXVAL \
- SYSCONF"
+ SYSCONF SYNC_FETCH_AND_ADD"
# parse options
@@ -1136,6 +1136,10 @@ if [ "$thread" = "posix" ]; then
fi
[ "$thread" != "no" ] && define HAVE_THREAD
+if cc_check '' '' 'int *val; __sync_fetch_and_add(&val, 1);' ; then
+ define HAVE_SYNC_FETCH_AND_ADD
+fi
+
if cc_check 'math.h' '' 'volatile float x = 2; return log2f(x);' ; then
define HAVE_LOG2F
fi
View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/a64111b1b35982bd83ec9573570a269a541d0b0c
--
View it on GitLab: https://code.videolan.org/videolan/x264/-/commit/a64111b1b35982bd83ec9573570a269a541d0b0c
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the x264-devel
mailing list