[llvm-branch-commits] [llvm] [SelectionDAG][X86] Widen <2 x T> vector types for atomic load (PR #120598)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon May 5 11:30:26 PDT 2025
================
@@ -6014,6 +6017,85 @@ SDValue DAGTypeLegalizer::WidenVecRes_INSERT_VECTOR_ELT(SDNode *N) {
N->getOperand(1), N->getOperand(2));
}
+/// Either return the same load or provide appropriate casts
+/// from the load and return that.
+static SDValue loadElement(SDValue LdOp, EVT FirstVT, EVT WidenVT,
+ TypeSize LdWidth, TypeSize FirstVTWidth, SDLoc dl,
+ SelectionDAG &DAG) {
+ assert(TypeSize::isKnownLE(LdWidth, FirstVTWidth));
+ TypeSize WidenWidth = WidenVT.getSizeInBits();
+ if (!FirstVT.isVector()) {
+ unsigned NumElts =
+ WidenWidth.getFixedValue() / FirstVTWidth.getFixedValue();
+ EVT NewVecVT = EVT::getVectorVT(*DAG.getContext(), FirstVT, NumElts);
+ SDValue VecOp = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, NewVecVT, LdOp);
+ return DAG.getNode(ISD::BITCAST, dl, WidenVT, VecOp);
+ } else if (FirstVT == WidenVT)
+ return LdOp;
+ else {
+ // TODO: We don't currently have any tests that exercise this code path.
+ assert(WidenWidth.getFixedValue() % FirstVTWidth.getFixedValue() == 0);
+ unsigned NumConcat =
+ WidenWidth.getFixedValue() / FirstVTWidth.getFixedValue();
+ SmallVector<SDValue, 16> ConcatOps(NumConcat);
+ SDValue UndefVal = DAG.getUNDEF(FirstVT);
----------------
arsenm wrote:
Poison
https://github.com/llvm/llvm-project/pull/120598
More information about the llvm-branch-commits
mailing list