[llvm] ab069f3 - [X86] combineArithReduction - pull out repeated getVectorNumElements() calls
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 19 11:41:29 PST 2022
Author: Simon Pilgrim
Date: 2022-02-19T19:41:20Z
New Revision: ab069f37e80fe6d51c1ed32a931866e99a05e2b7
URL: https://github.com/llvm/llvm-project/commit/ab069f37e80fe6d51c1ed32a931866e99a05e2b7
DIFF: https://github.com/llvm/llvm-project/commit/ab069f37e80fe6d51c1ed32a931866e99a05e2b7.diff
LOG: [X86] combineArithReduction - pull out repeated getVectorNumElements() calls
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 9e765a90e8bcd..e2d37ee917f5e 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -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) {
@@ -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) {
@@ -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.
More information about the llvm-commits
mailing list