[libc-commits] [libc] f855cee - [libc][NFC] use `__has_builtin` instead of checking macros.
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Sat Jan 4 13:36:15 PST 2025
Author: Joseph Huber
Date: 2025-01-04T15:36:08-06:00
New Revision: f855ceeefc97220a052cc76a52a45c6907eac1f8
URL: https://github.com/llvm/llvm-project/commit/f855ceeefc97220a052cc76a52a45c6907eac1f8
DIFF: https://github.com/llvm/llvm-project/commit/f855ceeefc97220a052cc76a52a45c6907eac1f8.diff
LOG: [libc][NFC] use `__has_builtin` instead of checking macros.
Added:
Modified:
libc/shared/rpc_util.h
Removed:
################################################################################
diff --git a/libc/shared/rpc_util.h b/libc/shared/rpc_util.h
index 9406de59f63b71..687814b7ff2ae5 100644
--- a/libc/shared/rpc_util.h
+++ b/libc/shared/rpc_util.h
@@ -152,10 +152,10 @@ template <typename T> class optional {
/// Suspend the thread briefly to assist the thread scheduler during busy loops.
RPC_ATTRS void sleep_briefly() {
-#if defined(__NVPTX__) && defined(RPC_TARGET_IS_GPU)
+#if __has_builtin(__nvvm_reflect)
if (__nvvm_reflect("__CUDA_ARCH") >= 700)
asm("nanosleep.u32 64;" ::: "memory");
-#elif defined(__AMDGPU__) && defined(RPC_TARGET_IS_GPU)
+#elif __has_builtin(__builtin_amdgcn_s_sleep)
__builtin_amdgcn_s_sleep(2);
#elif __has_builtin(__builtin_ia32_pause)
__builtin_ia32_pause();
More information about the libc-commits
mailing list