My understanding is that on any reasonably modern Intel/AMD machines, you
just have to make sure that the Flush To Zero (FTZ) and Denormals Are Zero
(DAZ) hardware flags are set when your DSP code runs and there will be no
penalty. If you're building a standalone application, these are usually set
by default. If you're building some kind of plugin or library, I think it's
good practice to put in a couple lines of code at your entry point to make
sure they're set before doing any DSP.

-Ethan



On Mon, Mar 27, 2023 at 7:41 AM Andreas Gustafsson <g...@waxingwave.com>
wrote:

> robert bristow-johnson asked:
> > If there are processors with FPUs that don't deal with denorms and
> > cause an exception, I would be interested in knowing who the black
> > sheep and the white sheep are.
>
> Is your concern that the exception or interrupt will cause the program
> to abort, or just that it will be slow?  Denormals can have a performance
> penalty even if no interrupt or exception is involved, for example
> when they are handled in microcode.
>
> On x86_64, denormals typically do not cause floating point exceptions
> (unless you specifically ask for it by clearing the DM bit in MXCSR),
> but they can nonetheless have a significant performance penalty.
>
> OTOH, the Apple M1 ARM processor appears to deal with denormals
> without a performance penalty.
>
> > I know that 25 years ago, exceptions caused by denorms (and maybe
> > NaNs) were a headache for some audio DSP coders.  Are denorms still
> > a problem where you have to force them to flush-to-zero so to not
> > trip an exception?
>
> At least on x86_64, they are still a performance problem if you have
> any exponential decays that can reach the denormal range.
> --
> Andreas Gustafsson, g...@waxingwave.com
>

Reply via email to