[llvm] Enable logf128 constant folding for hosts with 128bit long double (PR #96287)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 22:05:48 PDT 2024


================
@@ -9,18 +9,17 @@
 #ifndef LLVM_FLOAT128
 #define LLVM_FLOAT128
 
+#include <cmath>
+
 namespace llvm {
 
-#if defined(__clang__) && defined(__FLOAT128__) &&                             \
-    defined(__SIZEOF_INT128__) && !defined(__LONG_DOUBLE_IBM128__)
-#define HAS_IEE754_FLOAT128
-typedef __float128 float128;
-#elif defined(__FLOAT128__) && defined(__SIZEOF_INT128__) &&                   \
-    !defined(__LONG_DOUBLE_IBM128__) &&                                        \
-    (defined(__GNUC__) || defined(__GNUG__))
+#ifdef HAS_LOGF128
+#if (__LDBL_MANT_DIG__ == 113) && !defined(__LONG_DOUBLE_IBM128__) &&          \
----------------
efriedma-quic wrote:

Is the check for __LDBL_MANT_DIG__ necessary with the current version?

Otherwise, this approach seems fine.

https://github.com/llvm/llvm-project/pull/96287


More information about the llvm-commits mailing list