__fetch_and_and, __builtin_ppc_fetch_and_and, __fetch_and_andlp, __builtin_ppc_fetch_and_andlp
Purpose
Clears bits in the word or doubleword specified by addr by AND-ing that value with the value specified by val, in a single atomic operation, and returns the original value of addr.
Prototype
unsigned int __builtin_ppc_fetch_and_and (volatile unsigned int* addr, unsigned int val);
unsigned long __builtin_ppc_fetch_and_andlp (volatile unsigned long* addr, unsigned long val);
unsigned int __fetch_and_and (volatile unsigned int* addr, unsigned int val);
unsigned long __fetch_and_andlp (volatile unsigned long* addr, unsigned long val);
- The built-in function in the form of
__nameis a synonym of the built-in function in the form of__builtin_ppc_name. - The built-in function in the form of
__nameis provided for compatibility with IBM® XL C/C++ for AIX® 16.1.0 or earlier releases. This built-in function form might be deprecated in the future.
Parameters
- addr
- The address of the variable to be ANDed. Must be aligned on a 4-byte boundary for a single word and on an 8-byte boundary for a doubleword.
- value
- The value by which the value in addr is to be ANDed.
Usage
This operation is useful when a variable containing bit flags is shared between several threads or processes.
__fetch_and_andlp is valid only in
64-bit mode.
This function generates the hardware instruction but does not act as an
instruction movement barrier within the compiler. If that is needed, you must also use the
__fence function.