Re: [patch V3] lib: GCD: add binary GCD algorithm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "George Spelvin" <linux@xxxxxxxxxxx>
Date: 28 Apr 2016 17:21:26 -0400

> arch/sparc/lib/ffs.S is a custom implementation of __ffs, but it's a
> function call and 33 instructions/18 cycles long.  There are several
> similar custom implementations that I also considered "NO".

Read it again, it is patched if the cpu supports the necessary instructions
in which case it's a very short sequence.

The actual code used when the cpu support said instruction is simply:

	.section	.popc_6insn_patch, "ax"
	.word		ffs
	brz,pn	%o0, 98f
	 neg	%o0, %g1
	xnor	%o0, %g1, %o1
	popc	%o1, %o0
98:	retl
	 nop
	.word		__ffs
	neg	%o0, %g1
	xnor	%o0, %g1, %o1
	popc	%o1, %o0
	retl
	 sub	%o0, 1, %o0
	nop
	.previous
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Development]     [DCCP]     [Linux ARM Development]     [Linux]     [Photo]     [Yosemite Help]     [Linux ARM Kernel]     [Linux SCSI]     [Linux x86_64]     [Linux Hams]

  Powered by Linux