xref: /aosp_15_r20/external/llvm-libc/src/__support/macros/properties/types.h (revision 71db0c75aadcf003ffe3238005f61d7618a3fead)
1 //===-- Types support -------------------------------------------*- 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 // Types detection and support.
9 
10 #ifndef LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_TYPES_H
11 #define LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_TYPES_H
12 
13 #include "hdr/float_macros.h"                      // LDBL_MANT_DIG
14 #include "include/llvm-libc-macros/float16-macros.h" // LIBC_TYPES_HAS_FLOAT16
15 #include "include/llvm-libc-types/float128.h"        // float128
16 #include "src/__support/macros/properties/architectures.h"
17 #include "src/__support/macros/properties/compiler.h"
18 #include "src/__support/macros/properties/cpu_features.h"
19 #include "src/__support/macros/properties/os.h"
20 
21 #include <stdint.h> // UINT64_MAX, __SIZEOF_INT128__
22 
23 // 'long double' properties.
24 #if (LDBL_MANT_DIG == 53)
25 #define LIBC_TYPES_LONG_DOUBLE_IS_FLOAT64
26 #elif (LDBL_MANT_DIG == 64)
27 #define LIBC_TYPES_LONG_DOUBLE_IS_X86_FLOAT80
28 #elif (LDBL_MANT_DIG == 113)
29 #define LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128
30 #elif (LDBL_MANT_DIG == 106)
31 #define LIBC_TYPES_LONG_DOUBLE_IS_DOUBLE_DOUBLE
32 #endif
33 
34 // int64 / uint64 support
35 #if defined(UINT64_MAX)
36 #define LIBC_TYPES_HAS_INT64
37 #endif // UINT64_MAX
38 
39 // int128 / uint128 support
40 #if defined(__SIZEOF_INT128__) && !defined(LIBC_TARGET_OS_IS_WINDOWS)
41 #define LIBC_TYPES_HAS_INT128
42 #endif // defined(__SIZEOF_INT128__)
43 
44 // -- float16 support ---------------------------------------------------------
45 // LIBC_TYPES_HAS_FLOAT16 is provided by
46 // "include/llvm-libc-macros/float16-macros.h"
47 #ifdef LIBC_TYPES_HAS_FLOAT16
48 // Type alias for internal use.
49 using float16 = _Float16;
50 #endif // LIBC_TYPES_HAS_FLOAT16
51 
52 // -- float128 support --------------------------------------------------------
53 // LIBC_TYPES_HAS_FLOAT128 and 'float128' type are provided by
54 // "include/llvm-libc-types/float128.h"
55 
56 #endif // LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_TYPES_H
57