GlobalISel: Don't fail translate on weak cmpxchg
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 12 Jun 2020 12:49:18 +0000 (08:49 -0400)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 26 Jun 2020 21:52:18 +0000 (17:52 -0400)
commitc2e403c19d40524f868d7803b104224ca4978597
tree399d591f43f46d3bb06da95d09fb42470d16af40
parent990f8702c911e444c23a5365ac22d359fc96f7b5
GlobalISel: Don't fail translate on weak cmpxchg

The translation of cmpxchg added by
9481399c0fd2c198c81b92636c0dcff7d4c41df2 specifically skipped weak
cmpxchg due to not understanding the meaning. Weak cmpxchg was added
in 420a216817def01816186910a2e35885c9201951. As explained in the
commit message, the weak mode is implicit in how
ATOMIC_CMP_SWAP_WITH_SUCCESS is lowered. If it's expanded to a regular
ATOMIC_CMP_SWAP, it's replaced with a strong cmpxchg.

This handling seems weird to me, but this was already following the
DAG behavior. I would expect the strong IR instruction to not have the
boolean output. Failing that, I might expect the IRTranslator to emit
ATOMIC_CMP_SWAP and a constant for the boolean.
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll