summaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/atomic_ops.c
blob: 9a18c9e94492ef9df783c5ed0246a9c25021797a (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s

void foo(void)
{
  _Atomic(int) i = 0;
  // Check that multiply / divides on atomics produce a cmpxchg loop
  i *= 2; // CHECK: cmpxchg
  i /= 2; // CHECK: cmpxchg
  // These should be emitting atomicrmw instructions, but they aren't yet
  i += 2; // CHECK: cmpxchg
  i -= 2; // CHECK: cmpxchg
  i++; // CHECK: cmpxchg
  i--; // CHECK: cmpxchg
}