diff options
author | Lewis Crawford <lcrawford@nvidia.com> | 2025-09-26 11:37:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-09-26 11:37:29 +0100 |
commit | a27baf9c96a484312a1a32df1e552bcce7a610d1 (patch) | |
tree | 0c9d22a9462fd49443dbbde729395a3c435982ba /llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | |
parent | 81aafd91fd27f20677402b6a8c8aacbc4928d6d1 (diff) | |
download | llvm-a27baf9c96a484312a1a32df1e552bcce7a610d1.zip llvm-a27baf9c96a484312a1a32df1e552bcce7a610d1.tar.gz llvm-a27baf9c96a484312a1a32df1e552bcce7a610d1.tar.bz2 |
[SelectionDAG] Improve v2f16 maximumnum expansion (#160723)
On targets where f32 maximumnum is legal, but maximumnum on vectors of
smaller types is not legal (e.g. v2f16), try unrolling the vector first
as part of the expansion.
Only fall back to expanding the full maximumnum computation into
compares + selects if maximumnum on the scalar element type cannot be
supported.
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index 4145c8a..dba5a8c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -8839,7 +8839,9 @@ SDValue TargetLowering::expandFMINIMUMNUM_FMAXIMUMNUM(SDNode *Node, return DAG.getNode(IEEE2008Op, DL, VT, LHS, RHS, Flags); } - if (VT.isVector() && !isOperationLegalOrCustom(ISD::VSELECT, VT)) + if (VT.isVector() && + (isOperationLegalOrCustomOrPromote(Opc, VT.getVectorElementType()) || + !isOperationLegalOrCustom(ISD::VSELECT, VT))) return DAG.UnrollVectorOp(Node); // If only one operand is NaN, override it with another operand. |