[llvm] [AArch64] Fold scalar-to-vector shuffles into DUP/FMOV (PR #166962)
Amina Chabane via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 8 06:23:05 PST 2025
================
@@ -15654,6 +15654,41 @@ SDValue AArch64TargetLowering::LowerBUILD_VECTOR(SDValue Op,
}
}
+ // 128-bit NEON vectors: writing to the 64-bit low half with
+ // DUP/SCALAR_TO_VECTOR already zeroes the other 64 bits, so if the low half
+ // is a splat and the upper half is zero/undef we can materialise just that
+ // low half.
+ if (VT.isFixedLengthVector() && VT.getSizeInBits() == 128) {
+ EVT LaneVT = VT.getVectorElementType();
+ const unsigned HalfElts = NumElts >> 1;
+ SDValue FirstVal = Op.getOperand(0);
+
+ auto IsZero = [&](SDValue V) {
+ if (isNullConstant(V))
+ return true;
+ return V.getValueType().isFloatingPoint() && isNullFPConstant(V);
----------------
Amichaxx wrote:
Thanks.
https://github.com/llvm/llvm-project/pull/166962
More information about the llvm-commits
mailing list