/* Copyright 2019 Google LLC. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #include "ruy/denormal.h" // NOTE: this is simply a copy of pthreadpool/src/threadpool-utils.h that's not // exposed by the pthreadpool library // (https://github.com/Maratyszcza/pthreadpool), but with an additional C++ // helper class to suppress floating-point denormal values. /* SSE-specific headers */ #if defined(__SSE__) || defined(__x86_64__) || defined(_M_X64) || \ (defined(_M_IX86_FP) && _M_IX86_FP >= 1) #include <xmmintrin.h> #endif /* MSVC-specific headers */ #if defined(_MSC_VER) #include <intrin.h> #endif namespace ruy { namespace { inline struct fpu_state get_fpu_state() { … } inline void set_fpu_state(const struct fpu_state state) { … } inline void disable_fpu_denormals() { … } } // namespace ScopedSuppressDenormals::ScopedSuppressDenormals() { … } ScopedSuppressDenormals::~ScopedSuppressDenormals() { … } } // namespace ruy