https://chromiumcodereview.appspot.com/9638018/diff/13001/src/utils.h
File src/utils.h (right):

https://chromiumcodereview.appspot.com/9638018/diff/13001/src/utils.h#newcode112
src/utils.h:112: const DivMagicNumbers DivMagicNumberFor625 =
{0x68db8bad, 8};
Fair question! I actually noticed a non-optimal pattern in the patch (1
instruction difference). Details below.
Since there were a couple of other comments I'll fix that and upload a
new patch.

Optimized code for the pattern
  <k  for which we have a magic number> * 2^n
can require a bit more code (1 instr on ARM) than for
  <k for which we have a magic number>

Using magic numbers for 6 spares one instruction compare to using those
for 3 plus the code for the factor 2.
For 10 it does not make a difference here.

And actually, my implementation is non-optimal if divisor == 6...
I first search for the greatest power of 2 dividing the divisor, and
check if we have magic numbers for the odd part.
That means the pattern '3 * 2' is used. One instruction less efficient
:(

On 2012/04/17 18:30:26, alexeif wrote:
On 2012/04/17 17:12:22, Alexandre wrote:
> We can generate optimized code for numbers with an absolute value
equals that
is
> representable by
>  <1, or k for which we have a magic number> * 2^n
> So optimized code can be generated for these:
> 60 = 15 * 2^2
> 100 = 25 * 2^2
> 1000 = 125 * 2^3
>
> This is detailed in the arm files.
>
> On 2012/04/17 16:59:28, alexeif wrote:
> > How about adding 60, 100 and 1000? They seem to have even higher
rate than
> 625.
>
Oh, I see, it has a shift anyway. Btw, why do you need constants for
evens 6 and
10?

https://chromiumcodereview.appspot.com/9638018/

--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to