Commit Graph

1 Commits

Author SHA1 Message Date
Junjie Mao ea137589e6 DM: add wrappers to gcc built-in atomic operations
This patch introduces wrappers to the built-in atomic operations provided by
gcc.

There are two sets of built-in atomic functions available. Before gcc 4.7.0 only
the __sync built-in functions are available, while since 4.7.0 a new set of
built-in functions with the __atomic prefix is introduced as a
replacement. Since the __sync functions will eventually be deprecated, the
__atomic ones are preferred whenever available.

The interfaces provided are listed below, mostly following the naming of the
underlying built-in functions which explain themselves.

    atomic_load
    atomic_store
    atomic_xchg
    atomic_cmpxchg

    atomic_add_fetch
    atomic_sub_fetch
    atomic_and_fetch
    atomic_xor_fetch
    atomic_or_fetch
    atomic_nand_fetch

    atomic_fetch_add
    atomic_fetch_sub
    atomic_fetch_and
    atomic_fetch_xor
    atomic_fetch_or
    atomic_fetch_nand

    atomic_test_and_set
    atomic_clear
    atomic_thread_fence
    atomic_signal_fence

Tracked-On: #875
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
2018-08-08 15:53:07 +08:00