[PATCH] X86: elide comparisons after cmpxchg instructions.

Tim Northover t.p.northover at gmail.com
Tue Jun 10 03:05:18 PDT 2014


The C++ and C semantics of the compare_and_swap operations actually require us to return a boolean "success" value. In LLVM terms this means a second comparison of the output of "cmpxchg" against the input desired value.
    
However, x86's "cmpxchg" instruction sets all flags for the comparison formed, so we can skip any secondary comparison. (N.b. this isn't true for cmpxchg8b/16b, which only set ZF -- I'm hoping to deal with them in a separate patch later).

A bit of refactoring was needed, but there should be no actual changes to the LowerCMP_SWAP function.

OK to commit?

Cheers.

Tim.

http://reviews.llvm.org/D4083

Files:
  lib/Target/X86/X86ISelLowering.cpp
  lib/Target/X86/X86ISelLowering.h
  test/CodeGen/X86/cmpxchg-i1.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4083.10269.patch
Type: text/x-patch
Size: 11844 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140610/a18af067/attachment.bin>


More information about the llvm-commits mailing list