[LLVMdev] Proposal for a new LLVM concurrency memory model

Jeffrey Yasskin jyasskin at google.com
Mon Apr 26 13:54:36 PDT 2010


On Mon, Apr 26, 2010 at 1:28 PM, Lacey, Mark <mark.lacey at intel.com> wrote:
>> Hi all,
>>
>> Chandler, Owen, and I have written up a proposal for a new memory
>> model and atomic intrinsics in LLVM, which will make it possible to
>> support Java and the upcoming C++0x standard. The proposed changes to
>> the LangRef are at
>> <http://docs.google.com/View?docID=ddb4mhxz_22dz5g98dd&revision=_latest
>> >,
>> and a rationale for some of the more surprising changes is at
>> <http://docs.google.com/View?docID=ddb4mhxz_24gh4ksvgh&revision=_latest
>> >.
>
> From a first glance, it looks like double-wide compare exchange is missing.
> See http://en.wikipedia.org/wiki/ABA_problem for an example of where it's
> very useful.

You'll be able to get at double-wide compare exchange on 64-bit
platforms with @llvm.atomic.cmp.exchange.i128.p0i128 (same as you can
now). If your target doesn't support this width, it may explode when
you get to codegen. We don't have any plans for an intrinsic for
Itanium's cmp8xchg16 instruction (since we don't know of a language
that supports it that compiles to LLVM, and it doesn't fit well into
the api for ordinary cmpxchges), but someone could propose that as an
extension later.

The more abstract cmp.exchange on {i8*, i8*} would require extending
how intrinsics work or switching to instructions. For now, I think
casting to i128s will be ok for most frontends.

Thanks for taking a look,
Jeffrey



More information about the llvm-dev mailing list