On Fri, Feb 07, 2003 at 02:16:08 +0100, David Olofson wrote:
> On Friday 07 February 2003 10.55, Steve Harris wrote:
> > On Thu, Feb 06, 2003 at 11:13:45 +0100, David Olofson wrote:
> > > On Thursday 06 February 2003 16.28, Steve Harris wrote:
> > > [...]
> > >
> > > > #define FLUSH_TO_ZERO(fv) (((*(unsigned
> > > > int*)&(fv))&0x7f800000)==0)?0.0f:(fv) I think it came from the
> > > > music-dsp list.
> > >
> > > There's a conditional in there, though.
> >
> > Yes, but its not in a float context so it wont get
> > denormallised(?).
> 
> Well, casting to int avoids getting the denormal into the FPU. This is 
> probably the only safe way to deal with a denormal without forcing 
> the FPU to burn cycles evaluating it. I don't see how this has 
> anything to do with the conditional, though. It's a potential 
> misprediction + pipeline flush regardless of whether the controlling 
> input comes from the FPU or the ALU.

Its not a true cast, and the branch is cheaper than the denormal. Much
cheaper.

- Steve 

Reply via email to