Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 63aaa1e

Browse files
committed
[X86] Use is128BitVector/is256BitVector/is512BitVector in place of getSizeInBits == in some places. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251687 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 9c17547 commit 63aaa1e

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

lib/Target/X86/X86ISelLowering.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6975,7 +6975,7 @@ static SDValue lowerVectorShuffleAsBlend(SDLoc DL, MVT VT, SDValue V1,
69756975
// FALLTHROUGH
69766976
case MVT::v16i8:
69776977
case MVT::v32i8: {
6978-
assert((VT.getSizeInBits() == 128 || Subtarget->hasAVX2()) &&
6978+
assert((VT.is128BitVector() || Subtarget->hasAVX2()) &&
69796979
"256-bit byte-blends require AVX2 support!");
69806980

69816981
// Attempt to lower to a bitmask if we can. VPAND is faster than VPBLENDVB.
@@ -7202,7 +7202,7 @@ static SDValue lowerVectorShuffleAsByteRotate(SDLoc DL, MVT VT, SDValue V1,
72027202
DAG.getConstant(Rotation * Scale, DL, MVT::i8)));
72037203
}
72047204

7205-
assert(VT.getSizeInBits() == 128 &&
7205+
assert(VT.is128BitVector() &&
72067206
"Rotate-based lowering only supports 128-bit lowering!");
72077207
assert(Mask.size() <= 16 &&
72087208
"Can shuffle at most 16 bytes in a 128-bit vector!");
@@ -7490,15 +7490,15 @@ static SDValue lowerVectorShuffleAsSpecificZeroOrAnyExtend(
74907490
if (Subtarget->hasSSE41()) {
74917491
// Not worth offseting 128-bit vectors if scale == 2, a pattern using
74927492
// PUNPCK will catch this in a later shuffle match.
7493-
if (Offset && Scale == 2 && VT.getSizeInBits() == 128)
7493+
if (Offset && Scale == 2 && VT.is128BitVector())
74947494
return SDValue();
74957495
MVT ExtVT = MVT::getVectorVT(MVT::getIntegerVT(EltBits * Scale),
74967496
NumElements / Scale);
74977497
InputV = DAG.getNode(X86ISD::VZEXT, DL, ExtVT, ShuffleOffset(InputV));
74987498
return DAG.getBitcast(VT, InputV);
74997499
}
75007500

7501-
assert(VT.getSizeInBits() == 128 && "Only 128-bit vectors can be extended.");
7501+
assert(VT.is128BitVector() && "Only 128-bit vectors can be extended.");
75027502

75037503
// For any extends we can cheat for larger element sizes and use shuffle
75047504
// instructions that can fold with a load and/or copy.
@@ -7528,7 +7528,7 @@ static SDValue lowerVectorShuffleAsSpecificZeroOrAnyExtend(
75287528
// to 64-bits.
75297529
if ((Scale * EltBits) == 64 && EltBits < 32 && Subtarget->hasSSE4A()) {
75307530
assert(NumElements == (int)Mask.size() && "Unexpected shuffle mask size!");
7531-
assert(VT.getSizeInBits() == 128 && "Unexpected vector width!");
7531+
assert(VT.is128BitVector() && "Unexpected vector width!");
75327532

75337533
int LoIdx = Offset * EltBits;
75347534
SDValue Lo = DAG.getNode(ISD::BITCAST, DL, MVT::v2i64,
@@ -9917,7 +9917,7 @@ static SDValue lowerVectorShuffleAsLanePermuteAndBlend(SDLoc DL, MVT VT,
99179917
ArrayRef<int> Mask,
99189918
SelectionDAG &DAG) {
99199919
// FIXME: This should probably be generalized for 512-bit vectors as well.
9920-
assert(VT.getSizeInBits() == 256 && "Only for 256-bit vector shuffles!");
9920+
assert(VT.is256BitVector() && "Only for 256-bit vector shuffles!");
99219921
int LaneSize = Mask.size() / 2;
99229922

99239923
// If there are only inputs from one 128-bit lane, splitting will in fact be
@@ -11120,13 +11120,13 @@ static SDValue lowerVectorShuffle(SDValue Op, const X86Subtarget *Subtarget,
1112011120
}
1112111121

1112211122
// For each vector width, delegate to a specialized lowering routine.
11123-
if (VT.getSizeInBits() == 128)
11123+
if (VT.is128BitVector())
1112411124
return lower128BitVectorShuffle(Op, V1, V2, VT, Subtarget, DAG);
1112511125

11126-
if (VT.getSizeInBits() == 256)
11126+
if (VT.is256BitVector())
1112711127
return lower256BitVectorShuffle(Op, V1, V2, VT, Subtarget, DAG);
1112811128

11129-
if (VT.getSizeInBits() == 512)
11129+
if (VT.is512BitVector())
1113011130
return lower512BitVectorShuffle(Op, V1, V2, VT, Subtarget, DAG);
1113111131

1113211132
if (Is1BitVector)
@@ -18777,10 +18777,10 @@ static SDValue LowerRotate(SDValue Op, const X86Subtarget *Subtarget,
1877718777
// +ve/-ve Amt = rotate left/right.
1877818778

1877918779
// Split 256-bit integers.
18780-
if (VT.getSizeInBits() == 256)
18780+
if (VT.is256BitVector())
1878118781
return Lower256IntArith(Op, DAG);
1878218782

18783-
assert(VT.getSizeInBits() == 128 && "Only rotate 128-bit vectors!");
18783+
assert(VT.is128BitVector() && "Only rotate 128-bit vectors!");
1878418784

1878518785
// Attempt to rotate by immediate.
1878618786
if (auto *BVAmt = dyn_cast<BuildVectorSDNode>(Amt)) {
@@ -22234,7 +22234,7 @@ static bool combineX86ShuffleChain(SDValue Op, SDValue Root, ArrayRef<int> Mask,
2223422234
// doesn't preclude something switching to the shorter encoding post-RA.
2223522235
//
2223622236
// FIXME: Should teach these routines about AVX vector widths.
22237-
if (FloatDomain && VT.getSizeInBits() == 128) {
22237+
if (FloatDomain && VT.is128BitVector()) {
2223822238
if (Mask.equals({0, 0}) || Mask.equals({1, 1})) {
2223922239
bool Lo = Mask.equals({0, 0});
2224022240
unsigned Shuffle;
@@ -22298,7 +22298,7 @@ static bool combineX86ShuffleChain(SDValue Op, SDValue Root, ArrayRef<int> Mask,
2229822298
// We always canonicalize the 8 x i16 and 16 x i8 shuffles into their UNPCK
2229922299
// variants as none of these have single-instruction variants that are
2230022300
// superior to the UNPCK formulation.
22301-
if (!FloatDomain && VT.getSizeInBits() == 128 &&
22301+
if (!FloatDomain && VT.is128BitVector() &&
2230222302
(Mask.equals({0, 0, 1, 1, 2, 2, 3, 3}) ||
2230322303
Mask.equals({4, 4, 5, 5, 6, 6, 7, 7}) ||
2230422304
Mask.equals({0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7}) ||
@@ -23819,11 +23819,10 @@ static SDValue PerformSELECTCombine(SDNode *N, SelectionDAG &DAG,
2381923819
if (VT.getScalarType() == MVT::i16)
2382023820
return SDValue();
2382123821
// Dynamic blending was only available from SSE4.1 onward.
23822-
if (VT.getSizeInBits() == 128 && !Subtarget->hasSSE41())
23822+
if (VT.is128BitVector() && !Subtarget->hasSSE41())
2382323823
return SDValue();
2382423824
// Byte blends are only available in AVX2
23825-
if (VT.getSizeInBits() == 256 && VT.getScalarType() == MVT::i8 &&
23826-
!Subtarget->hasAVX2())
23825+
if (VT == MVT::v32i8 && !Subtarget->hasAVX2())
2382723826
return SDValue();
2382823827

2382923828
assert(BitWidth >= 8 && BitWidth <= 64 && "Invalid mask size");
@@ -26024,7 +26023,7 @@ static SDValue PerformSExtCombine(SDNode *N, SelectionDAG &DAG,
2602426023
}
2602526024
}
2602626025

26027-
if (Subtarget->hasAVX() && VT.isVector() && VT.getSizeInBits() == 256)
26026+
if (Subtarget->hasAVX() && VT.is256BitVector())
2602826027
if (SDValue R = WidenMaskArithmetic(N, DAG, DCI, Subtarget))
2602926028
return R;
2603026029

0 commit comments

Comments
 (0)