FLANG
float80.h
1/*===-- flang/Common/float80.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/* This header is usable in both C and C++ code.
10 * Isolates build compiler checks to determine if the 80-bit
11 * floating point format is supported via a particular C type.
12 * It defines CFloat80Type and CppFloat80Type aliases for this
13 * C type.
14 */
15
16#ifndef FORTRAN_COMMON_FLOAT80_H_
17#define FORTRAN_COMMON_FLOAT80_H_
18
19#include "api-attrs.h"
20#include <float.h>
21
22#if LDBL_MANT_DIG == 64
23#undef HAS_FLOAT80
24#define HAS_FLOAT80 1
25#endif
26
27#if defined(RT_DEVICE_COMPILATION) && defined(__CUDACC__)
28/*
29 * 'long double' is treated as 'double' in the CUDA device code,
30 * and there is no support for 80-bit floating point format.
31 * This is probably true for most offload devices, so RT_DEVICE_COMPILATION
32 * check should be enough. For the time being, guard it with __CUDACC__
33 * as well.
34 */
35#undef HAS_FLOAT80
36#endif
37
38#if HAS_FLOAT80
39typedef long double CFloat80Type;
40typedef long double CppFloat80Type;
41#endif
42
43#endif /* FORTRAN_COMMON_FLOAT80_H_ */