[LLVMdev] cmpxchg instruction with pointer operands

David Chisnall dc552 at cam.ac.uk
Tue Sep 9 03:58:31 PDT 2014


On 8 Sep 2014, at 21:09, Philip Reames <listmail at philipreames.com> wrote:

> This has been brought up a couple times now.  I don't believe anyone has voiced strong objection to having a variant which directly takes pointers, but no one has proposed a patch either.  
> 
> p.s. I'm solidly in the "it would be nice to see" camp.  For much the same reasons as David.  

I'm also in two minds about whether it would be a good idea to allow the atomic cmpxchg to support arbitrary types.  With RTM, for example, you might want to lower an atomic exchange of a structure to a begin-transaction, memcmp, memcpy, end-transaction block.  Elsewhere, you lower it to a call to a helper function that does the right thing.  Currently, this decision is made in the front end, but that removes some potential optimisation opportunities.

David





More information about the llvm-dev mailing list