Attached is a patch to support atomic compare and swap, load add
store, and swap. These I think should be a sufficient minimal set of
atomic intrinsics.

Only Alpha has codegen support for all intrinsics (hey, alpha has to
have something shiny and new occasionally). X86 is a matter of
implementing the various xchange instructions and the lock prefix (by
someone more familiar with that .td file than me :slight_smile: ).

I also attached the two testcases I've been using.


atomic.patch (32.9 KB)

test32.ll (705 Bytes)

test64.ll (705 Bytes)

I should add that there is no libgcc functions for these to expand
too, so Target maintainers will need to implement them at some point.
(Including x86, the pseudo op was just a place holder because the
instruction and prefix needed did not exist yet).