aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorNicholas Guy <nicholas.guy@arm.com>2022-12-08 13:56:38 +0000
committerNicholas Guy <nicholas.guy@arm.com>2022-12-12 11:38:19 +0000
commita3dc5b534a80c1b6d2a22c4bb8710f89d034d63d (patch)
treeb828aba677cf9e4378a3af5dd5ad7342b1fa4dc7 /llvm/lib/CodeGen
parent8812b6eed7b2328d6e2739071f6460bfd47ac8e2 (diff)
downloadllvm-a3dc5b534a80c1b6d2a22c4bb8710f89d034d63d.zip
llvm-a3dc5b534a80c1b6d2a22c4bb8710f89d034d63d.tar.gz
llvm-a3dc5b534a80c1b6d2a22c4bb8710f89d034d63d.tar.bz2
[ARM][CodeGen] Add integer support for complex deinterleaving
Differential Revision: https://reviews.llvm.org/D139628
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp b/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
index c2a05cb..2414c0d 100644
--- a/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
+++ b/llvm/lib/CodeGen/ComplexDeinterleavingPass.cpp
@@ -635,21 +635,30 @@ ComplexDeinterleavingGraph::identifyAdd(Instruction *Real, Instruction *Imag) {
// Determine rotation
ComplexDeinterleavingRotation Rotation;
- if (Real->getOpcode() == Instruction::FSub &&
- Imag->getOpcode() == Instruction::FAdd)
+ if ((Real->getOpcode() == Instruction::FSub &&
+ Imag->getOpcode() == Instruction::FAdd) ||
+ (Real->getOpcode() == Instruction::Sub &&
+ Imag->getOpcode() == Instruction::Add))
Rotation = ComplexDeinterleavingRotation::Rotation_90;
- else if (Real->getOpcode() == Instruction::FAdd &&
- Imag->getOpcode() == Instruction::FSub)
+ else if ((Real->getOpcode() == Instruction::FAdd &&
+ Imag->getOpcode() == Instruction::FSub) ||
+ (Real->getOpcode() == Instruction::Add &&
+ Imag->getOpcode() == Instruction::Sub))
Rotation = ComplexDeinterleavingRotation::Rotation_270;
else {
LLVM_DEBUG(dbgs() << " - Unhandled case, rotation is not assigned.\n");
return nullptr;
}
- auto *AR = cast<Instruction>(Real->getOperand(0));
- auto *BI = cast<Instruction>(Real->getOperand(1));
- auto *AI = cast<Instruction>(Imag->getOperand(0));
- auto *BR = cast<Instruction>(Imag->getOperand(1));
+ auto *AR = dyn_cast<Instruction>(Real->getOperand(0));
+ auto *BI = dyn_cast<Instruction>(Real->getOperand(1));
+ auto *AI = dyn_cast<Instruction>(Imag->getOperand(0));
+ auto *BR = dyn_cast<Instruction>(Imag->getOperand(1));
+
+ if (!AR || !AI || !BR || !BI) {
+ LLVM_DEBUG(dbgs() << " - Not all operands are instructions.\n");
+ return nullptr;
+ }
NodePtr ResA = identifyNode(AR, AI);
if (!ResA) {
@@ -673,8 +682,11 @@ ComplexDeinterleavingGraph::identifyAdd(Instruction *Real, Instruction *Imag) {
static bool isInstructionPairAdd(Instruction *A, Instruction *B) {
unsigned OpcA = A->getOpcode();
unsigned OpcB = B->getOpcode();
+
return (OpcA == Instruction::FSub && OpcB == Instruction::FAdd) ||
- (OpcA == Instruction::FAdd && OpcB == Instruction::FSub);
+ (OpcA == Instruction::FAdd && OpcB == Instruction::FSub) ||
+ (OpcA == Instruction::Sub && OpcB == Instruction::Add) ||
+ (OpcA == Instruction::Add && OpcB == Instruction::Sub);
}
static bool isInstructionPairMul(Instruction *A, Instruction *B) {