File tree Expand file tree Collapse file tree 7 files changed +41
-5
lines changed
src/__support/macros/properties Expand file tree Collapse file tree 7 files changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ def IntTypesAPI : PublicAPI<"inttypes.h"> {
55
55
}
56
56
57
57
def MathAPI : PublicAPI<"math.h"> {
58
- let Types = ["double_t", "float_t"];
58
+ let Types = ["double_t", "float_t", "float128" ];
59
59
}
60
60
61
61
def FenvAPI: PublicAPI<"fenv.h"> {
Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ add_gen_header(
92
92
.llvm-libc-macros.math_macros
93
93
.llvm-libc-types.double_t
94
94
.llvm-libc-types.float_t
95
+ .llvm-libc-types.float128
95
96
)
96
97
97
98
# TODO: This should be conditional on POSIX networking being included.
Original file line number Diff line number Diff line change @@ -96,3 +96,4 @@ add_header(rpc_opcodes_t HDR rpc_opcodes_t.h)
96
96
add_header (ACTION HDR ACTION.h )
97
97
add_header (ENTRY HDR ENTRY.h )
98
98
add_header (struct_hsearch_data HDR struct_hsearch_data.h )
99
+ add_header (float128 HDR float128.h )
Original file line number Diff line number Diff line change
1
+ //===-- Definition of float128 type ---------------------------------------===//
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 __LLVM_LIBC_TYPES_FLOAT128_H__
10
+ #define __LLVM_LIBC_TYPES_FLOAT128_H__
11
+
12
+ #if defined(__clang__ )
13
+ #define LIBC_COMPILER_IS_CLANG
14
+ #define LIBC_COMPILER_CLANG_VER (__clang_major__ * 100 + __clang_minor__)
15
+ #elif defined(__GNUC__ )
16
+ #define LIBC_COMPILER_IS_GCC
17
+ #define LIBC_COMPILER_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
18
+ #endif
19
+
20
+ #if (defined(LIBC_COMPILER_GCC_VER ) && (LIBC_COMPILER_GCC_VER >= 1301 )) && \
21
+ (defined(__aarch64__ ) || defined(__riscv ) || defined(__x86_64__ ))
22
+ typedef _Float128 float128 ;
23
+ #elif (defined(LIBC_COMPILER_CLANG_VER ) && (LIBC_COMPILER_CLANG_VER >= 600 )) && \
24
+ (defined(__x86_64__ ) && !defined(__Fuchsia__ ))
25
+ typedef __float128 float128 ;
26
+ #elif (LDBL_MANT_DIG == 113 ) || (__LDBL_MANT_DIG__ == 113 )
27
+ typedef long double float128 ;
28
+ #endif
29
+
30
+ #endif // __LLVM_LIBC_TYPES_FLOAT128_H__
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ def LongDoubleType : NamedType<"long double">;
51
51
def CharType : NamedType<"char">;
52
52
53
53
// TODO: Add compatibility layer to use C23 type _Float128 if possible.
54
- def Float128Type : NamedType<"__float128 ">;
54
+ def Float128Type : NamedType<"float128 ">;
55
55
56
56
// Common types
57
57
def VoidPtr : PtrType<VoidType>;
Original file line number Diff line number Diff line change @@ -352,6 +352,7 @@ def StdC : StandardSpec<"stdc"> {
352
352
[
353
353
NamedType<"float_t">,
354
354
NamedType<"double_t">,
355
+ NamedType<"float128">,
355
356
],
356
357
[], // Enumerations
357
358
[
Original file line number Diff line number Diff line change 19
19
#include < float.h> // LDBL_MANT_DIG
20
20
21
21
// 'long double' properties.
22
- #if (LDBL_MANT_DIG == 53)
22
+ #if (LDBL_MANT_DIG == 53) || (__LDBL_MANT_DIG__ == 53)
23
23
#define LIBC_LONG_DOUBLE_IS_FLOAT64
24
- #elif (LDBL_MANT_DIG == 64)
24
+ #elif (LDBL_MANT_DIG == 64) || (__LDBL_MANT_DIG__ == 64)
25
25
#define LIBC_LONG_DOUBLE_IS_X86_FLOAT80
26
- #elif (LDBL_MANT_DIG == 113)
26
+ #elif (LDBL_MANT_DIG == 113) || (__LDBL_MANT_DIG__ == 113)
27
27
#define LIBC_LONG_DOUBLE_IS_FLOAT128
28
28
#endif
29
29
@@ -53,6 +53,9 @@ using float16 = _Float16;
53
53
#endif
54
54
55
55
// float128 support.
56
+ // If the definition of float128 here is updated, also update
57
+ // include/llvm-libc-types/float128.h
58
+ // so that the type definition in generated header `math.h` matched.
56
59
#if (defined(LIBC_COMPILER_GCC_VER) && (LIBC_COMPILER_GCC_VER >= 1301)) && \
57
60
(defined(LIBC_TARGET_ARCH_IS_AARCH64) || \
58
61
defined (LIBC_TARGET_ARCH_IS_ANY_RISCV) || \
You can’t perform that action at this time.
0 commit comments