Ethan Fenn wrote:
> 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.

Agreed.

> If you're building a standalone application, these are usually set
> by default.

Not on systems conforming to IEEE 754, such as Linux, BSD, or Windows.

On Linux, one way to choose the non-default, non-IEEE behavior is
to use "gcc -ffast-math".  Programs linked with gcc -ffast-math turn
on FTZ and DAZ at startup, objects compiled with gcc -ffast-math
assume that they have been turned on, and bad things can happen
if -ffast-math is used when compiling but not when linking; see
https://urldefense.proofpoint.com/v2/url?u=https-3A__gcc.gnu.org_bugzilla_show-5Fbug.cgi-3Fid-3D83240&d=DwICAg&c=009klHSCxuh5AI1vNQzSO0KGjl4nbi2Q0M1QLJX9BeE&r=TRvFbpof3kTa2q5hdjI2hccynPix7hNL2n0I6DmlDy0&m=2SzKbwELn8JEfQ9-Ljp0vUdDPY1CvKSEmp-tNCOgU4b9FteXxS28XwTL_3cFvi7R&s=s_LfcWjVtw3FXhv8AMqc_6_FBuR8rey_2za_vIDzGZM&e=
  for a case I
ran into.

> 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.

Agreed.
-- 
Andreas Gustafsson, [email protected]

Reply via email to