| 954 | } |
| 955 | |
| 956 | void resetFpuFlags() { |
| 957 | uint32_t flags = getFpuFlags(); |
| 958 | |
| 959 | #if defined ARCH_X64 |
| 960 | // Set CPU to flush-to-zero (FTZ) and denormals-are-zero (DAZ) mode |
| 961 | // https://software.intel.com/en-us/node/682949 |
| 962 | // _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); |
| 963 | flags |= 0x8000; |
| 964 | // _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); |
| 965 | flags |= 0x0040; |
| 966 | // Round-to-nearest is default |
| 967 | flags &= ~0x6000; |
| 968 | #elif defined ARCH_ARM64 |
| 969 | // Set Flush-to-Zero |
| 970 | flags |= 1 << 24; |
| 971 | // ARM64 always uses DAZ |
| 972 | // Round-to-nearest is default |
| 973 | flags &= ~((1 << 22) | (1 << 23)); |
| 974 | #endif |
| 975 | |
| 976 | setFpuFlags(flags); |
| 977 | } |
| 978 | |
| 979 | |
| 980 | void init() { |
no test coverage detected