[llvm] [X86][SelectionDAG] - Add support for llvm.canonicalize intrinsic (PR #106370)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 11:15:17 PDT 2024
================
@@ -58159,6 +58160,25 @@ static SDValue combineINTRINSIC_VOID(SDNode *N, SelectionDAG &DAG,
return SDValue();
}
+static SDValue combineCanonicalize(SDNode *N, SelectionDAG &DAG) {
+ SDValue Operand = N->getOperand(0);
+ EVT VT = Operand.getValueType();
+ SDLoc dl(N);
+
+ // Canonicalize scalar variable FP Nodes.
+ SDValue One =
+ DAG.getNode(ISD::SINT_TO_FP, dl, VT, DAG.getConstant(1, dl, MVT::i32));
+ // TODO: Fix Crash for bf16 when generating strict_fmul as it
+ // leads to a error : SoftPromoteHalfResult #0: t11: bf16,ch = strict_fmul t0,
+ // ConstantFP:bf16<APFloat(16256)>, t5 LLVM ERROR: Do not know how to soft
+ // promote this operator's result!
+ SDValue Chain = DAG.getEntryNode();
+ SDValue StrictFmul = DAG.getNode(ISD::STRICT_FMUL, dl, {VT, MVT::Other},
+ {Chain, One, Operand});
----------------
arsenm wrote:
Constant operands canonically should be the RHS
https://github.com/llvm/llvm-project/pull/106370
More information about the llvm-commits
mailing list