diff mbox series

[v4,4/5] sparc64: SPARC optimized __fls function

Message ID 1507747806-10251-5-git-send-email-vijay.ac.kumar@oracle.com
State Accepted
Delegated to: David Miller
Headers show
Series sparc64: Optimize fls and __fls | expand

Commit Message

Vijay Kumar Oct. 11, 2017, 6:50 p.m. UTC
Defined SPARC optimized __fls using lzcnt opcode.

Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
---
 arch/sparc/lib/NG4fls.S |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
diff mbox series

Patch

diff --git a/arch/sparc/lib/NG4fls.S b/arch/sparc/lib/NG4fls.S
index bc17b65..2d0991e 100644
--- a/arch/sparc/lib/NG4fls.S
+++ b/arch/sparc/lib/NG4fls.S
@@ -18,3 +18,13 @@  ENTRY(NG4fls)
 	retl
 	 sub	%g3, %g2, %o0
 ENDPROC(NG4fls)
+
+ENTRY(__NG4fls)
+	brz,pn	%o0, 1f
+	LZCNT_O0_G2	!lzcnt	%o0, %g2
+	mov	63, %g3
+	sub	%g3, %g2, %o0
+1:
+	retl
+	 nop
+ENDPROC(__NG4fls)