[llvm] 846c614 - [X86] combineExtractWithShuffle - pull out repeated getSizeInBits() call. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 13 08:38:46 PDT 2020
Author: Simon Pilgrim
Date: 2020-03-13T15:36:04Z
New Revision: 846c614f54a55dff48025453cad2387816a8e10d
URL: https://github.com/llvm/llvm-project/commit/846c614f54a55dff48025453cad2387816a8e10d
DIFF: https://github.com/llvm/llvm-project/commit/846c614f54a55dff48025453cad2387816a8e10d.diff
LOG: [X86] combineExtractWithShuffle - pull out repeated getSizeInBits() call. 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 e602d8707430..caee2a4fb75d 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -37847,6 +37847,7 @@ static SDValue combineExtractWithShuffle(SDNode *N, SelectionDAG &DAG,
EVT VT = N->getValueType(0);
EVT SrcVT = Src.getValueType();
EVT SrcSVT = SrcVT.getVectorElementType();
+ unsigned SrcEltBits = SrcSVT.getSizeInBits();
unsigned NumSrcElts = SrcVT.getVectorNumElements();
// Don't attempt this for boolean mask vectors or unknown extraction indices.
@@ -37867,9 +37868,9 @@ static SDValue combineExtractWithShuffle(SDNode *N, SelectionDAG &DAG,
EVT SrcOpVT = SrcOp.getValueType();
if (SrcOpVT.isScalarInteger() && VT.isInteger() &&
- (SrcOpVT.getSizeInBits() % SrcSVT.getSizeInBits()) == 0) {
- unsigned Scale = SrcOpVT.getSizeInBits() / SrcSVT.getSizeInBits();
- unsigned Offset = IdxC.urem(Scale) * SrcSVT.getSizeInBits();
+ (SrcOpVT.getSizeInBits() % SrcEltBits) == 0) {
+ unsigned Scale = SrcOpVT.getSizeInBits() / SrcEltBits;
+ unsigned Offset = IdxC.urem(Scale) * SrcEltBits;
// TODO support non-zero offsets.
if (Offset == 0) {
SrcOp = DAG.getZExtOrTrunc(SrcOp, dl, SrcVT.getScalarType());
@@ -37900,10 +37901,10 @@ static SDValue combineExtractWithShuffle(SDNode *N, SelectionDAG &DAG,
// TODO: Move to DAGCombine?
if (SrcBC.getOpcode() == ISD::SCALAR_TO_VECTOR && VT.isInteger() &&
SrcBC.getValueType().isInteger() &&
- (SrcBC.getScalarValueSizeInBits() % SrcSVT.getSizeInBits()) == 0 &&
+ (SrcBC.getScalarValueSizeInBits() % SrcEltBits) == 0 &&
SrcBC.getScalarValueSizeInBits() ==
SrcBC.getOperand(0).getValueSizeInBits()) {
- unsigned Scale = SrcBC.getScalarValueSizeInBits() / SrcSVT.getSizeInBits();
+ unsigned Scale = SrcBC.getScalarValueSizeInBits() / SrcEltBits;
if (IdxC.ult(Scale)) {
unsigned Offset = IdxC.getZExtValue() * SrcVT.getScalarSizeInBits();
SDValue Scl = SrcBC.getOperand(0);
@@ -37996,8 +37997,7 @@ static SDValue combineExtractWithShuffle(SDNode *N, SelectionDAG &DAG,
if ((SrcVT == MVT::v8i16 && Subtarget.hasSSE2()) ||
(SrcVT == MVT::v16i8 && Subtarget.hasSSE41())) {
- assert(VT.getSizeInBits() >= SrcSVT.getSizeInBits() &&
- "Unexpected extraction type");
+ assert(VT.getSizeInBits() >= SrcEltBits && "Unexpected extraction type");
unsigned OpCode = (SrcVT == MVT::v8i16 ? X86ISD::PEXTRW : X86ISD::PEXTRB);
SrcOp = DAG.getBitcast(SrcVT, SrcOp);
SDValue ExtOp = DAG.getNode(OpCode, dl, MVT::i32, SrcOp,
More information about the llvm-commits
mailing list