Re: Rounded operations: test
On 2011-07-15 09:45:47 -0500, Nate Hayes wrote:
> Vincent Lefevre wrote:
> >Concerning your nextup() test, there are many branches, and since
> >the code is run on the same data, I suppose that the branches can
> >be predicted correctly (if this is implemented that way on the
> >processor). In real codes, this solution might be slower.
>
> In the test, note that x2 is both an operand and a result, i.e.,
> x2 = nextup( x2 + y2 );
> x2 = nextup( x2 + y2 );
> x2 = nextup( x2 + y2 );
> x2 = nextup( x2 + y2 );
> ...
> etc. So the nextup() function never receives the same operand twice
> for any of the 1 billion operations.
OK, I read too fast. Then you introduce a dependency. But I don't know
whether this matters...
> BTW, nextup() is considerably slower when compiled and run in 32-bit
> mode; on 64-bit machines the 64-bit integers can fit nicely into a
> register and be operated on in a single instruction, but in 32-bit
> mode they must be treated as multi-precision ints operated on in
> multiple instructions and with additional branching inserted by the
> compiler.
There should really be a hardware nextup operation.
> I'd like to see such a comparision, too. We don't have access to such
> hardware platform.
I could try on the GCC compile farm. But I currently have a limited
Internet access.
--
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)