Skip to content

[libc][NFC] Don't expose how float16 and float128 types are provided #83818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 4, 2024

Conversation

gchatelet
Copy link
Contributor

@gchatelet gchatelet commented Mar 4, 2024

Umbrella bug #83182

@llvmbot llvmbot added the libc label Mar 4, 2024
@gchatelet gchatelet changed the title [libc][NFC] Don't expose how float16 and float128 types are provided [libc][NFC] Don't expose how float16 and float128 types are provided Mar 4, 2024
@llvmbot
Copy link
Member

llvmbot commented Mar 4, 2024

@llvm/pr-subscribers-libc

Author: Guillaume Chatelet (gchatelet)

Changes

Umbrella bug #83182


Full diff: https://github.com/llvm/llvm-project/pull/83818.diff

2 Files Affected:

  • (modified) libc/include/llvm-libc-types/float128.h (+3-4)
  • (modified) libc/src/__support/macros/properties/types.h (+4-7)
diff --git a/libc/include/llvm-libc-types/float128.h b/libc/include/llvm-libc-types/float128.h
index 0b290c676ecc02..82ebb79f1f5808 100644
--- a/libc/include/llvm-libc-types/float128.h
+++ b/libc/include/llvm-libc-types/float128.h
@@ -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
 
diff --git a/libc/src/__support/macros/properties/types.h b/libc/src/__support/macros/properties/types.h
index 595871e73b8fcc..a8d321f174e4f2 100644
--- a/libc/src/__support/macros/properties/types.h
+++ b/libc/src/__support/macros/properties/types.h
@@ -26,7 +26,7 @@
 #define LIBC_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)) || \
@@ -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_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

@gchatelet gchatelet requested a review from lntue March 4, 2024 12:20
@gchatelet gchatelet merged commit 07f8efa into llvm:main Mar 4, 2024
@gchatelet gchatelet deleted the dont_expose_how_types_are_provided branch March 4, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants