[llvm] Enable logf128 constant folding for hosts with 128bit long double (PR #96287)
Matthew Devereau via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 1 11:30:34 PDT 2024
================
@@ -11,7 +11,15 @@
namespace llvm {
-#if defined(__clang__) && defined(__FLOAT128__) && \
+#if !defined(__LONG_DOUBLE_IBM128__) && (__SIZEOF_LONG_DOUBLE__ == 16) && \
+ (__SIZEOF_INT128__ == 16) && (__LDBL_MANT_DIG__ == 113)
+#define HAS_IEE754_FLOAT128
+#if (defined(__GNUC__) && __GNUC__ > 12)
----------------
MDevereau wrote:
This would require including math.h in this file (which isn't a problem but worth mentioning). It's also possible for hosts to satisfy the condition and fall through to this but not have logf128 ([I've seen x86 with clang do this](https://godbolt.org/z/hcn87xaon)). It's possible to add HAS_LOGF128 to the check, which is set at CMake time in order to get around this, but this isn't really about logf128 and more about the 128 bit floating-point types themselves. Granted, my logf128 patches are the only thing using this, but it still seems incorrect.
Apart from this, it does function well though.
https://github.com/llvm/llvm-project/pull/96287
More information about the llvm-commits
mailing list