This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Generate the CASP instruction for 128-bit cmpxchg
ClosedPublic

Authored by olista01 on Jan 16 2018, 7:01 AM.

Details

Summary

The Large System Extension added an atomic compare-and-swap instruction
that operates on a pair of 64-bit registers, which we can use to
implement a 128-bit cmpxchg.

Because i128 is not a legal type for AArch64 we have to do all of the
instruction selection in C++, and the instruction requires even/odd
register pairs, so we have to wrap it in REG_SEQUENCE and EXTRACT_SUBREG
nodes. This is very similar to what we do for 64-bit cmpxchg in the ARM
backend.

Diff Detail

Repository
rL LLVM

Event Timeline

olista01 created this revision.Jan 16 2018, 7:01 AM
christof accepted this revision.Jan 26 2018, 7:26 AM

Code looks well formatted to me, implementation is reasonable to me. It is a bit of a shame that it can't be done in tablegen as the lowering function gets a bit big. But since i128 is not a legal type, I guess this is the best we can get.

This revision is now accepted and ready to land.Jan 26 2018, 7:26 AM
This revision was automatically updated to reflect the committed changes.