Refactor NVPTX builtins: Move cluster-related intrinsics into static constexpr BuiltinEntry nvvmNames[]
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
## Description
Currently, the following NVPTX builtins are handled via explicit case statements in the code:
```cpp
case NVPTX::BI__nvvm_read_ptx_sreg_clusterid_x:
return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::nvvm_read_ptx_sreg_clusterid_x));
// ... (other cluster-related cases)
```
However, similar builtins such as `__nvvm_read_ptx_sreg_tid_x` are already managed through the `static constexpr BuiltinEntry nvvmNames[]` table, and there is no special handling required for the cluster-related intrinsics.
## Proposal
Move all cluster-related builtins (e.g., __nvvm_read_ptx_sreg_clusterid_x, __nvvm_read_ptx_sreg_clusterid_y, etc.) into the nvvmNames[] table for consistency and maintainability. This will simplify the code, reduce duplication, and make it easier to add or modify builtins in the future.
Contributor guide
Assessment
This issue has not been assessed yet.