Patent ID: 7493480

Claim:
A method for prefetching instructions, the method comprising: prefetching branch history table (BHT) entries from an L2 BHT to an L1 BHT; and prefetching cache lines identified by the BHT entries from a L2 cache to a L1 cache, wherein the prefetching of the BHT entries comprises: the L2 BHT receiving an initial prefetch address from the L1 BHT; and in response to the initial prefetch address, identifying a cache line address from the initial prefetch address; identifying first L2 BHT entries in the L2 BHT that have branch addresses that match the cache line address; transferring the first L2 BHT entries to the L1 BHT; identifying nearest cache line addresses from target addresses of the first L2 BHT entries, wherein the nearest cache line addresses are within a predefined linking distance from the initial prefetch address, the linking distance representing the number of links between a nearest cache line address and the initial prefetch address; identifying second L2 BHT entries in the L2 BHT that have branch addresses that match the identified nearest cache line addresses; and transferring the second L2 BHT entries to the L1 BHT, wherein the linking distance is fetched each time the prefetching of the BHT entries is performed and the linking distance is greater than one.