[libc-commits] [libc] [libc] Use __builtin_ffsll for RPC lane mask (PR #85000)

via libc-commits libc-commits at lists.llvm.org
Tue Mar 12 17:16:32 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Petr Hosek (petrhosek)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/85000.diff


1 Files Affected:

- (modified) libc/src/__support/GPU/utils.h (+1-1) 


``````````diff
diff --git a/libc/src/__support/GPU/utils.h b/libc/src/__support/GPU/utils.h
index 0f9167cdee0663..45523f88f917f7 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.

``````````

</details>


https://github.com/llvm/llvm-project/pull/85000


More information about the libc-commits mailing list