X86: correct 64-bit atomics on 32-bit
authorSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 14 Jul 2014 16:28:13 +0000 (16:28 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Mon, 14 Jul 2014 16:28:13 +0000 (16:28 +0000)
commit5335b49f9672c6199a326e49f60be6100e2f0564
tree9537eb907cc7b20b644b38b909897482e3866d53
parentf8cc317205ec64bcbac56d7b089922001a06fa87
X86: correct 64-bit atomics on 32-bit

We would emit a libcall for a 64-bit atomic on x86 after SVN r212119.  This was
due to the misuse of hasCmpxchg16 to indicate if cmpxchg8b was supported on a
32-bit target.  They were added at different times and would result in the
border condition being mishandled.

This fixes the border case to emit the cmpxchg8b instruction for 64-bit atomic
operations on x86 at the cost of restoring a long-standing bug in the codegen.
We emit a cmpxchg8b on all x86 targets even where the CPU does not support this
instruction (pre-Pentium CPUs).  Although this bug should be fixed, this was
present prior to SVN r212119 and this change, so this is not really introducing
a regression.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212956 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86AtomicExpandPass.cpp
test/CodeGen/X86/atomic-ops-ancient-64.ll