[llvm] [RISCV]: Implemented softening of `FCANONICALIZE` (PR #169234)
Kevin Per via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 24 03:30:55 PST 2025
================
@@ -311,6 +313,12 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_FABS(SDNode *N) {
return DAG.getNode(ISD::AND, SDLoc(N), NVT, Op, Mask);
}
+SDValue DAGTypeLegalizer::SoftenFloatRes_FCANONICALIZE(SDNode *N) {
+ return SoftenFloatRes_Unary(
+ N, GetFPLibCall(N->getValueType(0), RTLIB::FMIN_F32, RTLIB::FMIN_F64,
----------------
kper wrote:
hmmm, I see
I changed it now
> This function should always be implementable as multiplication by 1.0, provided that the compiler does not constant fold the operation. Likewise, division by 1.0 and llvm.minnum(x, x) are possible implementations. Addition with -0.0 is also sufficient provided that the rounding mode is not -Infinity.
https://llvm.org/docs/LangRef.html#llvm-canonicalize-intrinsic
Since, I wasn't sure whether mul * 1.0, etc gets folded, I mapped it to `llvm.minnum(x, x)`
https://github.com/llvm/llvm-project/pull/169234
More information about the llvm-commits
mailing list