An apparatus in a microprocessor for selectively retiring a prefetched cache
line
is disclosed. In a first embodiment, a first count of the number of accesses to
the prefetched cache line and N second counts of the number of accesses to N lines
of a replacement candidate set of the cache selected by the prefetched cache line
address are maintained. When another prefetch is requested, if the first count
is greater than the smaller of the N second counts, the candidate prefetched cache
line is retired into the cache; otherwise the prefetched cache line is discarded.
In a second embodiment, a count of accesses to the replacement candidate line is
maintained. When another prefetch is requested, if the count is greater than a
programmable threshold value, the candidate prefetched cache line is retired into
the cache; otherwise the prefetched cache line is discarded.