[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKv63usmDy7LdF6Lbc_CnuSCzYWtrhtBHgasvTYbT8wL2uuC8A@mail.gmail.com>
Date: Tue, 9 Jan 2018 16:18:01 +0100
From: Crt Mori <cmo@...exis.com>
To: David Laight <David.Laight@...lab.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Jonathan Cameron <jic23@...nel.org>,
Ingo Molnar <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Kees Cook <keescook@...omium.org>,
Rusty Russell <rusty@...tcorp.com.au>,
Ian Abbott <abbotti@....co.uk>,
Larry Finger <Larry.Finger@...inger.net>,
Niklas Soderlund <niklas.soderlund+renesas@...natech.se>,
Thomas Gleixner <tglx@...utronix.de>,
Krzysztof Kozlowski <krzk@...nel.org>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
Joe Perches <joe@...ches.com>
Subject: Re: [PATCH v10 1/3] lib: Add strongly typed 64bit int_sqrt
It has been some time now since this moved. I have decided not to use
David's implementation because I want to maintain also range above
2^62
Are there any additional objections for this not to go in as it is?
On 22 December 2017 at 14:44, Crt Mori <cmo@...exis.com> wrote:
>
> From simple strong typing of existing int_sqrt we came to something a
> bit more complex or better. Can we decide now which we want in, or I
> submit v12 and we decide then (although it is not a v12, but whole new
> thing)?
>
> On 21 December 2017 at 15:48, David Laight <David.Laight@...lab.com> wrote:
> > From: Peter Zijlstra
> >> Sent: 21 December 2017 14:12
> > ...
> >> > > This part above looks like FLS
> >> > It also does the rest of the required shifts.
> >>
> >> Still, fls() + shift is way faster on hardware that has an fls
> >> instruction.
> >>
> >> Writing out that binary search doesn't make sense.
> >
> > If the hardware doesn't have an appropriate fls instruction
> > the soft fls()will be worse.
> >
> > If you used fls() you'd still need quite a bit of code
> > to generate the correct shift and loop count adjustment.
> > Given the cost of the loop iterations the 3 tests are noise.
> > The open coded version is obviously correct...
> >
> > I didn't add the 4th one because the code always does 2 iterations.
> >
> > If you were really worried about performance there are faster
> > algorithms (even doing 2 or 4 bits a time is faster).
> >
> > David
> >
Powered by blists - more mailing lists