[llvm] 6777289 - [X86] lowerShuffleAsBlend - pull out repeated getVectorNumElements() calls. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 29 08:20:51 PST 2022
Author: Simon Pilgrim
Date: 2022-01-29T16:16:29Z
New Revision: 6777289dd930393305703f0f8d992a4d648d43a7
URL: https://github.com/llvm/llvm-project/commit/6777289dd930393305703f0f8d992a4d648d43a7
DIFF: https://github.com/llvm/llvm-project/commit/6777289dd930393305703f0f8d992a4d648d43a7.diff
LOG: [X86] lowerShuffleAsBlend - pull out repeated getVectorNumElements() calls. NFC.
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 fd4022da8291..3f5f7147a23b 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -12574,6 +12574,8 @@ static SDValue lowerShuffleAsBlend(const SDLoc &DL, MVT VT, SDValue V1,
if (ForceV2Zero)
V2 = getZeroVector(VT, Subtarget, DAG, DL);
+ unsigned NumElts = VT.getVectorNumElements();
+
switch (VT.SimpleTy) {
case MVT::v4i64:
case MVT::v8i32:
@@ -12632,8 +12634,7 @@ static SDValue lowerShuffleAsBlend(const SDLoc &DL, MVT VT, SDValue V1,
return Masked;
if (Subtarget.hasBWI() && Subtarget.hasVLX()) {
- MVT IntegerType =
- MVT::getIntegerVT(std::max((int)VT.getVectorNumElements(), 8));
+ MVT IntegerType = MVT::getIntegerVT(std::max<unsigned>(NumElts, 8));
SDValue MaskNode = DAG.getConstant(BlendMask, DL, IntegerType);
return getVectorMaskingNode(V2, MaskNode, V1, Subtarget, DAG);
}
@@ -12702,8 +12703,7 @@ static SDValue lowerShuffleAsBlend(const SDLoc &DL, MVT VT, SDValue V1,
// Otherwise load an immediate into a GPR, cast to k-register, and use a
// masked move.
- MVT IntegerType =
- MVT::getIntegerVT(std::max((int)VT.getVectorNumElements(), 8));
+ MVT IntegerType = MVT::getIntegerVT(std::max<unsigned>(NumElts, 8));
SDValue MaskNode = DAG.getConstant(BlendMask, DL, IntegerType);
return getVectorMaskingNode(V2, MaskNode, V1, Subtarget, DAG);
}
More information about the llvm-commits
mailing list