Prototype | Description |
---|---|
unsigned int __check_lock_mp (const int* addr, int old_value, int new_value); | Check Lock on Multiprocessor Systems
Conditionally updates a single word variable atomically. addr specifies the address of the single word variable. old_value specifies the old value to be checked against the value of the single word variable. new_value specifies the new value to be conditionally assigned to the single word variable. The word variable must be aligned on a full word boundary. Return values:
|
unsigned int __check_lockd_mp (const long long int* addr, long long int old_value, long long int new_value); | Check Lock Doubleword on Multiprocessor Systems
Conditionally updates a doubleword variable atomically. addr specifies the address of the doubleword variable. old_value specifies the old value to be checked against the value of the doubleword variable. new_value specifies the new value to be conditionally assigned to the doubleword variable. The doubleword variable must be aligned on a doubleword boundary. Return values:
Supported only in 64-bit mode. |
unsigned int __check_lock_up (const int* addr, int old_value, int new_value); | Check Lock on Uniprocessor Systems
Conditionally updates a single word variable atomically. addr specifies the address of the single word variable. old_value specifies the old value to be checked against the value of the single word variable. new_value specifies the new value to be conditionally assigned to the single word variable. The word variable must be aligned on a full word boundary. Return values:
|
unsigned int __check_lockd_up (const long long int* addr, long long int old_value, int long long new_value); | Check Lock Doubleword on Uniprocessor systems
Conditionally updates a doubleword variable atomically. addr specifies the address of the doubleword variable. old_value specifies the old value to be checked against the value of the doubleword variable. new_value specifies the new value to be conditionally assigned to the doubleword variable. The doubleword variable must be aligned on a doubleword boundary. Return values:
Supported only in 64-bit mode. |
void __clear_lock_mp (const int* addr, int value); | Clear Lock on Multiprocessor Systems
Atomic store of the value into the single word variable at the address addr. The word variable must be aligned on a full word boundary. |
void __clear_lockd_mp (const long long int* addr, long long int value); | Clear Lock Doubleword on Multiprocessor Systems
Atomic store of the value into the doubleword variable at the address addr. The doubleword variable must be aligned on a doubleword boundary. Supported only in 64-bit mode. |
void __clear_lock_up (const int* addr, int value); | Clear Lock on Uniprocessor Systems
Atomic store of the value into the single word variable at the address addr. The word variable must be aligned on a full word boundary. |
void __clear_lockd_up (const long long int* addr, long long int value); | Clear Lock Doubleword on Uniprocessor Systems
Atomic store of the value into the doubleword variable at the address addr. The doubleword variable must be aligned on a doubleword boundary. Supported only in 64-bit mode. |
int __compare_and_swap(volatile int* addr, int* old_val_addr, int new_val); | Performs an atomic operation which compares the contents
of a single word variable with a stored old value. If the values are equal,
a new value is stored in the single word variable and 1 is returned; otherwise,
the single word variable is not updated and 0 is returned. In either case,
the contents of the memory location specified by addr are
copied into the memory location specified by old_val_addr.
The __compare_and_swap function is useful when a single word value must be updated only if it has not been changed since it was last read. The memory location that is taken as the input parameteraddr must be 4-byte aligned. If __compare_and_swap is used as a locking primitive, insert a call to the __isync built-in function at the start of any critical sections. |
int __compare_and_swaplp(volatile long* addr, long* old_val_addr, long new_val); | Performs an atomic operation which compares the contents
of a doubleword variable with a stored old value. If the values are equal,
a new value is stored in the doubleword variable and 1 is returned; otherwise,
the doubleword variable is not updated and 0 is returned. In either case,
the contents of the memory location specified byaddr are copied into
the memory location specified by old_val_addr. The memory location
that is taken as the input parameteraddr must be 8-byte aligned.
This function is useful when a doubleword value must be updated only if it has not been changed since it was last read. If __compare_and_swaplp is used as a locking primitive, insert a call to the __isync built-in function at the start of any critical sections. Supported only in 64-bit mode. |
void __eieio(void); | Enforce In-order Execution
of Input/Output
Ensures that all I/O storage access instructions preceding the call to __eioeio complete in main memory before I/O storage access instructions following the function call can execute. This built-in function is useful to manage shared data instructions where the execution order of load/store access is significant. The function can provide the necessary functionality for controlling I/O stores without the cost to performance that can occur with other synchronization instructions. |
int __fetch_and_add(volatile int* addr, int val); | Increments the single word specified by addr by
the amount specified by val in a single atomic operation.
The return value is equal to the original contents of the memory location. The address specified by addr must be 4-byte aligned. This operation is useful when a counter variable is shared between several threads or processes. |
long __fetch_and_addlp(volatile long* addr, long val); | Increments the doubleword specified by addr by
the amount specified by val in a single atomic operation. The return
value is equal to the original contents of the memory location. The address
specified by addr must be 8-byte aligned.
This operation is useful when a counter variable is shared between several threads or processes. Supported only in 64-bit mode. |
unsigned int __fetch_and_and(volatile unsigned int* addr, unsigned int val); | Clears bits in the single word specified byaddr by AND-ing that value with the input val parameter, in a single
atomic operation. The return value is equal to the original contents of the
memory location. The address specified by addr must be 4-byte aligned.
This operation is useful when a variable containing bit flags is shared between several threads or processes. |
unsigned long __fetch_and_andlp(volatile unsigned long* addr, unsigned long val); | Clears bits in the doubleword specified by addr by AND-ing that value with the input val parameter, in a single
atomic operation. The return value is equal to the original contents of the
memory location. The address specified by addr must be 8-byte aligned.
This operation is useful when a variable containing bit flags is shared between several threads or processes. Supported only in 64-bit mode. |
unsigned int __fetch_and_or(volatile unsigned int* addr, unsigned intval); | Sets bits in the single word specified by addr by
OR-ing that value with the input val parameter, in a single atomic
operation. The return value is equal to the original contents of the memory
location. The address specified by addr must be 4-byte aligned.
This operation is useful when a variable containing bit flags is shared between several threads or processes. |
unsigned long __fetch_and_orlp(volatile unsigned long* addr, unsigned long val; | Sets bits in the doubleword specified by addr by
OR-ing that value with the input val parameter, in a single atomic
operation. The return value is equal to the original contents of the memory
location. The address specified by addr must be 8-byte aligned.
This operation is useful when a variable containing bit flags is shared between several threads or processes. Supported only in 64-bit mode. |
unsigned int __fetch_and_swap(volatile unsigned int* addr, unsigned intval); | Sets the single word specified by addr to the
value or the input val parameter and returns the original contents
of the memory location, in a single atomic operation.The address specified
by addr must be 4-byte aligned.
This operation is useful when a variable is shared between several threads or processes, and one thread needs to update the value of the variable without losing the value that was originally stored in the location. |
unsigned long __fetch_and_swaplp(volatile unsigned long* addr, unsigned long val); | Sets the doubleword specified by addr to the
value or the input val parameter and returns the original contents
of the memory location, in a single atomic operation. The address specified
by addr must be 8-byte aligned.
This operation is useful when a variable is shared between several threads or processes, and one thread needs to update the value of the variable without losing the value that was originally stored in the location. Supported only in 64-bit mode. |
void __iospace_eieio(void); | Alternate name for the __eieio built-in function (described above). |
void __iospace_lwsync(void); | Alternate name for the __lwsync built-in function (described below). |
void __iospace_sync(void);) | Alternate name for the __sync built-in function (described below). |
void __isync(void); | Waits for all previous instructions to complete and then discards any prefetched instructions, causing subsequent instructions to be fetched (or refetched) and executed in the context established by previous instructions. |
long __ldarx(volatile long* addr); | Load Doubleword and Reserve Indexed
Loads the value from the memory location specified by addr and returns the result. addr must be 8-byte aligned. Can be used with a subsequent __stdcx built-in function to implement a read-modify-write on a specified memory location. The two built-in functions work together to ensure that if the store is successfully performed, no other processor or mechanism can modify the target doubleword between the time the __ldarx function is executed and the time the __stdcx function completes. This has the same effect as inserting __fence built-in functions before and after the __ldarx built-in function and can inhibit compiler optimization of surrounding code (see Miscellaneous built-in functions for a description of the __fence built-in function. Supported only in 64-bit mode. |
int __lwarx(volatile int* addr); | Load Word and Reserve Indexed
Loads the value from the memory location specified by addr and returns the result. In 64-bit mode, the compiler returns the sign-extended result. addr must be 4-byte aligned. Can be used with a subsequent __stwcx built-in function to implement a read-modify-write on a specified memory location. The two built-in functions work together to ensure that if the store is successfully performed, no other processor or mechanism can modify the target doubleword between the time the __lwarx function is executed and the time the __stwcx function completes. This has the same effect as inserting __fence built-in functions before and after the __lwarx built-in function and can inhibit compiler optimization of surrounding code. |
void __lwsync(void); | Ensures that all store instructions preceding the call to __lwsync complete before any new instructions can be executed on the processor that executed the function. This allows you to synchronize between multiple processors with minimal performance impact, as __lwsync does not wait for confirmation from each processor. |
int __stdcx(volatile long* addr, long val); | Store Doubleword Conditional Indexed
Stores the value specified by val into the memory location specified by addr, and returns 1 if the update of the specified memory location is successful and 0 if it is unsuccessful. addr must be 8-byte aligned. Can be used with a preceding __ldarx built-in function to implement a read-modify-write on a specified memory location. The two built-in functions work together to ensure that if the store is successfully performed, no other processor or mechanism can modify the target doubleword between the time the __ldarx function is executed and the time the __stdcx function completes. This has the same effect as inserting __fence built-in functions before and after the __stdcx built-in function and can inhibit compiler optimization of surrounding code. Supported only in 64-bit mode. |
int __stwcx(volatile int* addr, int val); | Store Word Conditional Indexed
Stores the value specified by val into the memory location specified by addr, and returns 1 if the update of the specified memory location is successful and 0 if it is unsuccessful. addr must be 4-byte aligned. Can be used with a preceding __lwarx built-in function to implement a read-modify-write on a specified memory location. The two built-in functions work together to ensure that if the store is successfully performed, no other processor or mechanism can modify the target doubleword between the time the __lwarx function is executed and the time the __stwcx function completes. This has the same effect as inserting __fence built-in functions before and after the __stwcx built-in function and can inhibit compiler optimization of surrounding code. |
void __sync(void); |
Ensures that all instructions preceding the function the call to __sync complete before any instructions following the function call can execute. |