headers: Add the _InterlockedCompareExchange8 intrinsic

Signed-off-by: TheShermanTanker <tanksherman27@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
This commit is contained in:
TheShermanTanker 2024-10-28 14:34:27 +08:00 committed by LIU Hao
parent 99684a9399
commit 9c534de9d1
3 changed files with 16 additions and 1 deletions

View File

@ -1157,7 +1157,7 @@ src_intrincs= \
intrincs/bittest.c intrincs/bittestc.c intrincs/bittestci.c intrincs/bittestr.c intrincs/bittestri.c \
intrincs/bittests.c intrincs/bittestsi.c intrincs/cpuid.c \
intrincs/ilockadd.c intrincs/ilockand.c intrincs/ilockand64.c \
intrincs/ilockcxch.c \
intrincs/ilockcxch.c intrincs/ilockcxch8.c \
intrincs/ilockcxch16.c intrincs/ilockcxch64.c intrincs/ilockcxchptr.c intrincs/ilockdec.c intrincs/ilockdec16.c \
intrincs/ilockdec64.c intrincs/ilockexch.c intrincs/ilockexch64.c intrincs/ilockexchadd.c intrincs/ilockexchadd64.c \
intrincs/ilockexchptr.c intrincs/ilockinc.c intrincs/ilockinc16.c intrincs/ilockinc64.c intrincs/ilockor.c \

View File

@ -0,0 +1,4 @@
#define __INTRINSIC_ONLYSPECIAL
#define __INTRINSIC_SPECIAL__InterlockedCompareExchange8
#include <intrin.h>

View File

@ -1619,6 +1619,17 @@ __buildlogicali(_InterlockedXor, __LONG32, xor)
#define __INTRINSIC_DEFINED__InterlockedXor
#endif /* __INTRINSIC_PROLOG */
#if __INTRINSIC_PROLOG(_InterlockedCompareExchange8)
char _InterlockedCompareExchange8(char volatile *destination, char exchange, char comperand);
#if !__has_builtin(_InterlockedCompareExchange8)
__INTRINSICS_USEINLINE
char _InterlockedCompareExchange8(char volatile *destination, char exchange, char comperand) {
return __sync_val_compare_and_swap(destination, comperand, exchange);
}
#endif
#define __INTRINSIC_DEFINED__InterlockedCompareExchange8
#endif /* __INTRINSIC_PROLOG */
#if __INTRINSIC_PROLOG(_InterlockedIncrement16)
short _InterlockedIncrement16(short volatile *Addend);
#if !__has_builtin(_InterlockedIncrement16)