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