Skip to content

Commit ed4194b

Browse files
authored
[X86] Set MaxAtomicSizeInBitsSupported. (#75112)
This will result in larger atomic operations getting expanded to `__atomic_*` libcalls via AtomicExpandPass, which matches what Clang already does in the frontend.
1 parent 1954686 commit ed4194b

File tree

6 files changed

+299
-195
lines changed

6 files changed

+299
-195
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
142142
setLibcallName(RTLIB::POWI_F64, nullptr);
143143
}
144144

145-
// If we don't have cmpxchg8b(meaing this is a 386/486), limit atomic size to
146-
// 32 bits so the AtomicExpandPass will expand it so we don't need cmpxchg8b.
147-
// FIXME: Should we be limiting the atomic size on other configs? Default is
148-
// 1024.
149-
if (!Subtarget.canUseCMPXCHG8B())
145+
if (Subtarget.canUseCMPXCHG16B())
146+
setMaxAtomicSizeInBitsSupported(128);
147+
else if (Subtarget.canUseCMPXCHG8B())
148+
setMaxAtomicSizeInBitsSupported(64);
149+
else
150150
setMaxAtomicSizeInBitsSupported(32);
151151

152152
setMaxDivRemBitWidthSupported(Subtarget.is64Bit() ? 128 : 64);

0 commit comments

Comments
 (0)