[PATCH v1 30/35] Assume __has_builtin(__builtin_ppc_get_timebase)
Alejandro Colomar
alx@kernel.org
Sun Nov 9 21:54:03 GMT 2025
We already assume that GCC is at least GCC 5,
and we also assume that Clang is at least Clang 4.
Clang added support for __builtin_ppc_get_timebase() in Clang 3.8:
llvm.git 65e1e4dbe0f1 (2015-08-31; "[PowerPC] Support __builtin_ppc_get_timebase")
$ git describe --contains 65e1e4dbe0f1
llvmorg-3.8.0-rc1~10647
Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
sysdeps/powerpc/sys/platform/ppc.h | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/sysdeps/powerpc/sys/platform/ppc.h b/sysdeps/powerpc/sys/platform/ppc.h
index b0e7b0abfb..0b9f370db3 100644
--- a/sysdeps/powerpc/sys/platform/ppc.h
+++ b/sysdeps/powerpc/sys/platform/ppc.h
@@ -27,27 +27,7 @@
static __inline__ uint64_t
__ppc_get_timebase (void)
{
-#if __GNUC_PREREQ (4, 8)
return __builtin_ppc_get_timebase ();
-#else
-# ifdef __powerpc64__
- uint64_t __tb;
- /* "volatile" is necessary here, because the user expects this assembly
- isn't moved after an optimization. */
- __asm__ volatile ("mfspr %0, 268" : "=r" (__tb));
- return __tb;
-# else /* not __powerpc64__ */
- uint32_t __tbu, __tbl, __tmp; \
- __asm__ volatile ("0:\n\t"
- "mftbu %0\n\t"
- "mftbl %1\n\t"
- "mftbu %2\n\t"
- "cmpw %0, %2\n\t"
- "bne- 0b"
- : "=r" (__tbu), "=r" (__tbl), "=r" (__tmp));
- return (((uint64_t) __tbu << 32) | __tbl);
-# endif /* not __powerpc64__ */
-#endif
}
/* The following functions provide hints about the usage of shared processor
--
2.51.0
More information about the Libc-alpha
mailing list