[llvm] [X86] Lower vXi8 multiplies by constant using PMADDUBSW on SSSE3+ targets (PR #95403)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 13 06:15:34 PDT 2024
================
@@ -28506,6 +28508,31 @@ static SDValue LowerMUL(SDValue Op, const X86Subtarget &Subtarget,
MVT ExVT = MVT::getVectorVT(MVT::i16, NumElts / 2);
+ // For vXi8 mul-by-constant, try PMADDUBSW to avoid the need for extension.
+ // Don't do this if we only need to unpack one half.
+ if (Subtarget.hasSSSE3() &&
+ ISD::isBuildVectorOfConstantSDNodes(B.getNode())) {
+ bool IsLoLaneZeroOrUndef = true;
+ bool IsHiLaneZeroOrUndef = true;
+ for (auto [Idx, Val] : enumerate(B->ops())) {
+ if ((Idx % NumEltsPerLane) >= (NumEltsPerLane / 2))
+ IsHiLaneZeroOrUndef &= isNullConstantOrUndef(Val);
----------------
phoebewang wrote:
IsHiLaneAllZeroOrUndef?
https://github.com/llvm/llvm-project/pull/95403
More information about the llvm-commits
mailing list