diff options
author | Sam Parker <sam.parker@arm.com> | 2019-09-04 08:41:34 +0000 |
---|---|---|
committer | Sam Parker <sam.parker@arm.com> | 2019-09-04 08:41:34 +0000 |
commit | fea532230bf4cf677d0ae6028eedf0135aa8b9e2 (patch) | |
tree | ad62034c85649bc6991de85498e3e47b7adbbd67 /llvm/lib/Target/ARM | |
parent | 16d12847c1b43cbea908f6defef0be434e71d7f6 (diff) | |
download | bcm5719-llvm-fea532230bf4cf677d0ae6028eedf0135aa8b9e2.tar.gz bcm5719-llvm-fea532230bf4cf677d0ae6028eedf0135aa8b9e2.zip |
[ARM][ParallelDSP] SExt mul for accumulation
For any unpaired muls, we accumulate them as an input to the
reduction. Check the type of the mul and perform a sext if the
existing accumlator input type is not the same.
Differential Revision: https://reviews.llvm.org/D66993
llvm-svn: 370851
Diffstat (limited to 'llvm/lib/Target/ARM')
-rw-r--r-- | llvm/lib/Target/ARM/ARMParallelDSP.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/llvm/lib/Target/ARM/ARMParallelDSP.cpp b/llvm/lib/Target/ARM/ARMParallelDSP.cpp index 212c5a397b8..cb022dd0126 100644 --- a/llvm/lib/Target/ARM/ARMParallelDSP.cpp +++ b/llvm/lib/Target/ARM/ARMParallelDSP.cpp @@ -649,18 +649,27 @@ void ARMParallelDSP::InsertParallelMACs(Reduction &R) { if (MulCand->Paired) continue; - LLVM_DEBUG(dbgs() << "Accumulating unpaired mul: " << *MulCand->Root - << "\n"); + Value *Mul = MulCand->Root; + LLVM_DEBUG(dbgs() << "Accumulating unpaired mul: " << *Mul << "\n"); + + if (R.getRoot()->getType() != Mul->getType()) { + assert(R.is64Bit() && "expected 64-bit result"); + Mul = Builder.CreateSExt(Mul, R.getRoot()->getType()); + } + if (!Acc) { - Acc = MulCand->Root; + Acc = Mul; continue; } - Acc = Builder.CreateAdd(MulCand->Root, Acc); + + Acc = Builder.CreateAdd(Mul, Acc); InsertAfter = cast<Instruction>(Acc); } if (!Acc) - Acc = ConstantInt::get(IntegerType::get(M->getContext(), 32), 0); + Acc = R.is64Bit() ? + ConstantInt::get(IntegerType::get(M->getContext(), 64), 0) : + ConstantInt::get(IntegerType::get(M->getContext(), 32), 0); IntegerType *Ty = IntegerType::get(M->getContext(), 32); for (auto &Pair : R.getMulPairs()) { |