_InterlockedCompare64Exchange128, _InterlockedCompare64Exchange128_acq, _InterlockedCompare64Exchange128_rel
Provides atomic 128-bit compiler intrinsic support for the Win32 Platform SDK InterlockedCompareExchange function.
__int64 _InterlockedCompare64Exchange128( __int64 volatile * Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comperand ); __int64 _InterlockedCompare64Exchange128_acq( __int64 volatile * Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comperand ); __int64 _InterlockedCompare64Exchange128_rel( __int64 volatile * Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 Comperand );
- [in, out] Destination
Pointer to the 128-bit Destination value.
- [in] ExchangeHigh
The most significant 64 bit of the Exchange value.
- [in] ExchangeLow
The least significant 64 bit of the Exchange value.
- [in] Comperand
Value to compare to destination.
The return value is the initial least significant 64-bit value of the destination.
Header file <intrin.h>
Note that the intrinsic form of this function has a leading underscore in the name. Also note that these functions are always expanded as intrinsics. That means you can use /Oi, but it is not required. /Oi implied with /O2.
Optionally, you can declare these functions for use as an intrinsic. You must declare them with the leading underscore, and the function name might also appear in a #pragma intrinsic statement. It is strongly recommended that you declare these functions to let the compiler catch parameter type mismatches.
These functions are not general-purpose 128-bit intrinsics. These functions should only be used if you really need 128-bit atomic compare-exchange operations; otherwise use the corresponding 64-bit versions for better performance.
The _InterlockedCompare64Exchange128 function performs an atomic comparison of the least significant 64 bits of the Destination value with the Comperand value. If the Destination value is equal to the Comperand value, the 128-bit Exchange value is stored in the address specified by Destination. Otherwise, no operation is performed. The Destination pointer should point to a 16-byte aligned memory location.
The _InterlockedCompare64Exchange128_acq intrinsic function is the same as the corresponding function without the _acq suffix except that the operation is performed with acquire semantics.
The _InterlockedCompare64Exchange128_rel intrinsic function is the same as the corresponding function without the _rel suffix except that the operation is performed with release semantics.
On the x64 platform, the _acq and _rel forms are the same as the corresponding function without the _acq or _rel suffixes. These forms are supported for source code compatibility with the IPF platform.
The x64 platform does not have hardware support for the above described 128-bit atomic operations. The intrinsic function generates code that emulates the IPF semantics.
In Visual C++ 2005, these functions behave as read-write barriers. For more information, see _ReadWriteBarrier.