On Friday 07 February 2003 21.02, Steve Harris wrote:
[...]
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.
Yeah - but not as cheap as generating occasional spikes, a tone or
maybe even white noise, to prevent the generation of denormals in the
first place.
Besides, if you *get* a denormal to kill, it has to come from
somewhere. Catching them this late may not avoid all denormal
processing, unless you do this check after every single FP operation.
You might get away with doing double processing and checking for
float denormals, but I don't think that would be totally safe.
//David Olofson - Programmer, Composer, Open Source Advocate
.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`--------------------------->
http://olofson.net/audiality -'
---
http://olofson.net ---
http://www.reologica.se ---