Skip to content

Commit 5e29cdf

Browse files
Address comments, includes fix for using wrong signedness
Fix wrong signedness in promotion function. Make expand code depend on node signedness not on operand extend.
1 parent ccc6f48 commit 5e29cdf

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,8 +2892,13 @@ SDValue DAGTypeLegalizer::PromoteIntOp_VECTOR_FIND_LAST_ACTIVE(SDNode *N,
28922892

28932893
SDValue DAGTypeLegalizer::PromoteIntOp_PARTIAL_REDUCE_MLA(SDNode *N) {
28942894
SmallVector<SDValue, 1> NewOps(N->ops());
2895-
NewOps[1] = GetPromotedInteger(N->getOperand(1));
2896-
NewOps[2] = GetPromotedInteger(N->getOperand(2));
2895+
if (N->getOpcode() == ISD::PARTIAL_REDUCE_SMLA) {
2896+
NewOps[1] = SExtPromotedInteger(N->getOperand(1));
2897+
NewOps[2] = SExtPromotedInteger(N->getOperand(2));
2898+
} else {
2899+
NewOps[1] = ZExtPromotedInteger(N->getOperand(1));
2900+
NewOps[2] = ZExtPromotedInteger(N->getOperand(2));
2901+
}
28972902
return SDValue(DAG.UpdateNodeOperands(N, NewOps), 0);
28982903
}
28992904

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11901,8 +11901,9 @@ SDValue TargetLowering::expandPartialReduceMLA(SDNode *N,
1190111901
EVT FullTy = MulLHS.getValueType();
1190211902

1190311903
auto ExtendToAccEltVT = [&](SDValue V) {
11904-
unsigned ExtOpc = V->getOpcode() == ISD::SIGN_EXTEND ? ISD::SIGN_EXTEND
11905-
: ISD::ZERO_EXTEND;
11904+
unsigned ExtOpc = V->getOpcode() == ISD::PARTIAL_REDUCE_SMLA
11905+
? ISD::SIGN_EXTEND
11906+
: ISD::ZERO_EXTEND;
1190611907
EVT ExtVT = V.getValueType().changeVectorElementType(
1190711908
Acc.getValueType().getVectorElementType());
1190811909
if (ExtVT != FullTy)

0 commit comments

Comments
 (0)