aboutsummaryrefslogtreecommitdiff
path: root/include/longlong.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/longlong.h')
-rw-r--r--include/longlong.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/longlong.h b/include/longlong.h
index 40f9424..5ae250f 100644
--- a/include/longlong.h
+++ b/include/longlong.h
@@ -1065,6 +1065,20 @@ extern UDItype __umulsidi3 (USItype, USItype);
#endif
#if defined(__riscv)
+
+#ifdef __riscv_zbb
+#if W_TYPE_SIZE == 32
+#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clz (X))
+#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctz (X))
+#define COUNT_LEADING_ZEROS_0 32
+#endif /* W_TYPE_SIZE == 32 */
+#if W_TYPE_SIZE == 64
+#define count_leading_zeros(COUNT, X) ((COUNT) = __builtin_clzll (X))
+#define count_trailing_zeros(COUNT, X) ((COUNT) = __builtin_ctzll (X))
+#define COUNT_LEADING_ZEROS_0 64
+#endif /* W_TYPE_SIZE == 64 */
+#endif /* __riscv_zbb */
+
#ifdef __riscv_mul
#define __umulsidi3(u,v) ((UDWtype)(UWtype)(u) * (UWtype)(v))
#define __muluw3(a, b) ((UWtype)(a) * (UWtype)(b))