This is an archive of the discontinued LLVM Phabricator instance.

[AArch64] Improve v8.1-A code-gen for atomic load-and
ClosedPublic

Authored by olista01 on Jan 24 2018, 6:58 AM.

Details

Summary

Armv8.1-A added an atomic load-clear instruction (which performs bitwise
and with the complement of it's operand), but not a load-and
instruction. Our current code-generation for atomic load-and always
inserts an MVN instruction to invert its argument, even if it could be
folded into a constant or another instruction.

This adds lowering early in selection DAG to convert a load-and
operation into an xor with -1 and a load-clear, allowing the normal DAG
optimisations to work on it.

To do this, I've had to add a new ISD opcode, ATOMIC_LOAD_CLR. I don't
see any easy way to do this with an AArch64-specific ISD node, because
the code-generation for atomic operations assumes the SDNodes are of
type AtomicSDNode.

I've left the old tablegen patterns in because they are still needed for
global isel.

Diff Detail

Repository
rL LLVM

Event Timeline

olista01 created this revision.Jan 24 2018, 6:58 AM
christof accepted this revision.Feb 12 2018, 8:39 AM

This looks good to me. Thanks

This revision is now accepted and ready to land.Feb 12 2018, 8:39 AM
This revision was automatically updated to reflect the committed changes.