FLANG
fp-testing.h
1//===-- include/flang/Testing/fp-testing.h ----------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef FORTRAN_TESTING_FP_TESTING_H_
10#define FORTRAN_TESTING_FP_TESTING_H_
11
12#include "flang/Common/target-rounding.h"
13#include <fenv.h>
14
15using Fortran::common::RealFlags;
17using Fortran::common::RoundingMode;
18
20public:
21 ScopedHostFloatingPointEnvironment(bool treatSubnormalOperandsAsZero = false,
22 bool flushSubnormalResultsToZero = false);
24 void ClearFlags() const;
25 static RealFlags CurrentFlags();
26 static void SetRounding(Rounding rounding);
27
28private:
29 fenv_t originalFenv_;
30#if __x86_64__ || _M_X64
31 unsigned int originalMxcsr;
32#endif
33};
34
35#endif // FORTRAN_TESTING_FP_TESTING_H_
Definition: fp-testing.h:19
Definition: target-rounding.h:18