Support expanding partial-word cmpxchg to full-word cmpxchg in AtomicExpandPass.
authorJames Y Knight <jyknight@google.com>
Fri, 17 Jun 2016 18:11:48 +0000 (18:11 +0000)
committerJames Y Knight <jyknight@google.com>
Fri, 17 Jun 2016 18:11:48 +0000 (18:11 +0000)
commit148a6469dccf3c8a20874b1b451549826a1e4da8
tree7f92528634d462dd81abeb5735c3c4cc8ce4f4e1
parent4cccc488b78c8e3258828a1f18ffc9e61b184bee
Support expanding partial-word cmpxchg to full-word cmpxchg in AtomicExpandPass.

Many CPUs only have the ability to do a 4-byte cmpxchg (or ll/sc), not 1
or 2-byte. For those, you need to mask and shift the 1 or 2 byte values
appropriately to use the 4-byte instruction.

This change adds support for cmpxchg-based instruction sets (only SPARC,
in LLVM). The support can be extended for LL/SC-based PPC and MIPS in
the future, supplanting the ISel expansions those architectures
currently use.

Tests added for the IR transform and SPARCv9.

Differential Revision: http://reviews.llvm.org/D21029

llvm-svn: 273025
llvm/include/llvm/Target/TargetLowering.h
llvm/lib/CodeGen/AtomicExpandPass.cpp
llvm/lib/CodeGen/TargetLoweringBase.cpp
llvm/lib/Target/Sparc/SparcISelLowering.cpp
llvm/test/CodeGen/SPARC/atomics.ll
llvm/test/Transforms/AtomicExpand/SPARC/partword.ll [new file with mode: 0644]