[PATCH] x86_64: Optimize ffsll function code size.
Sunil K Pandey
skpgkp2@gmail.com
Wed Jul 26 16:05:24 GMT 2023
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
More information about the Libc-alpha
mailing list