[InstCombine] Signed saturation tests. NFC
[llvm-complete.git] / include / llvm / Support / Atomic.h
bloba8445fddc1a85537ecaae14f29998a7777bc99ad
1 //===- llvm/Support/Atomic.h - Atomic Operations -----------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the llvm::sys atomic operations.
11 // DO NOT USE IN NEW CODE!
13 // New code should always rely on the std::atomic facilities in C++11.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_SUPPORT_ATOMIC_H
18 #define LLVM_SUPPORT_ATOMIC_H
20 #include "llvm/Support/DataTypes.h"
22 // Windows will at times define MemoryFence.
23 #ifdef MemoryFence
24 #undef MemoryFence
25 #endif
27 namespace llvm {
28 namespace sys {
29 void MemoryFence();
31 #ifdef _MSC_VER
32 typedef long cas_flag;
33 #else
34 typedef uint32_t cas_flag;
35 #endif
36 cas_flag CompareAndSwap(volatile cas_flag* ptr,
37 cas_flag new_value,
38 cas_flag old_value);
42 #endif