[llvm] [NVPTX] add support for 128-bit atomics (PR #154852)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 25 12:05:26 PDT 2025
================
@@ -1026,15 +1026,19 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
setOperationAction(ISD::ADDRSPACECAST, {MVT::i32, MVT::i64}, Custom);
setOperationAction(ISD::ATOMIC_LOAD_SUB, {MVT::i32, MVT::i64}, Expand);
- // No FPOW or FREM in PTX.
+
+ // atom.b128 is legal in PTX but since we don't represent i128 as a legal
+ // type, we need to custom lower it.
+ setOperationAction({ISD::ATOMIC_CMP_SWAP, ISD::ATOMIC_SWAP}, MVT::i128,
+ Custom);
// Now deduce the information based on the above mentioned
// actions
computeRegisterProperties(STI.getRegisterInfo());
// PTX support for 16-bit CAS is emulated. Only use 32+
setMinCmpXchgSizeInBits(STI.getMinCmpXchgSizeInBits());
- setMaxAtomicSizeInBitsSupported(64);
+ setMaxAtomicSizeInBitsSupported(128);
----------------
AlexMaclean wrote:
I've updated this as suggested since it seems like there is consensus amongst the reviewers that we want to make this conditional on the sub-target.
https://github.com/llvm/llvm-project/pull/154852
More information about the llvm-commits
mailing list