[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [f-cpu] IEEE FP exceptions



> > every instruction, the result is rounded to either float or double,
> > any additional bits will be lost.  Exceptional conditions can only be
> > marked in a central status register.  The only thing we could do is
> > mark the result register in the scoreboard and raise an exception when
> > it is used -- but that may be too late.
>
> But you can recompute the result by an other instruction block that is
> more precise but slower.

Exactly :) It is point of non-terminanting FP exceptions IMHO.
With one flag per register you could do:

divide(double x) attribute("force_all_floats_into_regs")
{
 clear_fpex(x); // remove exception flag from "x" register if any
 y = seed(x);
 for (i=0;i<6;i++)
  y *= 2.0 - y*x;
 if (is_bad_fp(y)) return divide_precise(x)
 return y;
}

all FP would set hidden flag of result register on computation
error and then you could check it. You could not need to serialize
FP at all.
Alternate way is to have clear_fpex & is_bad_fp as global (aby
FP would write to single status register) and then both of
these would need to be FP barrier.
Idea would be to use them after big block of code, not after
a few insns (and it is how programmers use them according to
the paper). Thus this seem to be safe way for us - no exceptions
(thus no problems with fcpu pipeline) only one small stat register.

devik

*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/