[llvm] [AArch64][NEON][SVE] Lower mixed sign/zero extended partial reductions to usdot (PR #107566)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 13 06:35:22 PDT 2024
================
@@ -21824,37 +21830,54 @@ SDValue tryLowerPartialReductionToDot(SDNode *N,
auto ExtA = MulOp->getOperand(0);
auto ExtB = MulOp->getOperand(1);
- bool IsSExt = ExtA->getOpcode() == ISD::SIGN_EXTEND;
- bool IsZExt = ExtA->getOpcode() == ISD::ZERO_EXTEND;
- if (ExtA->getOpcode() != ExtB->getOpcode() || (!IsSExt && !IsZExt))
+
+ bool AIsSExt = ExtA->getOpcode() == ISD::SIGN_EXTEND;
+ bool AIsZExt = ExtA->getOpcode() == ISD::ZERO_EXTEND;
+ bool BIsSExt = ExtB->getOpcode() == ISD::SIGN_EXTEND;
+ bool BIsZExt = ExtB->getOpcode() == ISD::ZERO_EXTEND;
+ if (!(AIsSExt || AIsZExt) || !(BIsSExt || BIsZExt))
----------------
paulwalker-arm wrote:
Now we care about all combinations I think you'd be better of with something like:
```
if (!isExtOpcode(ExtA->getOpcode() || !isExtOpcode(ExtB->getOpcode())
return SDValue();
bool AIsSigned = ExtA->getOpcode() == ISD::SIGN_EXTEND;
bool BIsSigned = ExtB->getOpcode() == ISD::SIGN_EXTEND;
```
Whilst this allows ISD::ANY_EXTEND to pass through, I believe they would make the result undefined and thus emitting any DOT still a valid option.
https://github.com/llvm/llvm-project/pull/107566
More information about the llvm-commits
mailing list