[llvm] [AArch64] Support symmetric complex deinterleaving with higher factors (PR #151295)
Igor Kirillov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 31 09:09:42 PDT 2025
================
@@ -1890,22 +2016,53 @@ ComplexDeinterleavingGraph::identifyRoot(Instruction *RootI) {
}
ComplexDeinterleavingGraph::NodePtr
-ComplexDeinterleavingGraph::identifyDeinterleave(Instruction *Real,
- Instruction *Imag) {
- Instruction *I = nullptr;
- Value *FinalValue = nullptr;
- if (match(Real, m_ExtractValue<0>(m_Instruction(I))) &&
- match(Imag, m_ExtractValue<1>(m_Specific(I))) &&
- match(I, m_Intrinsic<Intrinsic::vector_deinterleave2>(
- m_Value(FinalValue)))) {
+ComplexDeinterleavingGraph::identifyDeinterleave(ComplexValues &Vals) {
+ Instruction *II = nullptr;
+
+ // Must be at least one complex value.
+ for (unsigned Idx = 0; Idx < Vals.size(); Idx++) {
+ auto *EVI = dyn_cast<ExtractValueInst>(Vals[Idx].Real);
+ if (!EVI || EVI->getNumIndices() != 1 ||
+ EVI->getIndices()[0] != (Idx * 2) ||
+ (Idx != 0 && II != EVI->getAggregateOperand())) {
+ II = nullptr;
+ break;
+ }
+ if (Idx == 0) {
+ II = dyn_cast<Instruction>(EVI->getAggregateOperand());
+ if (!II)
+ break;
+ }
+ EVI = dyn_cast<ExtractValueInst>(Vals[Idx].Imag);
+ if (!EVI || EVI->getNumIndices() != 1 ||
+ EVI->getIndices()[0] != ((Idx * 2) + 1) ||
+ II != EVI->getAggregateOperand()) {
+ II = nullptr;
+ break;
+ }
+ }
+
+ if (II && isa<IntrinsicInst>(II)) {
+ if (cast<IntrinsicInst>(II)->getIntrinsicID() !=
----------------
igogo-x86 wrote:
We can cast and check for null simultaneously using:
```
if (auto *IntrinsicII = dyn_cast_or_null<IntrinsicInst>(II))
```
https://github.com/llvm/llvm-project/pull/151295
More information about the llvm-commits
mailing list