Skip to content

Commit fc33e33

Browse files
committed
[X86] Add more extract subvector cost model tests for smaller element sizes and smaller than 128-bit vectors.
With the switch to widening legalization, we need to a better job of costing extractions of less than 128-bits. llvm-svn: 368081
1 parent b1e4da2 commit fc33e33

File tree

2 files changed

+497
-7
lines changed

2 files changed

+497
-7
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5135,6 +5135,15 @@ unsigned LoopVectorizationCostModel::selectInterleaveCount(unsigned VF,
51355135
else if (IC < 1)
51365136
IC = 1;
51375137

5138+
// If the trip count is constant, clamp the calculated IC to be between 1 and
5139+
// the trip count divided by VF.
5140+
if (TC > 0) {
5141+
if ((TC / VF) < IC)
5142+
IC = (TC / VF);
5143+
if (IC < 1)
5144+
IC = 1;
5145+
}
5146+
51385147
// Interleave if we vectorized this loop and there is a reduction that could
51395148
// benefit from interleaving.
51405149
if (VF > 1 && !Legal->getReductionVars()->empty()) {

0 commit comments

Comments
 (0)