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

Matthew Devereau via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 26 08:41:32 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);
----------------
MDevereau wrote:

Is this not already what was happening previously? Inside `ConstantFoldFP` the result is handled as a double. I'm not sure if you're asking me to start preserving the long double type in this pre-existing code or whether what I've introduced has changed established behaviour

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


More information about the llvm-commits mailing list