[llvm] Constant Fold Logf128 calls (PR #84501)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 14:27:43 PDT 2024


================
@@ -2209,6 +2209,11 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
     switch (IntrinsicID) {
       default: break;
       case Intrinsic::log:
+#if defined(__FLOAT128__) && defined(HAS_LOGF128)
+        if (Ty->isFP128Ty()) {
+          return ConstantFP::get(Ty, logf128(APF.convertToQuad()));
+        }
+#endif
         return ConstantFoldFP(log, APF, Ty);
----------------
efriedma-quic wrote:

This falls through to using the double-precision log() for long double values on hosts which don't have float128; that seems wrong.

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


More information about the llvm-commits mailing list