Page MenuHomePhabricator


Authored by sdardis on Mar 17 2016, 6:40 AM.



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.

Diff Detail

Event Timeline

sdardis updated this revision to Diff 50926.Mar 17 2016, 6:40 AM
sdardis retitled this revision from to [mips] Fix ATOMIC_CMP_SWAP_WITH_SUCCESS.
sdardis updated this object.
sdardis added a reviewer: vkalintiris.
sdardis added subscribers: llvm-commits, dsanders.

This patch doesn't cover the 32 on 64 bit case.

sdardis updated this revision to Diff 51158.Mar 21 2016, 7:02 AM

Removed unnecessary check for size and extend the handling for 32 bit atomics on 64 bit targets.

t.p.northover added inline comments.

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.

sdardis abandoned this revision.Mar 22 2016, 9:44 AM

Tim, I've abandoned this revision in favour of . Thanks.