PLO - Perform Locked Operation available in ARCH(5)

With the PLO instruction, you can perform the following atomic read-modify-write operations:

To perform a particular operation, the PLO requires an address to a lock, a function code that specifies the operation to be performed and the relevant operands. Each PLO operation has four built-in functions associated with it. The functions take 32-bit, 64-bit, and 128-bit operands. Applications written with built-ins that take 64-bit or 128-bit operands need to be compiled and linked with LP64 option. In other words, PLO built-ins that end with the letter G, GR(64-bit operands), or X(128 bit operands) need to be compiled with LP64 option. For example, for the "compare and load" interface, the functions __plo_CLGR, __plo_CLG, and __plo_CLX need to be compiled with LP64 option.

The function prototypes, associated types, and helper macros will be declared in builtins.h header file. The argument names and order in the function prototypes attempt to reflect the description of the hardware instructions in z/Architecture Principles of Operation. A brief description is provided for each function prototype, data types, and helper macros.
Note: For every 8-byte PLO operation, there are two interfaces, for example, __plo_DSCG and __plo_DCSGR. The distinction between these two prototypes is that the former uses a parameter list to receive all its arguments.
All the atomic read-modify-write operations require a memory location, which is to be used as a lock and is the first argument for all the prototypes. The return type for all the functions is a signed integer, which returns the condition code set by the PLO instruction.
Note: There is no AR mode support. You need to enable support for the unsigned long long type to use the PLO interface. You also need to enable 64 bit mode compilation when using PLO built-ins that take 64-bit or 128-bit operands.