HomePhabricator

[OPENMP] Codegen for 'atomic update' construct.

Description

[OPENMP] Codegen for 'atomic update' construct.

Adds atomic update codegen for the following forms of expressions:

x binop= expr;
x++;
++x;
x--;
--x;
x = x binop expr;
x = expr binop x;
If x and expr are integer and binop is associative or x is a LHS in a RHS of the assignment expression, and atomics are allowed for type of x on the target platform atomicrmw instruction is emitted.
Otherwise compare-and-swap sequence is emitted:

bb:
...
atomic load <x>
cont:
<expected> = phi [ <x>, label %bb ], [ <new_failed>, %cont ]
<desired> = <expected> binop <expr>
<res> = cmpxchg atomic &<x>, desired, expected
<new_failed> = <res>.field1;
br <res>field2, label %exit, label %cont
exit:
...

Differential Revision: http://reviews.llvm.org/D8536

Details

Committed
ABataevMar 29 2015, 10:20 PM
Differential Revision
D8536: [OPENMP] Codegen for 'atomic update' construct.
Parents
rL233512: [MCJIT] In debug memory dump output, don't truncate 64 bit addresses
Branches
Unknown
Tags
Unknown