PowerPC Atomic Memory Operation Functions (Using the GNU Compiler Collection (GCC))

#### 7.13.26 PowerPC Atomic Memory Operation Functions ¶

ISA 3.0 of the PowerPC added new atomic memory operation (amo) instructions. GCC provides support for these instructions in 64-bit environments. All of the functions are declared in the include file `amo.h`.

The functions supported are:

    #include <amo.h>

    uint32_t amo_lwat_add (uint32_t *, uint32_t);
    uint32_t amo_lwat_xor (uint32_t *, uint32_t);
    uint32_t amo_lwat_ior (uint32_t *, uint32_t);
    uint32_t amo_lwat_and (uint32_t *, uint32_t);
    uint32_t amo_lwat_umax (uint32_t *, uint32_t);
    uint32_t amo_lwat_umin (uint32_t *, uint32_t);
    uint32_t amo_lwat_swap (uint32_t *, uint32_t);
    uint32_t amo_lwat_cas_neq (uint32_t *, uint32_t, uint32_t);
    uint32_t amo_lwat_inc_eq (uint32_t *);
    uint32_t amo_lwat_inc_bounded (uint32_t *);
    uint32_t amo_lwat_dec_bounded (uint32_t *);

    int32_t amo_lwat_sadd (int32_t *, int32_t);
    int32_t amo_lwat_smax (int32_t *, int32_t);
    int32_t amo_lwat_smin (int32_t *, int32_t);
    int32_t amo_lwat_sswap (int32_t *, int32_t);
    int32_t amo_lwat_scas_neq (int32_t *, int32_t, int32_t);
    int32_t amo_lwat_sinc_eq (int32_t *);
    int32_t amo_lwat_sinc_bounded (int32_t *);
    int32_t amo_lwat_sdec_bounded (int32_t *);

    uint64_t amo_ldat_add (uint64_t *, uint64_t);
    uint64_t amo_ldat_xor (uint64_t *, uint64_t);
    uint64_t amo_ldat_ior (uint64_t *, uint64_t);
    uint64_t amo_ldat_and (uint64_t *, uint64_t);
    uint64_t amo_ldat_umax (uint64_t *, uint64_t);
    uint64_t amo_ldat_umin (uint64_t *, uint64_t);
    uint64_t amo_ldat_swap (uint64_t *, uint64_t);
    uint64_t amo_ldat_cas_neq (uint64_t *, uint64_t, uint64_t);
    uint64_t amo_ldat_inc_eq (uint64_t *);
    uint64_t amo_ldat_inc_bounded (uint64_t *);
    uint64_t amo_ldat_dec_bounded (uint64_t *);

    int64_t amo_ldat_sadd (int64_t *, int64_t);
    int64_t amo_ldat_smax (int64_t *, int64_t);
    int64_t amo_ldat_smin (int64_t *, int64_t);
    int64_t amo_ldat_sswap (int64_t *, int64_t);
    int64_t amo_ldat_scas_neq (int64_t *, int64_t, int64_t);
    int64_t amo_ldat_sinc_eq (int64_t *);
    int64_t amo_ldat_sinc_bounded (int64_t *);
    int64_t amo_ldat_sdec_bounded (int64_t *);

    void amo_stwat_add (uint32_t *, uint32_t);
    void amo_stwat_xor (uint32_t *, uint32_t);
    void amo_stwat_ior (uint32_t *, uint32_t);
    void amo_stwat_and (uint32_t *, uint32_t);
    void amo_stwat_umax (uint32_t *, uint32_t);
    void amo_stwat_umin (uint32_t *, uint32_t);
    void amo_stwat_twin (uint32_t *, uint32_t);

    void amo_stwat_sadd (int32_t *, int32_t);
    void amo_stwat_smax (int32_t *, int32_t);
    void amo_stwat_smin (int32_t *, int32_t);
    void amo_stwat_stwin (int32_t *, int32_t);

    void amo_stdat_add (uint64_t *, uint64_t);
    void amo_stdat_xor (uint64_t *, uint64_t);
    void amo_stdat_ior (uint64_t *, uint64_t);
    void amo_stdat_and (uint64_t *, uint64_t);
    void amo_stdat_umax (uint64_t *, uint64_t);
    void amo_stdat_umin (uint64_t *, uint64_t);
    void amo_stdat_twin (uint64_t *, uint64_t);

    void amo_stdat_sadd (int64_t *, int64_t);
    void amo_stdat_smax (int64_t *, int64_t);
    void amo_stdat_smin (int64_t *, int64_t);
    void amo_stdat_stwin (int64_t *, int64_t);