[llvm] [AArch64] Fold scalar-to-vector shuffles into DUP/FMOV (PR #166962)
Amina Chabane via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 16:11:45 PST 2025
================
@@ -15666,6 +15654,56 @@ SDValue AArch64TargetLowering::LowerBUILD_VECTOR(SDValue Op,
}
}
+ // 128-bit NEON integer vectors:
+ // If BUILD_VECTOR has low half == splat(lane 0) and high half == zero,
+ // build the low half and return SUBREG_TO_REG(0, Lo, dsub).
+ // This avoids INSERT_VECTOR_ELT chains and lets later passes assume the
+ // other lanes are zero.
+ if (VT.isFixedLengthVector() && VT.getSizeInBits() == 128) {
+ EVT LaneVT = VT.getVectorElementType();
+ if (LaneVT.isInteger()) {
+ const unsigned HalfElts = NumElts >> 1;
+ SDValue FirstVal = Op.getOperand(0);
+
+ auto IsZero = [&](SDValue V) { return isNullConstant(V); };
+
+ bool IsLoSplatHiZero = true;
+ for (unsigned i = 0; i < NumElts; ++i) {
----------------
Amichaxx wrote:
I was a bit confused by this. Are you suggesting for all (or a specific case) that NumDifferentLanes == 2?
https://github.com/llvm/llvm-project/pull/166962
More information about the llvm-commits
mailing list