This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FP Kernel test added


Jonathan Larmour <jifl@eCosCentric.com> writes:

> Nick Garnett wrote:
> > //==========================================================================
> > // Test calculation.
> > //
> > // Generates an array of random FP values and then repeatedly applies
> > // a calculation to them and checks that the same result is reached
> > // each time. The calculation, in the macro CALC, is intended to make
> > // maximum use of the FPU registers. However, the i386 compiler
> > // doesn't let this expression get very complex before it starts
> > // spilling values out to memory.
> 
> Surely it's only a good test once we're sure we've spilled some
> :-). Perhaps we should have a few more to cover non-x86 FP too (a
> check we haven't screwed up and missed off FP registers for example).

Possibly. For that I suspect we would have to go down to using
assembler to explicitly fill the FPU with known values and test them.
It would be difficult to manufacture expressions that cajoled the
compiler into doing that.

> Hmm... I'm not sure that any calculation on a NaN is necessarily
> deterministic? e.g. the exponent could be set to 2047 in the result
> register and the sign or mantissa left untouched from the previous
> operation in that register, which may make the absolute value not be
> deterministic.
> 
> I seem to recall having problems like this in the libm testing, and
> had to use the isnan() function instead for an explicit test for NaNs.
>

Well hopefully I will not be generating any NaNs. The values are all
<1, so we won't be getting any overflows. The worst that might happen
is that the result gets progressively rounded to zero. 

That was the theory anyway -- it's a long time since I paid any
attention to this sort of stuff.

-- 
Nick Garnett - eCos Kernel Architect
http://www.eCosCentric.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]