Re: On writing JITs

2002-08-03 Thread Uri Guttman
> "KF" == Ken Fox <[EMAIL PROTECTED]> writes: > Jason Gloudon wrote: >> http://www.ddj.com/ftp/2001/2001_07/aa0701.txt >> I believe the LOOKUP method was the fastest for me on SPARC, if I >> recall >> correctly. > Did they really spend 64K to create a lookup table just to find

Re: On writing JITs

2002-08-03 Thread Ken Fox
Jason Gloudon wrote: > http://www.ddj.com/ftp/2001/2001_07/aa0701.txt > > I believe the LOOKUP method was the fastest for me on SPARC, if I recall > correctly. Did they really spend 64K to create a lookup table just to find the most significant bit? Calculating log2 for a power of two is simpler

Re: On writing JITs

2002-08-03 Thread Jason Gloudon
On Sat, Aug 03, 2002 at 12:07:30PM -0400, Ken Fox wrote: > Nicholas Clark wrote: > >It seems that foo & (foo - 1) is zero only for a power of 2 (or foo == 0) > >but is there a fast way once you know that foo is a power of 2, to find out > >log2 foo? The ARM doesn't have a find first set bit inst

Re: On writing JITs

2002-08-03 Thread Jason Gloudon
On Sat, Aug 03, 2002 at 11:35:08AM +0100, Nicholas Clark wrote: > I presume in the general case I'd have to know whether to call > Parrot_jit_normal_op() or Parrot_jit_cpcf_op(), so could there be a subroutine > in jit.c that I could call to make the correct decision for me? Here is a patch for

Re: On writing JITs

2002-08-03 Thread Ken Fox
Nicholas Clark wrote: > It seems that foo & (foo - 1) is zero only for a power of 2 (or foo == 0) > but is there a fast way once you know that foo is a power of 2, to find out > log2 foo? You're right about (foo & (foo -1)). gcc uses a repeated test and shift. That's works very nicely if foo is

Re: On writing JITs

2002-08-03 Thread Nicholas Clark
On Fri, Aug 02, 2002 at 03:59:28PM -0400, Richard Prescott wrote: > IMHO, C version shall exist anyway, for speed comparaison first (it is > always surprising how good compilers can be in some situations), then you > could find tricks that are faster on some processors (let's say AMD) and > not on

Re: On writing JITs

2002-08-02 Thread Richard Prescott
On Thu, 1 Aug 2002, Dan Sugalski wrote: > At 9:42 PM +0100 8/1/02, Nicholas Clark wrote: > >Am I allowed to write ancillary functions I want the JIT to call in > >assembler? I presume that the JIT needs to go fast, and I suspect that there > >are some bits that are easier to write in assembler (e

Re: On writing JITs

2002-08-01 Thread Dan Sugalski
At 9:42 PM +0100 8/1/02, Nicholas Clark wrote: >Am I allowed to write ancillary functions I want the JIT to call in >assembler? I presume that the JIT needs to go fast, and I suspect that there >are some bits that are easier to write in assembler (eg rotates for figuring >out constants) than in C,

On writing JITs

2002-08-01 Thread Nicholas Clark
Am I allowed to write ancillary functions I want the JIT to call in assembler? I presume that the JIT needs to go fast, and I suspect that there are some bits that are easier to write in assembler (eg rotates for figuring out constants) than in C, for the same amount of eventual speed. I guess it