|
12 | 12 | #include "../llvm-libc-macros/float-macros.h" // LDBL_MANT_DIG
|
13 | 13 |
|
14 | 14 | // Currently, the complex variant of C23 `_Float128` type is only defined as a
|
15 |
| -// built-in type in GCC 7 or later, and only for C. For C++, or for clang, |
16 |
| -// the complex variant of `__float128` is defined instead, and only on x86-64 |
17 |
| -// targets. |
| 15 | +// built-in type in GCC 7 or later, for C and in GCC 13 or later, for C++. For |
| 16 | +// clang, the complex variant of `__float128` is defined instead, and only on |
| 17 | +// x86-64 targets for clang 11 or later. |
18 | 18 | //
|
19 | 19 | // TODO: Update the complex variant of C23 `_Float128` type detection again when
|
20 | 20 | // clang supports it.
|
21 |
| -// https://github.com/llvm/llvm-project/issues/80195 |
22 |
| -#if defined(__STDC_IEC_60559_COMPLEX__) && !defined(__clang__) && \ |
23 |
| - !defined(__cplusplus) |
| 21 | +#if defined(__STDC_IEC_60559_COMPLEX__) && !defined(__clang__) |
| 22 | +#if !defined(__cplusplus) |
24 | 23 | #define LIBC_TYPES_HAS_CFLOAT128
|
25 | 24 | typedef _Complex _Float128 cfloat128;
|
26 |
| -#elif defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__) |
27 |
| -// Use _Complex __float128 type. gcc and clang sometime use __SIZEOF_FLOAT128__ |
28 |
| -// to notify the availability of __float128. clang also uses __FLOAT128__ macro |
29 |
| -// to notify the availability of __float128 type: |
| 25 | +#elif defined(__GNUC__) && __GNUC__ >= 13 |
| 26 | +#define LIBC_TYPES_HAS_CFLOAT128 |
| 27 | +typedef _Complex _Float128 cfloat128; |
| 28 | +#endif |
| 29 | +#elif __clang_major__ >= 11 && \ |
| 30 | + (defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)) |
| 31 | +// Use _Complex __float128 type. clang uses __SIZEOF_FLOAT128__ or __FLOAT128__ |
| 32 | +// macro to notify the availability of __float128 type: |
30 | 33 | // https://reviews.llvm.org/D15120
|
31 | 34 | #define LIBC_TYPES_HAS_CFLOAT128
|
32 | 35 | typedef _Complex __float128 cfloat128;
|
|
0 commit comments