[llvm] Change `fp128` lowering to use `f128` functions by default (PR #76558)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 06:36:12 PDT 2025


================
@@ -2165,6 +2165,48 @@ VersionTuple Triple::getCanonicalVersionForOS(OSType OSKind,
   }
 }
 
+bool Triple::shouldLowerf128AsLongDouble() const {
+  // Always prefer to lower to `*f128` symbols when they are likely to be
+  // available, to avoid any inaccuracies or problems from libc config.
+  //
+  // Note that the logic should be kept in sync with Clang's LongDoubleFormat.
+
+  // Glibc helpfully aliases `*f128` symbols to `*l` symbols on platforms where
+  // that works, so use those.
+  if (isGNUEnvironment())
+    return false;
----------------
beetrees wrote:

This also covers MinGW `*-pc-windows-gnu` targets, which don't use glibc. The logic is still correct (as Windows needs to use the `*f128` symbols), but swapping the order of this if statement and the `if (isOSWindows() || isOSDarwin())` below will make the comment correct too.

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


More information about the llvm-commits mailing list