Date: Thu, 15 Nov 2012 17:11:05 -0500 From: Patrick Kelsey <kelsey@ieee.org> To: Juli Mallett <jmallett@freebsd.org> Cc: "Jayachandran C." <jchandra@freebsd.org>, "freebsd-mips@FreeBSD.org" <mips@freebsd.org>, Alan Cox <alc@rice.edu> Subject: Re: ZERO_REGION_SIZE Message-ID: <CAD44qMVVq2nassx7fFai9s=zsiZVPBSFdef87UbMZ4j3PNGkMg@mail.gmail.com> In-Reply-To: <CACVs6=9ZiVeWcJUoeNU_Mybn5WgZ2edUkx4ERPEXD%2BPODp8gKw@mail.gmail.com> References: <50A53391.4080909@rice.edu> <CAJ-Vmon-v3K7012ti_L6ao3wQHfQ99Jau1kJ%2BGhumbPjAuSDww@mail.gmail.com> <50A54CCD.8070409@rice.edu> <DF2CB7FC-C1ED-4F4C-A39A-60B5E7FC566D@bsdimp.com> <CACVs6=9ZiVeWcJUoeNU_Mybn5WgZ2edUkx4ERPEXD%2BPODp8gKw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 15, 2012 at 5:02 PM, Juli Mallett <jmallett@freebsd.org> wrote: > On Thu, Nov 15, 2012 at 1:07 PM, Warner Losh <imp@bsdimp.com> wrote: > >> >> On Nov 15, 2012, at 1:13 PM, Alan Cox wrote: >> > P.S. I would encourage someone with hardware to look into implementing a >> > non-iterative ffs*() using (d)clz. The MIPS pmap would benefit from >> > this. Basically, most pmap_enter() calls are doing an ffs*(). >> >> ffs finds the first bit set. clz counts the number of leading zeros and >> thus finds the last bit set. Would a non-iterative fls* be helpful? >> > > Right. And no widespread ctz/ffs MIPS instructions as far as I know. We > could use pop/dpop on processors that support them to do non-iterative > ffs*, with a few additional instructions, though. I was thinking something like this might work: value to ffs is in r1, MSB is the index of the MSB (so, 31 or 63): if (0 == r1) return(your_choice); r2 = r1 - 1; r2 = r1 ^ r2; return (MSB - clz(r2)); -Patrick
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAD44qMVVq2nassx7fFai9s=zsiZVPBSFdef87UbMZ4j3PNGkMg>