Skip to content

[AtomicExpand][RISCV] Call shouldExpandAtomicRMWInIR before widenPartwordAtomicRMW #80947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Feb 7, 2024

This gives the target a chance to keep an atomicrmw op that is smaller than the minimum cmpxchg size. This is needed to support the Zabha extension for RISC-V which provides i8/i16 atomicrmw operations, but does not provide an i8/i16 cmpxchg or LR/SC instructions.

This moves the widening until after the target requests LLSC/CmpXChg/MaskedIntrinsic expansion. Once we widen, we call shouldExpandAtomicRMWInIR again to give the target another chance to make a decision about the widened operation.

I considered making the targets return AtomicExpansionKind::Expand or a new expansion kind for And/Or/Xor, but that required the targets to special case And/Or/Xor which they weren't currently doing.

This should make it easier to implement #80192.

…wordAtomicRMW.

This gives the target a chance to keep an atomicrmw op that is
smaller than the minimum cmpxchg size. This is needed to support
the Zabha extension for RISC-V which provides i8/i16 atomicrmw
operations, but does not provide an i8/i16 cmpxchg or LR/SC instructions.

This moves the widening until after the target requests
LLSC/CmpXChg/MaskedIntrinsic expansion. Once we widen, we call
shouldExpandAtomicRMWInIR again to give the target another chance
to make a decision about the widened operation.

I considered making the targets return AtomicExpansionKind::Expand
or a new expansion kind for And/Or/Xor, but that required the
targets to special case And/Or/Xor which they weren't currently doing.

This should make it easier to implement llvm#80192.
Copy link
Contributor

@asb asb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@topperc topperc merged commit 79fec2f into llvm:main Feb 7, 2024
@topperc topperc deleted the pr/atomicrmw branch February 7, 2024 16:24
topperc added a commit to topperc/llvm-project that referenced this pull request Feb 10, 2024
dtcxzyw added a commit to dtcxzyw/llvm-project that referenced this pull request Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants