[libc-commits] [libc] [libc] Coalesce bitfield access in GPU malloc (PR #142692)
Shilei Tian via libc-commits
libc-commits at lists.llvm.org
Tue Jun 3 17:14:11 PDT 2025
================
@@ -129,6 +129,11 @@ static inline constexpr T round_up(const T x) {
return (x + N) & ~(N - 1);
}
+// Branch free minimum of two integers.
+static inline constexpr uint32_t min(const uint32_t &x, const uint32_t &y) {
+ return y ^ ((x ^ y) & -(x < y));
+}
----------------
shiltian wrote:
folks working on low level stuff love to squeeze more performance by using bit manipulation :-D
Yeah, a reference might even be more expensive here
https://github.com/llvm/llvm-project/pull/142692
More information about the libc-commits
mailing list