Skip to content

Commit

Permalink
[X86] Set MaxAtomicSizeInBitsSupported. (#75112)
Browse files Browse the repository at this point in the history
This will result in larger atomic operations getting expanded to
`__atomic_*` libcalls via AtomicExpandPass, which matches what Clang
already does in the frontend.
  • Loading branch information
jyknight authored Dec 12, 2023
1 parent 1954686 commit ed4194b
Show file tree
Hide file tree
Showing 6 changed files with 299 additions and 195 deletions.
10 changes: 5 additions & 5 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ X86TargetLowering::X86TargetLowering(const X86TargetMachine &TM,
setLibcallName(RTLIB::POWI_F64, nullptr);
}

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

setMaxDivRemBitWidthSupported(Subtarget.is64Bit() ? 128 : 64);
Expand Down
Loading

0 comments on commit ed4194b

Please sign in to comment.