| 58 | } |
| 59 | |
| 60 | static std::pair<bool, bool> GetDernormalState() { |
| 61 | // For now, we flush denormals only on SSE 3. Other architectures such as ARM |
| 62 | // can be added as needed. |
| 63 | |
| 64 | #ifdef DENORM_USE_INTRINSICS |
| 65 | if (TestCPUFeature(SSE3)) { |
| 66 | // Save existing flags |
| 67 | bool flush_zero_mode = _MM_GET_FLUSH_ZERO_MODE() == _MM_FLUSH_ZERO_ON; |
| 68 | bool denormals_zero_mode = |
| 69 | _MM_GET_DENORMALS_ZERO_MODE() == _MM_DENORMALS_ZERO_ON; |
| 70 | return {flush_zero_mode, denormals_zero_mode}; |
| 71 | } |
| 72 | #endif |
| 73 | return {false, false}; |
| 74 | } |
| 75 | |
| 76 | ScopedRestoreFlushDenormalState::ScopedRestoreFlushDenormalState() { |
| 77 | std::tie(flush_zero_mode_, denormals_zero_mode_) = GetDernormalState(); |
no test coverage detected