FLANG
include
flang
Common
target-rounding.h
1
//===-- include/flang/Common/target-rounding.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_COMMON_TARGET_ROUNDING_H_
10
#define FORTRAN_COMMON_TARGET_ROUNDING_H_
11
12
#include "flang/Common/Fortran-consts.h"
13
#include "flang/Common/enum-set.h"
14
15
namespace
Fortran::common
{
16
17
// Floating-point rounding control
18
struct
Rounding
{
19
common::RoundingMode mode{common::RoundingMode::TiesToEven};
20
// When set, emulate status flag behavior peculiar to x86
21
// (viz., fail to set the Underflow flag when an inexact product of a
22
// multiplication is rounded up to a normal number from a subnormal
23
// in some rounding modes)
24
#if __x86_64__ || __riscv || __loongarch__
25
bool
x86CompatibleBehavior{
true
};
26
#else
27
bool
x86CompatibleBehavior{
false
};
28
#endif
29
};
30
31
// These are ordered like the bits in a common fenv.h header file.
32
ENUM_CLASS(RealFlag, InvalidArgument, Denorm, DivideByZero, Overflow, Underflow,
33
Inexact)
34
using
RealFlags =
common::EnumSet<RealFlag, RealFlag_enumSize>
;
35
36
}
// namespace Fortran::common
37
#endif
/* FORTRAN_COMMON_TARGET_ROUNDING_H_ */
Fortran::common::EnumSet
Definition:
enum-set.h:28
Fortran::common
Definition:
bit-population-count.h:20
Fortran::common::Rounding
Definition:
target-rounding.h:18
Generated on Thu Apr 24 2025 21:44:25 for FLANG by
1.9.6