Skip to content
This repository was archived by the owner on Apr 23, 2020. It is now read-only.

Commit 2146c5a

Browse files
committed
[X86][SSE] Rename truncateVectorCompareWithPACKSS to truncateVectorWithPACKSS. NFC.
We no longer rely on the vector source being a comparison result, just have sufficient sign bits. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316834 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 3635128 commit 2146c5a

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

lib/Target/X86/X86ISelLowering.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15990,14 +15990,13 @@ static SDValue LowerZERO_EXTEND(SDValue Op, const X86Subtarget &Subtarget,
1599015990
}
1599115991

1599215992
/// Helper to recursively truncate vector elements in half with PACKSS.
15993-
/// It makes use of the fact that vector comparison results will be all-zeros
15994-
/// or all-ones to prevent the PACKSS from saturating the results.
15993+
/// It makes use of the fact that vectors with enough leading sign bits
15994+
/// prevent the PACKSS from saturating the results.
1599515995
/// AVX2 (Int256) sub-targets require extra shuffling as the PACKSS operates
1599615996
/// within each 128-bit lane.
15997-
static SDValue truncateVectorCompareWithPACKSS(EVT DstVT, SDValue In,
15998-
const SDLoc &DL,
15999-
SelectionDAG &DAG,
16000-
const X86Subtarget &Subtarget) {
15997+
static SDValue truncateVectorWithPACKSS(EVT DstVT, SDValue In, const SDLoc &DL,
15998+
SelectionDAG &DAG,
15999+
const X86Subtarget &Subtarget) {
1600116000
// Requires SSE2 but AVX512 has fast truncate.
1600216001
if (!Subtarget.hasSSE2() || Subtarget.hasAVX512())
1600316002
return SDValue();
@@ -16065,18 +16064,18 @@ static SDValue truncateVectorCompareWithPACKSS(EVT DstVT, SDValue In,
1606516064
// If 512bit -> 128bit truncate another stage.
1606616065
EVT PackedVT = EVT::getVectorVT(Ctx, PackedSVT, NumElems);
1606716066
Res = DAG.getBitcast(PackedVT, Res);
16068-
return truncateVectorCompareWithPACKSS(DstVT, Res, DL, DAG, Subtarget);
16067+
return truncateVectorWithPACKSS(DstVT, Res, DL, DAG, Subtarget);
1606916068
}
1607016069

1607116070
// Recursively pack lower/upper subvectors, concat result and pack again.
1607216071
assert(SrcSizeInBits >= 512 && "Expected 512-bit vector or greater");
1607316072
EVT PackedVT = EVT::getVectorVT(Ctx, PackedSVT, NumSubElts);
16074-
Lo = truncateVectorCompareWithPACKSS(PackedVT, Lo, DL, DAG, Subtarget);
16075-
Hi = truncateVectorCompareWithPACKSS(PackedVT, Hi, DL, DAG, Subtarget);
16073+
Lo = truncateVectorWithPACKSS(PackedVT, Lo, DL, DAG, Subtarget);
16074+
Hi = truncateVectorWithPACKSS(PackedVT, Hi, DL, DAG, Subtarget);
1607616075

1607716076
PackedVT = EVT::getVectorVT(Ctx, PackedSVT, NumElems);
1607816077
SDValue Res = DAG.getNode(ISD::CONCAT_VECTORS, DL, PackedVT, Lo, Hi);
16079-
return truncateVectorCompareWithPACKSS(DstVT, Res, DL, DAG, Subtarget);
16078+
return truncateVectorWithPACKSS(DstVT, Res, DL, DAG, Subtarget);
1608016079
}
1608116080

1608216081
static SDValue LowerTruncateVecI1(SDValue Op, SelectionDAG &DAG,
@@ -16140,7 +16139,7 @@ SDValue X86TargetLowering::LowerTRUNCATE(SDValue Op, SelectionDAG &DAG) const {
1614016139

1614116140
// Truncate with PACKSS if we are truncating a vector zero/all-bits result.
1614216141
if (InVT.getScalarSizeInBits() == DAG.ComputeNumSignBits(In))
16143-
if (SDValue V = truncateVectorCompareWithPACKSS(VT, In, DL, DAG, Subtarget))
16142+
if (SDValue V = truncateVectorWithPACKSS(VT, In, DL, DAG, Subtarget))
1614416143
return V;
1614516144

1614616145
if ((VT == MVT::v4i32) && (InVT == MVT::v4i64)) {
@@ -34328,7 +34327,7 @@ static SDValue combineVectorSignBitsTruncation(SDNode *N, SDLoc &DL,
3432834327
if (InSVT != MVT::i16 && InSVT != MVT::i32 && InSVT != MVT::i64)
3432934328
return SDValue();
3433034329

34331-
return truncateVectorCompareWithPACKSS(VT, In, DL, DAG, Subtarget);
34330+
return truncateVectorWithPACKSS(VT, In, DL, DAG, Subtarget);
3433234331
}
3433334332

3433434333
static SDValue combineTruncate(SDNode *N, SelectionDAG &DAG,

0 commit comments

Comments
 (0)