Skip to content
Permalink
Browse files

Implement denormal protection for ARM

  • Loading branch information...
x42 committed Sep 9, 2019
1 parent 4abb907 commit 68c13940e3b24e89bed39efc4e741298cc6d2637
Showing with 26 additions and 0 deletions.
  1. +26 −0 libs/ardour/globals.cc
@@ -672,6 +672,7 @@ ARDOUR::setup_fpu ()
}

#if defined(ARCH_X86) && defined(USE_XMMINTRIN)
/* see also https://carlh.net/plugins/denormals.php */

int MXCSR;

@@ -717,6 +718,31 @@ ARDOUR::setup_fpu ()

_mm_setcsr (MXCSR);

#elif defined(__aarch64__)
/* http://infocenter.arm.com/help/topic/com.arm.doc.ddi0488d/CIHCACFF.html
* bit 24: flush-to-zero */
if (Config->get_denormal_model() != DenormalNone) {
uint64_t cw;
__asm__ __volatile__ (
"mrs %0, fpcr \n"
"orr %0, %0, #0x1000000 \n"
"msr fpcr, %0 \n"
"isb \n"
: "=r"(cw) :: "memory");
}

#elif defined(__arm__)
/* http://infocenter.arm.com/help/topic/com.arm.doc.dui0068b/BCFHFBGA.html
* bit 24: flush-to-zero */
if (Config->get_denormal_model() != DenormalNone) {
uint32_t cw;
__asm__ __volatile__ (
"vmrs %0, fpscr \n"
"orr %0, %0, #0x1000000 \n"
"vmsr fpscr, %0 \n"
: "=r"(cw) :: "memory")
}

#endif
}

0 comments on commit 68c1394

Please sign in to comment.
You can’t perform that action at this time.