Skip to content

Commit

Permalink
[X86] combineArithReduction - pull out repeated getVectorNumElements(…
Browse files Browse the repository at this point in the history
…) calls
  • Loading branch information
RKSimon committed Feb 19, 2022
1 parent dc4f9f0 commit ab069f3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Expand Up @@ -42963,6 +42963,7 @@ static SDValue combineArithReduction(SDNode *ExtElt, SelectionDAG &DAG,
return SDValue();

SDLoc DL(ExtElt);
unsigned NumElts = VecVT.getVectorNumElements();

// Extend v4i8/v8i8 vector to v16i8, with undef upper 64-bits.
auto WidenToV16I8 = [&](SDValue V, bool ZeroExtend) {
Expand All @@ -42984,7 +42985,6 @@ static SDValue combineArithReduction(SDNode *ExtElt, SelectionDAG &DAG,

// vXi8 mul reduction - promote to vXi16 mul reduction.
if (Opc == ISD::MUL) {
unsigned NumElts = VecVT.getVectorNumElements();
if (VT != MVT::i8 || NumElts < 4 || !isPowerOf2_32(NumElts))
return SDValue();
if (VecVT.getSizeInBits() >= 128) {
Expand Down Expand Up @@ -43027,8 +43027,7 @@ static SDValue combineArithReduction(SDNode *ExtElt, SelectionDAG &DAG,
}

// Must be a >=128-bit vector with pow2 elements.
if ((VecVT.getSizeInBits() % 128) != 0 ||
!isPowerOf2_32(VecVT.getVectorNumElements()))
if ((VecVT.getSizeInBits() % 128) != 0 || !isPowerOf2_32(NumElts))
return SDValue();

// vXi8 add reduction - sum lo/hi halves then use PSADBW.
Expand Down

0 comments on commit ab069f3

Please sign in to comment.