]> granicus.if.org Git - clang/commit
Improve C11 atomics support:
authorDavid Chisnall <csdavec@swan.ac.uk>
Sun, 3 Mar 2013 16:02:42 +0000 (16:02 +0000)
committerDavid Chisnall <csdavec@swan.ac.uk>
Sun, 3 Mar 2013 16:02:42 +0000 (16:02 +0000)
commit72c1dba494b02960284bc6618c1b640c950c3785
tree7871ecd146763704e3207ccd2abcae724f0d7bfe
parent5b9f5cc7c4310aec110f315df6fc6d6366b24b08
Improve C11 atomics support:

- Generate atomicrmw operations in most of the cases when it's sensible to do
  so.
- Don't crash in several common cases (and hopefully don't crash in more of
  them).
- Add some better tests.

We now generate significantly better code for things like:
_Atomic(int) x;
...
x++;

On MIPS, this now generates a 4-instruction ll/sc loop, where previously it
generated about 30 instructions in two nested loops.  On x86-64, we generate a
single lock incl, instead of a lock cmpxchgl loop (one instruction instead of
ten).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176420 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/CGExprScalar.cpp
test/CodeGen/atomic_ops.c
test/CodeGen/c11atomics.c [new file with mode: 0644]