3 ms·
It's just incredible that there's still no way to force denormals to be rounded silently to zero on x86. You have to go out of your way to check for them, or f
by CamperBob2 8y ago
It's just incredible that there's still no way to force denormals to be rounded silently to zero on x86. You have to go out of your way to check for them, or face horrific performance penalties for a feature you didn't even want or need.
- imurray 8y agoThis code: #define CSR_FLUSH_TO_ZERO (1 << 15) unsigned csr = __builtin_ia32_stmxcsr(); csr |= CSR_FLUSH_TO_ZERO; __builtin_ia32_ldmxcsr(csr); from https://stackoverflow.com/a/8217313/ https://stackoverflow.com/a/8217313/ seems to work for me with gcc. I don't know how widely supported it would be.
- stephencanon 8y agoHuh? Set bits 6 (DAZ) and 15 (FZ) in MXCSR. Done. The only instructions you can’t set to flush are the legacy x87 opcodes, which you shouldn’t be using in a performance-sensitive context anyway.
- CamperBob2 8y agoSadly, some of us are stuck maintaining code that still needs to run on pre-SSE2 hardware.