[libc-commits] [libc] c6a93fe - [libc] Use __builtin_ffsll for RPC lane mask (#85000)
via libc-commits
libc-commits at lists.llvm.org
Tue Mar 12 18:25:39 PDT 2024
Author: Petr Hosek
Date: 2024-03-12T18:25:36-07:00
New Revision: c6a93fe80b3cf30ff82d06e959c1177798c858ae
URL: https://github.com/llvm/llvm-project/commit/c6a93fe80b3cf30ff82d06e959c1177798c858ae
DIFF: https://github.com/llvm/llvm-project/commit/c6a93fe80b3cf30ff82d06e959c1177798c858ae.diff
LOG: [libc] Use __builtin_ffsll for RPC lane mask (#85000)
src/__support/GPU/utils.h doesn't compile on a 32-bit platforms because
__builtin_ffsl uses long which is a 32-bit number. Use __builtin_ffsll
which uses long long which is guaranteed to be at least 64-bits.
Added:
Modified:
libc/src/__support/GPU/utils.h
Removed:
################################################################################
diff --git a/libc/src/__support/GPU/utils.h b/libc/src/__support/GPU/utils.h
index 93022e8de811f7..cb04a3562eb1c4 100644
--- a/libc/src/__support/GPU/utils.h
+++ b/libc/src/__support/GPU/utils.h
@@ -23,7 +23,7 @@ namespace LIBC_NAMESPACE {
namespace gpu {
/// Get the first active thread inside the lane.
LIBC_INLINE uint64_t get_first_lane_id(uint64_t lane_mask) {
- return __builtin_ffsl(lane_mask) - 1;
+ return __builtin_ffsll(lane_mask) - 1;
}
/// Conditional that is only true for a single thread in a lane.
More information about the libc-commits
mailing list