ttg
July 8, 2017, 5:26pm
2
Checkout this:
Something like this should be part of the JUCE Library, it makes all other denormal workarounds needless.
It activates the Flush To Zero(FTZ) and Denormals Are Zero (DAZ) mode for x86 & x64
At least the code should generated with SSE2 instructions for floating point operations (which is standard in VS2012 & XCODE)
Not sure if there is something similar for ARM.
I did performance-tests with 32/64 bit Xcode & VS2012 and it works! (at least on my intel-processors)
Just add "ScopedNoDenormals…
this is what we’ve used lately and looks good on our test with Intel based machine (I admit I didn’t test AMDs).
Keep in mind some formats (AU and AAX) should turn the flags already in their code. but from my tests. that didn’t hurt anything.
TL;DR
Does anybody has reliable information how de-normals and these flags affecting AMD processors? I couldn't find any information...
Here is some testcode, if somebody has an AMD processor, would be great to check this out
#ifndef MAINCOMPONENT_H_INCLUDED
#define MAINCOMPONENT_H_INCLUDED
#include "../JuceLibraryCode/JuceHeader.h"
#include "xmmintrin.h"
class ScopedNoDenormals
{
public:
ScopedNoDenormals()
{
oldMXCSR = _mm_getcsr();
int newMXCSR = oldMXCSR | 0x8040;
…