glibc/0001-LoongArch-Use-builtins-for-ffs-and-ffsll.patch
Xing Li 501a0422cf LoongArch: Add tlsdesc and tunable support
(cherry picked from commit 09da963a2510672ba92a60667ac840badffceaf2)
2024-11-06 14:32:51 +08:00

31 lines
998 B
Diff

From 288d144301d20104e1b79fe5695f09af336574eb Mon Sep 17 00:00:00 2001
From: Xi Ruoyao <xry111@xry111.site>
Date: Sun, 4 Feb 2024 08:27:50 +0800
Subject: [PATCH 01/15] LoongArch: Use builtins for ffs and ffsll
On LoongArch GCC compiles __builtin_ffs{,ll} to basically
`(x ? __builtin_ctz (x) : -1) + 1`. Since a hardware ctz instruction is
available, this is much better than the table-driven generic
implementation.
Tested on loongarch64.
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
---
sysdeps/loongarch/math-use-builtins-ffs.h | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 sysdeps/loongarch/math-use-builtins-ffs.h
diff --git a/sysdeps/loongarch/math-use-builtins-ffs.h b/sysdeps/loongarch/math-use-builtins-ffs.h
new file mode 100644
index 00000000..a83bb154
--- /dev/null
+++ b/sysdeps/loongarch/math-use-builtins-ffs.h
@@ -0,0 +1,2 @@
+#define USE_FFS_BUILTIN 1
+#define USE_FFSLL_BUILTIN 1
--
2.43.0