mirror of
https://github.com/reactos/reactos.git
synced 2025-05-01 19:50:36 +00:00
[CRT] Implement _InterlockedCompareExchange128 intrinsic for GCC
This commit is contained in:
parent
3381bf39db
commit
20a6cff4dd
3 changed files with 12 additions and 0 deletions
|
@ -160,6 +160,7 @@ endif()
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
if(ARCH STREQUAL "amd64")
|
if(ARCH STREQUAL "amd64")
|
||||||
|
add_compile_options(-mcx16) # Generate CMPXCHG16
|
||||||
add_definitions(-U_X86_ -UWIN32)
|
add_definitions(-U_X86_ -UWIN32)
|
||||||
elseif(ARCH STREQUAL "arm")
|
elseif(ARCH STREQUAL "arm")
|
||||||
add_definitions(-U_UNICODE -UUNICODE)
|
add_definitions(-U_UNICODE -UUNICODE)
|
||||||
|
|
|
@ -41,6 +41,9 @@ endif()
|
||||||
add_compile_options(/GS-)
|
add_compile_options(/GS-)
|
||||||
|
|
||||||
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||||
|
if(ARCH STREQUAL "amd64")
|
||||||
|
add_compile_options(-mcx16) # Generate CMPXCHG16B
|
||||||
|
endif()
|
||||||
set(CMAKE_CL_SHOWINCLUDES_PREFIX "Note: including file: ")
|
set(CMAKE_CL_SHOWINCLUDES_PREFIX "Note: including file: ")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -699,6 +699,14 @@ __INTRIN_INLINE long long _InterlockedCompareExchange64(volatile long long * Des
|
||||||
#endif /* (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 && defined(__x86_64__) */
|
#endif /* (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 && defined(__x86_64__) */
|
||||||
#endif /* !HAS_BUILTIN(_InterlockedCompareExchange64) */
|
#endif /* !HAS_BUILTIN(_InterlockedCompareExchange64) */
|
||||||
|
|
||||||
|
#if defined(__x86_64__) && !HAS_BUILTIN(_InterlockedCompareExchange128)
|
||||||
|
__INTRIN_INLINE unsigned char _InterlockedCompareExchange128(_Interlocked_operand_ __int64 volatile* Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64* ComparandResult)
|
||||||
|
{
|
||||||
|
__int64 xchg[2] = { ExchangeLow, ExchangeHigh };
|
||||||
|
return __sync_bool_compare_and_swap((__uint128_t*)Destination, *((__uint128_t*)ComparandResult), *((__uint128_t*)xchg));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
__INTRIN_INLINE long _InterlockedAddLargeStatistic(volatile long long * Addend, long Value)
|
__INTRIN_INLINE long _InterlockedAddLargeStatistic(volatile long long * Addend, long Value)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue