| 43 | namespace port { |
| 44 | |
| 45 | static void SetDenormalState(bool flush_zero_mode, bool denormals_zero_mode) { |
| 46 | // For now, we flush denormals only on SSE 3. Other architectures such as ARM |
| 47 | // can be added as needed. |
| 48 | |
| 49 | #ifdef DENORM_USE_INTRINSICS |
| 50 | if (TestCPUFeature(SSE3)) { |
| 51 | // Restore flags |
| 52 | _MM_SET_FLUSH_ZERO_MODE(flush_zero_mode ? _MM_FLUSH_ZERO_ON |
| 53 | : _MM_FLUSH_ZERO_OFF); |
| 54 | _MM_SET_DENORMALS_ZERO_MODE(denormals_zero_mode ? _MM_DENORMALS_ZERO_ON |
| 55 | : _MM_DENORMALS_ZERO_OFF); |
| 56 | } |
| 57 | #endif |
| 58 | } |
| 59 | |
| 60 | static std::pair<bool, bool> GetDernormalState() { |
| 61 | // For now, we flush denormals only on SSE 3. Other architectures such as ARM |
no test coverage detected