================
@@ -4343,6 +4343,71 @@ Instruction
*InstCombinerImpl::visitSelectInst(SelectInst &SI) {
matchFMulByZeroIfResultEqZero(*this, Cmp0, Cmp1, MatchCmp1,
MatchCmp0,
SI, SIFPOp->hasNoSignedZeros()))
return replaceInstUsesWith(SI, Cmp0);
+
+ if (Pred == CmpInst::FCMP_ORD || Pred == CmpInst::FCMP_UNO) {
+ // Fold out only-canonicalize-non-nans pattern. This implements a
+ // wrapper around llvm.canonicalize which is not required to quiet
+ // signaling nans or preserve nan payload bits.
+ //
+ // %hard.canonical = call @llvm.canonicalize(%x)
+ // %soft.canonical = fdiv 1.0, %x
+ // %ord = fcmp ord %x, 0.0
+ // %x.canon = select i1 %ord, %hard.canonical, %soft.canonical
+ //
+ // With known IEEE handling:
+ // => %x
+ //
+ // With other denormal behaviors or exotic types:
----------------
jcranmer-intel wrote:
The comment here implies that we're doing the transform for the exotic long
double types, but the code itself is not doing so (and I agree with the code
over the comment here, I'm *extremely* wary of getting rid of canonicalizes for
these types).
https://github.com/llvm/llvm-project/pull/172998
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits