14#include "llvm/Config/llvm-config.h"
26#if defined(__GNUC__) || (defined(__IBMCPP__) && __IBMCPP__ >= 1210)
31#if LLVM_HAS_ATOMICS == 0
34# if defined(GNU_ATOMICS)
36# elif defined(_MSC_VER)
39# error No memory fence implementation for your platform!
47#if LLVM_HAS_ATOMICS == 0
49 if (result == old_value)
52#elif defined(GNU_ATOMICS)
53 return __sync_val_compare_and_swap(ptr, old_value, new_value);
54#elif defined(_MSC_VER)
55 return InterlockedCompareExchange(ptr, new_value, old_value);
57# error No compare-and-swap implementation for your platform!
cas_flag CompareAndSwap(volatile cas_flag *ptr, cas_flag new_value, cas_flag old_value)
This is an optimization pass for GlobalISel generic memory operations.