[llvm] [RISCV] Combine a gather to a larger element type (PR #66694)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 18 14:31:22 PDT 2023
================
@@ -14020,6 +14066,33 @@ SDValue RISCVTargetLowering::PerformDAGCombine(SDNode *N,
DAG.getVectorShuffle(VT, DL, Load, DAG.getUNDEF(VT), ShuffleMask);
return DAG.getMergeValues({Shuffle, Load.getValue(1)}, DL);
}
+
+ if (MGN->getExtensionType() == ISD::NON_EXTLOAD &&
+ matchIndexAsWiderOp(VT, Index, MGN->getMask(),
+ MGN->getMemOperand()->getBaseAlign(), Subtarget)) {
+ SmallVector<SDValue> NewIndices;
+ for (unsigned i = 0; i < Index->getNumOperands(); i += 2)
+ NewIndices.push_back(Index.getOperand(i));
+ EVT IndexVT = Index.getValueType()
+ .getHalfNumVectorElementsVT(*DAG.getContext());
+ Index = DAG.getBuildVector(IndexVT, DL, NewIndices);
+
+ unsigned ElementSize = VT.getScalarStoreSize();
+ EVT WideScalarVT = MVT::getIntegerVT(ElementSize * 8 * 2);
+ EVT WideVT = VT.changeVectorElementType(WideScalarVT)
----------------
topperc wrote:
I would avoid changeVectorElementType. If VT is representable as an MVT and WideVT isn't it will crash. The MVT won't have a `Type*` and we would need an LLVMContext to create the EVT for the WideVT.
https://github.com/llvm/llvm-project/pull/66694
More information about the llvm-commits
mailing list