Patent ID: 8261049

Claim:
A method comprising: receiving (i) an address of a branch instruction from a program counter and (ii) a thread tag identifying a thread associated with the branch instruction; selecting a branch indexing scheme from a plurality of branch indexing schemes, wherein said selecting the branch indexing scheme further comprises if two active threads reside in separate code spaces, selecting a first branch indexing scheme from the plurality of branch indexing schemes, wherein the two active threads includes a thread associated with the branch instruction, if the two active threads reside in a same code space, selecting a second branch indexing scheme from the plurality of branch indexing schemes, and if the two active threads share a same branch instruction, selecting a third branch indexing scheme from the plurality of branch indexing schemes, wherein each branch indexing scheme of the plurality of branch indexing schemes indicates (i) a corresponding section of the address and (ii) a corresponding section of the thread tag; and generating a branch prediction index based at least in part on the selected branch indexing scheme, the thread tag and the address, wherein said generating the branch prediction index comprises selecting (i) a section of the address corresponding to the selected branch indexing scheme and (ii) a section of the thread tag corresponding to the selected branch indexing scheme.