xref: /openbmc/linux/arch/sparc/lib/NG4fls.S (revision 70cbec0c)
170cbec0cSVijay Kumar/* NG4fls.S: SPARC optimized fls and __fls for T4 and above.
270cbec0cSVijay Kumar *
370cbec0cSVijay Kumar * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
470cbec0cSVijay Kumar */
570cbec0cSVijay Kumar
670cbec0cSVijay Kumar#include <linux/linkage.h>
770cbec0cSVijay Kumar
870cbec0cSVijay Kumar#define LZCNT_O0_G2	\
970cbec0cSVijay Kumar	.word	0x85b002e8
1070cbec0cSVijay Kumar
1170cbec0cSVijay Kumar	.text
1270cbec0cSVijay Kumar	.register	%g2, #scratch
1370cbec0cSVijay Kumar	.register	%g3, #scratch
1470cbec0cSVijay Kumar
1570cbec0cSVijay KumarENTRY(NG4fls)
1670cbec0cSVijay Kumar	LZCNT_O0_G2	!lzcnt	%o0, %g2
1770cbec0cSVijay Kumar	mov	64, %g3
1870cbec0cSVijay Kumar	retl
1970cbec0cSVijay Kumar	 sub	%g3, %g2, %o0
2070cbec0cSVijay KumarENDPROC(NG4fls)
21