public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] mips: Use builtins for ffs and ffsll
@ 2024-02-06  8:34 Junxian Zhu
  2024-02-13  7:45 ` Maxim Kuvyrkov
  0 siblings, 1 reply; 2+ messages in thread
From: Junxian Zhu @ 2024-02-06  8:34 UTC (permalink / raw)
  To: libc-alpha; +Cc: Junxian Zhu

From: Junxian Zhu <zhujunxian@oss.cipunited.com>

__builtin_ffs{,ll} basically on __builtin_ctz{,ll} in MIPS GCC compiler.
The hardware ctz instructions were available after MIPS{32,64} Release1. By using builtin ctz. It can also reduce code size of ffs/ffsll.

Checked on mips o32. mips64.

Signed-off-by: Junxian Zhu <zhujunxian@oss.cipunited.com>
---
 sysdeps/mips/math-use-builtins-ffs.h | 3 +++
 1 file changed, 3 insertions(+)
 create mode 100644 sysdeps/mips/math-use-builtins-ffs.h

diff --git a/sysdeps/mips/math-use-builtins-ffs.h b/sysdeps/mips/math-use-builtins-ffs.h
new file mode 100644
index 0000000000..2ab6a03a16
--- /dev/null
+++ b/sysdeps/mips/math-use-builtins-ffs.h
@@ -0,0 +1,3 @@
+#include <sysdep.h>
+#define USE_FFS_BUILTIN (__mips_isa_rev >= 1)
+#define USE_FFSLL_BUILTIN (__mips_isa_rev >= 1)
-- 
2.43.0.windows.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-13  7:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-06  8:34 [PATCH v2] mips: Use builtins for ffs and ffsll Junxian Zhu
2024-02-13  7:45 ` Maxim Kuvyrkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).