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 :) ). I also attached the two testcases I've been using. Andrew -------------- next part -------------- A non-text attachment was scrubbed... Name: atomic.patch Type: text/x-diff Size: 33663 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080220/49fabbdc/attachment.patch> -------------- next part -------------- A non-text attachment was scrubbed... Name: test32.ll Type: application/octet-stream Size: 705 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080220/49fabbdc/attachment.obj> -------------- next part -------------- A non-text attachment was scrubbed... Name: test64.ll Type: application/octet-stream Size: 705 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080220/49fabbdc/attachment-0001.obj>
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). Andrew On 2/20/08, Andrew Lenharth <andrewl at lenharth.org> wrote:> 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 :) ). > > I also attached the two testcases I've been using. > > > Andrew > >