@@ -2392,6 +2392,15 @@ static bool isIntImmediate(const SDNode *N, uint64_t &Imm) {
23922392 return false;
23932393}
23942394
2395+ bool isVectorizedBinOp(unsigned Opcode) {
2396+ switch (Opcode) {
2397+ case AArch64ISD::SQDMULH:
2398+ return true;
2399+ default:
2400+ return false;
2401+ }
2402+ }
2403+
23952404// isOpcWithIntImmediate - This method tests to see if the node is a specific
23962405// opcode and that it has a immediate integer right operand.
23972406// If so Imm will receive the value.
@@ -20126,8 +20135,9 @@ static SDValue performConcatVectorsCombine(SDNode *N,
2012620135 // size, combine into an binop of two contacts of the source vectors. eg:
2012720136 // concat(uhadd(a,b), uhadd(c, d)) -> uhadd(concat(a, c), concat(b, d))
2012820137 if (N->getNumOperands() == 2 && N0Opc == N1Opc && VT.is128BitVector() &&
20129- DAG.getTargetLoweringInfo().isBinOp(N0Opc) && N0->hasOneUse() &&
20130- N1->hasOneUse()) {
20138+ (DAG.getTargetLoweringInfo().isBinOp(N0Opc) ||
20139+ isVectorizedBinOp(N0Opc)) &&
20140+ N0->hasOneUse() && N1->hasOneUse()) {
2013120141 SDValue N00 = N0->getOperand(0);
2013220142 SDValue N01 = N0->getOperand(1);
2013320143 SDValue N10 = N1->getOperand(0);
@@ -20986,7 +20996,7 @@ static SDValue performBuildVectorCombine(SDNode *N,
2098620996 return SDValue();
2098720997}
2098820998
20989- // A special combine for the vqdmulh family of instructions.
20999+ // A special combine for the sqdmulh family of instructions.
2099021000// smin( sra ( mul( sext v0, sext v1 ) ), SHIFT_AMOUNT ),
2099121001// SATURATING_VAL ) can be reduced to sext(sqdmulh(...))
2099221002static SDValue trySQDMULHCombine(SDNode *N, SelectionDAG &DAG) {
@@ -21043,24 +21053,20 @@ static SDValue trySQDMULHCombine(SDNode *N, SelectionDAG &DAG) {
2104321053 SDValue SExt0 = Mul.getOperand(0);
2104421054 SDValue SExt1 = Mul.getOperand(1);
2104521055
21046- if (SExt0.getOpcode() != ISD::SIGN_EXTEND ||
21047- SExt1.getOpcode() != ISD::SIGN_EXTEND ||
21048- SExt0.getValueType() != SExt1.getValueType())
21049- return SDValue();
21056+ EVT SExt0Type = SExt0.getOperand(0).getValueType();
21057+ EVT SExt1Type = SExt1.getOperand(0).getValueType();
2105021058
21051- if ((ShiftAmt == 16 && ( SExt0.getValueType () != MVT::v8i32 &&
21052- SExt0.getValueType () != MVT::v4i32)) ||
21053- (ShiftAmt == 32 && (SExt0.getValueType () != MVT::v4i64 &&
21054- SExt0.getValueType () != MVT::v2i64)) )
21059+ if (SExt0.getOpcode () != ISD::SIGN_EXTEND ||
21060+ SExt1.getOpcode () != ISD::SIGN_EXTEND || SExt0Type != SExt1Type ||
21061+ SExt0Type.getScalarType () != ScalarType ||
21062+ SExt0Type.getFixedSizeInBits () > 128 )
2105521063 return SDValue();
2105621064
2105721065 SDValue V0 = SExt0.getOperand(0);
2105821066 SDValue V1 = SExt1.getOperand(0);
2105921067
2106021068 SDLoc DL(SMin);
21061- EVT VecVT = N->getValueType(0);
21062- SDValue SQDMULH = DAG.getNode(AArch64ISD::SQDMULH, DL, VecVT, V0, V1);
21063- return DAG.getNode(ISD::SIGN_EXTEND, DL, N->getValueType(0), SQDMULH);
21069+ return DAG.getNode(AArch64ISD::SQDMULH, DL, SExt0Type, V0, V1);
2106421070}
2106521071
2106621072static SDValue performTruncateCombine(SDNode *N, SelectionDAG &DAG,
0 commit comments