[llvm] Add out-of-line-atomics support to GlobalISel (PR #74588)
Thomas Preud'homme via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 6 05:15:54 PST 2023
================
@@ -758,16 +758,39 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
all(typeInSet(0, {s8, s16, s32, s64, s128}), typeIs(2, p0)));
getActionDefinitionsBuilder(G_ATOMIC_CMPXCHG)
+ .libcallIf([&ST](const LegalityQuery &Query) {
+ return ST.outlineAtomics() && !ST.hasLSE();
+ })
.customIf([](const LegalityQuery &Query) {
return Query.Types[0].getSizeInBits() == 128;
})
.clampScalar(0, s32, s64)
.legalIf(all(typeInSet(0, {s32, s64}), typeIs(1, p0)));
+ getActionDefinitionsBuilder({G_ATOMICRMW_XCHG, G_ATOMICRMW_ADD,
+ G_ATOMICRMW_AND, G_ATOMICRMW_OR,
+ G_ATOMICRMW_XOR})
+ .libcallIf([&ST](const LegalityQuery &Query) {
+ return ST.outlineAtomics() && !ST.hasLSE();
+ })
+ .clampScalar(0, s32, s64)
+ .legalIf(all(typeInSet(0, {s32, s64}), typeIs(1, p0)));
+
+ getActionDefinitionsBuilder(G_ATOMICRMW_SUB)
+ .lowerIf([&ST](const LegalityQuery &Query) {
----------------
RoboTux wrote:
It is lowerIf because it is lowered in terms of G_ATOMICRMW_ADD in lower(). Because it has a different action (lower instead of libcall) I put it separately.
I could put the code in libcall instead if you think it is a better approach.
https://github.com/llvm/llvm-project/pull/74588
More information about the llvm-commits
mailing list