emitAtomic*PartWord unconditionally sign extend their results causing
failures with __c11_atomic_compare_exchange_strong & co due to an
unsigned value being compared to a sign extended value.
Fix this by using a custom lowering for ATOMIC_CMP_SWAP_WITH_SUCCESS, so that
the cmp operand of the setCC is sign extended as well. Additionally, when
legalizing ATOMIC_CMP_SWAP, don't assume it is a ATOMIC_CMP_SWAP_WITH_SUCCESS.
I think this should be in LegalizeDAG.cpp, with ZExt or SExt chosen based on a TLI callback. It ought to be a shorter change there, and fix other targets too.