[llvm] [X86][AVX] Match v4f64 blend from shuffle of scalar values. (PR #135753)
Leon Clark via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 27 14:33:01 PDT 2025
================
@@ -8753,29 +8753,28 @@ static SDValue lowerBuildVectorAsBlend(BuildVectorSDNode *BVOp, SDLoc const &DL,
MVT VT = BVOp->getSimpleValueType(0u);
auto const NumElems = VT.getVectorNumElements();
- if (Subtarget.hasAVX() && VT == MVT::v4f64) {
+ if (VT == MVT::v4f64) {
// Collect unique operands.
auto UniqueOps = SmallSet<SDValue, 16u>();
- for (auto &Op : BVOp->ops()) {
- if (isIntOrFPConstant(Op) || Op.get()->isUndef())
- return {};
+ for (SDValue Op : BVOp->ops()) {
+ if (isIntOrFPConstant(Op) || Op.isUndef())
+ return SDValue();
UniqueOps.insert(Op);
}
// Candidate BUILD_VECTOR must have 2 unique operands.
if (UniqueOps.size() != 2u)
- return {};
+ return SDValue();
// Create shuffle mask.
- auto Op0 = BVOp->getOperand(0u);
- auto Mask = std::vector<int>();
- Mask.reserve(NumElems);
+ SDValue Op0 = BVOp->getOperand(0u);
----------------
PeddleSpam wrote:
This was your suggestion.
> We can avoid this if above we instead initialise Op0/Op1 as:
>
> ```
> SDValue Op0 = *UniqueOps.begin();
> SDValue Op1 = *(UniqueOps.begin() + 1);
> ```
https://github.com/llvm/llvm-project/pull/135753
More information about the llvm-commits
mailing list