public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] x86_64: Optimize ffsll function code size.
@ 2023-07-26 16:05 Sunil K Pandey
  2023-07-26 16:38 ` Richard Henderson
  2023-07-26 17:04 ` Noah Goldstein
  0 siblings, 2 replies; 37+ messages in thread
From: Sunil K Pandey @ 2023-07-26 16:05 UTC (permalink / raw)
  To: libc-alpha; +Cc: hjl.tools

Ffsll function size is 17 byte, this patch optimizes size to 16 byte.
Currently ffsll function randomly regress by ~20%, depending on how
code get aligned.

This patch fixes ffsll function random performance regression.
---
 sysdeps/x86_64/ffsll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sysdeps/x86_64/ffsll.c b/sysdeps/x86_64/ffsll.c
index a1c13d4906..dbded6f0a1 100644
--- a/sysdeps/x86_64/ffsll.c
+++ b/sysdeps/x86_64/ffsll.c
@@ -29,7 +29,7 @@ ffsll (long long int x)
   long long int tmp;
 
   asm ("bsfq %2,%0\n"		/* Count low bits in X and store in %1.  */
-       "cmoveq %1,%0\n"		/* If number was zero, use -1 as result.  */
+       "cmove %k1,%k0\n"	/* If number was zero, use -1 as result.  */
        : "=&r" (cnt), "=r" (tmp) : "rm" (x), "1" (-1));
 
   return cnt + 1;
-- 
2.41.0


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

end of thread, other threads:[~2024-01-25  3:10 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26 16:05 [PATCH] x86_64: Optimize ffsll function code size Sunil K Pandey
2023-07-26 16:38 ` Richard Henderson
2023-07-26 16:50   ` H.J. Lu
2023-07-26 16:51   ` Noah Goldstein
2023-07-26 16:51   ` Sunil Pandey
2023-07-26 16:59     ` Noah Goldstein
2023-07-26 17:11       ` Adhemerval Zanella Netto
2023-07-27  0:31         ` Cristian Rodríguez
2023-07-26 20:43       ` Sunil Pandey
2023-07-26 21:05         ` Noah Goldstein
2023-07-26 22:37           ` Sunil Pandey
2023-07-27  0:00             ` Noah Goldstein
2023-07-27  8:16               ` Florian Weimer
2023-07-27 11:46                 ` Alexander Monakov
2023-07-27 12:10                   ` Florian Weimer
2023-07-27 13:59                     ` Cristian Rodríguez
2023-07-27 14:00                     ` Alexander Monakov
2023-07-27 15:13                       ` Sunil Pandey
2023-07-27 15:50                         ` Alexander Monakov
2023-07-27 16:24                         ` Florian Weimer
2023-07-27 16:35                           ` Adhemerval Zanella Netto
2023-07-27 17:09                             ` Florian Weimer
2023-07-27 17:25                               ` Sunil Pandey
2023-07-31 18:35                                 ` [PATCH v2] " Sunil K Pandey
2023-07-31 20:12                                   ` Adhemerval Zanella Netto
2023-07-31 20:58                                     ` Sunil Pandey
2023-07-31 22:57                                       ` Adhemerval Zanella Netto
2023-07-31 23:44                                         ` Sunil Pandey
2023-07-31 23:54                                           ` Noah Goldstein
2023-08-01  6:47                                             ` Andreas Schwab
2023-08-01 13:46                                           ` Adhemerval Zanella Netto
2023-08-01 18:25                                             ` Cristian Rodríguez
2024-01-10 19:19                                   ` Carlos O'Donell
2024-01-25  3:10                                     ` Sunil Pandey
2023-07-27 16:40                           ` [PATCH] " Sunil Pandey
2023-07-26 17:04 ` Noah Goldstein
2023-07-26 17:25   ` Andrew Pinski

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).