[llvm] [SimplifyLibCalls] Constant fold `remquo` (PR #99647)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 03:43:28 PDT 2024
================
@@ -3018,6 +3018,39 @@ void LibCallSimplifier::classifyArgUse(
}
}
+/// Constant folds remquo
+Value *LibCallSimplifier::optimizeRemquo(CallInst *CI, IRBuilderBase &B) {
+ const APFloat *X, *Y;
+ if (!match(CI->getArgOperand(0), m_APFloat(X)) ||
+ !match(CI->getArgOperand(1), m_APFloat(Y)))
+ return nullptr;
+
+ if (X->isNaN() || Y->isNaN() || X->isInfinity() || Y->isZero())
+ return nullptr;
----------------
arsenm wrote:
Well, it could/should if we had a generic raise FP except mechanism but we don't. We do not care about fp exceptions, except in strictfp, and only for calls that aren't fpexcept.ignore. So you should still fold this unless the call is strictfp
https://github.com/llvm/llvm-project/pull/99647
More information about the llvm-commits
mailing list