BelaPlatform / supercollider

an environment and programming language for real time audio synthesis and algorithmic composition
GNU General Public License v3.0
14 stars 8 forks source link

Added sc_setDenormalFlags() for systems with vfp #25

Closed giuliomoro closed 7 years ago

giuliomoro commented 7 years ago

... which includes Bela!

When compiling code on Bela, it is up to the compiler whether to generate Neon or VFP code for floating-point operations. On the Cortex A8, the Neon unit is much faster than the VFP and can also do SIMD instruction. As such, it should be preferred in most cases, but compilers seem to be pretty lazy at generating Neon code, possibly because it is not fully IEEE-754 compliant in that it always flushes denormals to zero.

All of this said, in this PR we tell the VFP to flush denormals to zero, making it run a bit faster, so that we reduce the performance penalty in case the compiler decides to generate VFP code.

sensestage commented 7 years ago

Thanks, Giulio!

giuliomoro commented 7 years ago

Incidentally, this is not Bela-specific, it is for all Cortex A CPUs with a VFP unit, so it could perhaps make its way to a "more" upstream branch.