[clang] [llvm] [NVPTX] Support __usAtomicCAS builtin (PR #99646)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 19 09:07:07 PDT 2024
================
@@ -871,7 +871,8 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
// actions
computeRegisterProperties(STI.getRegisterInfo());
- setMinCmpXchgSizeInBits(32);
+ bool Allow16BitCAS = STI.getSmVersion() >= 70 && STI.getPTXVersion() >= 63;
+ setMinCmpXchgSizeInBits(Allow16BitCAS ? 16 : 32);
----------------
gonzalobg wrote:
Can we add a:
```
bool hasAtomCas16() const { return SmVersion >= 70 && PTXVersion >= 63; }
```
to NVPTXSubtarget instead, and call it here:
```suggestion
setMinCmpXchgSizeInBits(STI.hasAtomCas16() ? 16 : 32);
```
https://github.com/llvm/llvm-project/pull/99646
More information about the cfe-commits
mailing list