[clang] [Clang] Simplify target specific implementations in gpuintrin.h (PR #194669)
Shilei Tian via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 09:31:33 PDT 2026
================
@@ -329,24 +309,32 @@ __gpu_match_any_u64_impl(uint64_t __lane_mask, uint64_t __x) {
}
return __match_mask;
}
+#endif
+#undef __gpu_match_any_u64_impl
// Returns the current lane mask if every lane contains __x.
+#ifndef __gpu_match_all_u32_impl
_DEFAULT_FN_ATTRS static __inline__ uint64_t
-__gpu_match_all_u32_impl(uint64_t __lane_mask, uint32_t __x) {
+__gpu_match_all_u32(uint64_t __lane_mask, uint32_t __x) {
uint32_t __first = __gpu_shuffle_idx_u32(
__lane_mask, __builtin_ctzg(__lane_mask), __x, __gpu_num_lanes());
uint64_t __ballot = __gpu_ballot(__lane_mask, __x == __first);
return __ballot == __lane_mask ? __lane_mask : UINT64_C(0);
}
+#endif
+#undef __gpu_match_all_u32_impl
// Returns the current lane mask if every lane contains __x.
+#ifndef __gpu_match_all_u64_impl
----------------
shiltian wrote:
Effectively we are back to the macro based approach, which we were trying avoid a couple of years ago.
https://github.com/llvm/llvm-project/pull/194669
More information about the cfe-commits
mailing list