[llvm] [SVE][CodeGenPrepare] Sink address calculations that match SVE gather/scatter addressing modes. (PR #66996)
Paul Walker via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 2 08:32:29 PDT 2023
================
@@ -14380,6 +14380,31 @@ static bool areOperandsOfVmullHighP64(Value *Op1, Value *Op2) {
return isOperandOfVmullHighP64(Op1) && isOperandOfVmullHighP64(Op2);
}
+static bool shouldSinkVectorOfPtrs(Value *Ptrs, SmallVectorImpl<Use *> &Ops) {
+ // Restrict ourselves to the form CodeGenPrepare typically constructs.
+ auto *GEP = dyn_cast<GetElementPtrInst>(Ptrs);
+ if (!GEP || GEP->getNumOperands() != 2)
+ return false;
+
+ Value *Base = GEP->getOperand(0);
+ Value *Offsets = GEP->getOperand(1);
+
+ // We only care about scalar_base+vector_offsets.
+ if (Base->getType()->isVectorTy() || !Offsets->getType()->isVectorTy())
+ return false;
+
+ // Sink extends that would allow us to use 32-bit offset vectors.
+ if (isa<SExtInst>(Offsets) || isa<ZExtInst>(Offsets)) {
+ auto *OffsetsInst = cast<Instruction>(Offsets);
+ if (OffsetsInst->getType()->getScalarSizeInBits() > 32 &&
----------------
paulwalker-arm wrote:
I just wanted to maximise coverage. For example, offsets like `sext <vscale x 2 x i32> %0 to <vscale x 2 x i48>` can also be handled more efficiently when the code generator can see the extend.
https://github.com/llvm/llvm-project/pull/66996
More information about the llvm-commits
mailing list