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 #endif 31 32 // int64 / uint64 support 33 #if defined(UINT64_MAX) 34 #define LIBC_TYPES_HAS_INT64 35 #endif // UINT64_MAX 36 37 // int128 / uint128 support 38 #if defined(__SIZEOF_INT128__) 39 #define LIBC_TYPES_HAS_INT128 40 #endif // defined(__SIZEOF_INT128__) 41 42 // -- float16 support --------------------------------------------------------- 43 // LIBC_TYPES_HAS_FLOAT16 is provided by 44 // "include/llvm-libc-macros/float16-macros.h" 45 #ifdef LIBC_TYPES_HAS_FLOAT16 46 // Type alias for internal use. 47 using float16 = _Float16; 48 #endif // LIBC_TYPES_HAS_FLOAT16 49 50 // -- float128 support -------------------------------------------------------- 51 // LIBC_TYPES_HAS_FLOAT128 and 'float128' type are provided by 52 // "include/llvm-libc-types/float128.h" 53 54 #endif // LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_TYPES_H 55