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

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 09:33:51 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:

Without this patch, we wouldn't try to fold fp128 at all.  With this patch, we try to fold it using "double" routines.  (Previously, we would only fold 64-bit or 32-bit floats.)

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


More information about the llvm-commits mailing list