Skip to content

Commit

Permalink
[libc][NFC] Don't expose how float16 and float128 types are provi…
Browse files Browse the repository at this point in the history
…ded (#83818)

Umbrella bug #83182
  • Loading branch information
gchatelet authored Mar 4, 2024
1 parent 52a460f commit 07f8efa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
7 changes: 3 additions & 4 deletions libc/include/llvm-libc-types/float128.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,17 @@
// https://github.com/llvm/llvm-project/issues/80195
#if defined(__STDC_IEC_60559_BFP__) && !defined(__clang__) && \
!defined(__cplusplus)
// Use _Float128 C23 type.
#define LIBC_COMPILER_HAS_C23_FLOAT128
#define LIBC_TYPES_HAS_FLOAT128
typedef _Float128 float128;
#elif defined(__FLOAT128__) || defined(__SIZEOF_FLOAT128__)
// Use __float128 type. gcc and clang sometime use __SIZEOF_FLOAT128__ to
// notify the availability of __float128.
// clang also uses __FLOAT128__ macro to notify the availability of __float128
// type: https://reviews.llvm.org/D15120
#define LIBC_COMPILER_HAS_FLOAT128_EXTENSION
#define LIBC_TYPES_HAS_FLOAT128
typedef __float128 float128;
#elif (LDBL_MANT_DIG == 113)
// Use long double.
#define LIBC_TYPES_HAS_FLOAT128
typedef long double float128;
#endif

Expand Down
11 changes: 4 additions & 7 deletions libc/src/__support/macros/properties/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128
#endif

// float16 support.
// -- float16 support ---------------------------------------------------------
// TODO: move this logic to "llvm-libc-types/float16.h"
#if defined(LIBC_TARGET_ARCH_IS_X86_64) && defined(LIBC_TARGET_CPU_HAS_SSE2)
#if (defined(LIBC_COMPILER_CLANG_VER) && (LIBC_COMPILER_CLANG_VER >= 1500)) || \
Expand All @@ -50,11 +50,8 @@ using float16 = _Float16;
#endif
#endif

// float128 support.
#if defined(LIBC_COMPILER_HAS_C23_FLOAT128) || \
defined(LIBC_COMPILER_HAS_FLOAT128_EXTENSION) || \
defined(LIBC_TYPES_LONG_DOUBLE_IS_FLOAT128)
#define LIBC_TYPES_HAS_FLOAT128
#endif
// -- float128 support --------------------------------------------------------
// LIBC_TYPES_HAS_FLOAT128 and 'float128' type are provided by
// "include/llvm-libc-types/float128.h"

#endif // LLVM_LIBC_SRC___SUPPORT_MACROS_PROPERTIES_TYPES_H

0 comments on commit 07f8efa

Please sign in to comment.