IP Library Granted Patent US 9,092,225
Granted Patent B2
US 9,092,225 · App. 13/362,720 · Granted Jul 28, 2015

Systems and methods for reducing branch misprediction penalty

View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,092,225
App. No.
13/362,720
Granted
Jul 28, 2015
Kind
B2
Abstract

In a processing system capable of single and multi-thread execution, a branch prediction unit can be configured to detect hard to predict branches and loop instructions. In a dual-threading (simultaneous multi-threading) configuration, one instruction queues (IQ) is used for each thread and instructions are alternately sent from each IQ to decode units. In single thread mode, the second IQ can be used to store the “not predicted path” of the hard-to-predict branch or the “fall-through” path of the loop. On mis-prediction, the mis-prediction penalty is reduced by getting the instructions from IQ instead of instruction cache.

Claims (71)

1. In a data processing system having an instruction fetch unit, a decode unit, and a branch execution unit, the instruction fetch unit being coupled to a branch target buffer (BTB), and having a first instruction queue for providing instructions to the decode unit, and a second instruction queue for providing instructions to the decode unit, the decode unit issuing instructions for execution, a method comprising:

in single thread mode:

providing a first instruction address to the instruction fetch unit;

fetching a first instruction from the first instruction address and storing the first instruction in the first instruction queue;

determining whether the first instruction address hits in the BTB;

in response to determining that the first instruction address hits in the BTB, using an entry in the BTB which resulted in the hit to determine whether the first instruction is a conditional branch and whether it is predicted as a taken branch or a non-taken branch;

in response to determining that the first instruction is a conditional branch and predicted as a taken branch:

providing a target address from the entry in the BTB to the instruction fetch unit;

fetching a second instruction from the target address and storing the second instruction in the first instruction queue; and

fetching one or more sequential instructions which are sequential to the first instruction and storing the one or more sequential instructions in the second instruction queue; and

in response to determining that the first instruction is a conditional branch and predicted as a non-taken branch:

providing the target address from the entry in the BTB to the instruction fetch unit;

fetching a third instruction fetched from the target address and storing the third instruction in the second instruction queue;

providing a sequential address to the first instruction to the instruction fetch unit; and

storing a fourth instruction fetched from the sequential address in the first instruction queue;

providing the first instruction from the first instruction queue to the decode unit; and

issuing the first instruction from the decode unit for execution, wherein

the branch execution unit resolves the first instruction to determine if the prediction made using the entry in the BTB is correct or mispredicted, and

if the first instruction is a conditional branch, providing an identifier with the first instruction to the decode unit and the branch execution unit, wherein the identifier identifies a location in the second instruction queue of one or more instructions which are to be executed if the first instruction is mispredicted.

2. The method of claim 1 , wherein: if the first instruction is a conditional branch and predicted as a taken branch, the identifier identifies a location in the second instruction queue of the one or more sequential instructions; and if the first instruction is a conditional branch and predicted as a not-taken branch, the identifier identifies a location in the second instruction queue of the fourth instruction.

3. The method of claim 1 , further comprising: if the branch execution unit determines that the first instruction is mispredicted, using the identifier to provide the one or more instructions from the second instruction queue to the decode unit for execution.

4. The method of claim 3 , further comprising:

if the branch execution unit determines that the first instruction is predicted correctly, invalidating the one or more instructions in the second instruction queue indicated by the identifier.

5. Them method of claim 4 , further comprising:

if the branch execution unit determines that the first instruction is predicted correctly, invalidating the identifier.

6. The method of claim 1 , wherein the conditional branch is further characterized as one of a hard-to-predict branch or a loop instruction.

7. The method of claim 6 , wherein the first instruction is determined to be a conditional branch that is characterized as one of a hard-to-predict branch or a loop instruction based on the entry in the BTB which resulted in the hit.

8. The method of claim 1 , further comprising:

in response to determining that the first instruction misses in the BTB, fetching one or more sequential instructions which are sequential to the first instruction and storing the one or more sequential instruction in the first instruction queue.

9. A data processing system, comprising:

a branch execution unit;

a decode unit coupled to the branch execution unit, the decode unit issuing instructions for execution;

an instruction fetch unit coupled to a branch target buffer (BTB), the instruction fetch unit having a first instruction queue for providing instructions to the decode unit, and a second instruction queue for providing instructions to the decode unit, wherein during single thread mode, the instruction fetch unit:

fetches a first instruction from a first instruction address and stores the first instruction in the first instruction queue;

determines whether the first instruction address hits in the BTB, and in response to determining that the first instruction address hits in the BTB, using an entry in the BTB which resulted in the hit to determine whether the first instruction is a conditional branch and whether it is predicted as a taken branch or a non-taken branch;

in response to determining that the first instruction is a conditional branch and predicted as a taken branch:

obtaining a target address from the entry in the BTB;

fetching a second instruction from the target address and storing the second instruction in the first instruction queue; and

fetching one or more sequential instructions which are sequential to the first instruction and storing the one or more sequential instruction in the second instruction queue; and

in response to determining that the first instruction is a conditional branch and predicted as a non-taken branch:

obtaining the target address from the entry in the BTB;

fetching the second instruction from the target address and storing the second instruction in the second instruction queue;

fetching a third instruction from a sequential address that is sequential to the first instruction address; and

storing the third instruction in the first instruction queue,

wherein:

the instruction fetch unit provides the first instruction from the first instruction queue to the decode unit; and

the decode unit issues the first instruction for execution, wherein the branch execution unit resolves the first instruction to determine if the prediction made using the entry in the BTB is correct or mispredicted; and

storage circuitry, wherein when the instruction fetch unit determines that the first instruction is a conditional branch, an identifier is stored in the storage circuitry to identify a location in the second instruction queue of one or more instructions which are to be executed if the first instruction is resolved as mispredicted.

10. The data processing system of claim 9 , wherein: if the branch execution unit determines that the first instruction is mispredicted, the instruction fetch unit uses the identifier to provide the one or more instructions from the second instruction queue to the decode unit for execution; and if the branch execution unit determines that the first instruction is predicted correctly, the instruction fetch unit uses the identifier to invalidate the one or more instructions in the second instruction queue.

11. The data processing system of claim 9 , wherein the conditional branch is further characterized as one of a hard-to-predict branch or a loop instruction, wherein the instruction fetch unit uses the entry in the BTB which resulted in the hit to characterize the conditional branch as one of a hard-to-predict branch or a loop instruction.

12. In a data processing system having an instruction fetch unit, a decode unit, and a branch execution unit, the instruction fetch unit having a branch target buffer (BTB), a first instruction queue for providing instructions to the decode unit, and a second instruction queue for providing instructions to the decode unit, the decode unit issuing instructions for execution, a method comprising:

in single thread mode:

providing a first instruction address to the instruction fetch unit;

fetching a first instruction from the first instruction address and storing the first instruction in the first instruction queue;

determining whether the first instruction address hits in the BTB;

in response to determining that the first instruction address hits in the BTB:

using an entry in the BTB which resulted in the hit to determine whether the first instruction is predicted as a taken branch or a non-taken branch, and

determining whether the first instruction is a hard-to-predict branch;

in response to determining that the first instruction is predicted as a taken branch and is a hard-to-predict branch:

providing a target address from the entry in the BTB to the instruction fetch unit;

fetching a second instruction from the target address and storing the second instruction in the first instruction queue; and

fetching one or more sequential instructions which are sequential to the first instruction and storing the one or more sequential instruction in the second instruction queue; and

in response to determining that the branch instruction is predicted as a non-taken branch and is a hard-to-predict branch:

providing the target address from the entry in the BTB to the instruction fetch unit;

fetching a third instruction fetched from the target address and storing the third instruction in the second instruction queue;

providing a sequential address to the first instruction to the instruction fetch unit; and

storing a fourth instruction fetched from the sequential address in the first instruction queue;

providing the first instruction from the first instruction queue to the decode unit, and if the first instruction is a hard-to-predict branch, providing an identifier with the first instruction to the decode unit and the branch execution unit, wherein the identifier identifies a location in the second instruction queue of one or more instructions which are to be executed if the first instruction is mispredicted; and

issuing the first instruction from the decode unit for execution, wherein the branch execution unit resolves the first instruction to determine if the prediction made using the entry in the BTB is correct or mispredicted.

13. The method of claim 12 , wherein: if the first instruction is a hard-to-predict branch and predicted as a taken branch, the identifier identifies a location in the second instruction queue of the one or more sequential instructions; and if the first instruction is a hard-to-predict branch and predicted as a not-taken branch, the identifier identifies a location in the second instruction queue of the fourth instruction.

14. The method of claim 12 , further comprising: if the branch execution unit determines that the first instruction is mispredicted, using the identifier to provide the one or more instructions from the second instruction queue to the decode unit for execution; and if the branch execution unit determines that the first instruction is predicted correctly, invalidating the one or more instructions in the second instruction queue indicated by the identifier.

Assignments (22)
CORRECTIVE ASSIGNMENT TO CORRECT THE REMOVE APPLICATION 11759915 AND REPLACE IT WITH APPLICATION 11759935 PREVIOUSLY RECORDED ON REEL 040925 FRAME 0001. ASSIGNOR(S) HEREBY CONFIRMS THE RELEASE OF SECURITY INTEREST. Recorded Feb 17, 2020
From: MORGAN STANLEY SENIOR FUNDING, INC.
To: NXP, B.V. F/K/A FREESCALE SEMICONDUCTOR, INC.
Reel/Frame 052917/0001 →
CORRECTIVE ASSIGNMENT TO CORRECT THE REMOVE APPLICATION 11759915 AND REPLACE IT WITH APPLICATION 11759935 PREVIOUSLY RECORDED ON REEL 040928 FRAME 0001. ASSIGNOR(S) HEREBY CONFIRMS THE RELEASE OF SECURITY INTEREST. Recorded Jan 17, 2020
From: MORGAN STANLEY SENIOR FUNDING, INC.
To: NXP B.V.
Reel/Frame 052915/0001 →
CORRECTIVE ASSIGNMENT TO CORRECT THE REMOVE APPLICATION 11759915 AND REPLACE IT WITH APPLICATION 11759935 PREVIOUSLY RECORDED ON REEL 037486 FRAME 0517. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT AND ASSUMPTION OF SECURITY INTEREST IN PATENTS. Recorded Dec 10, 2019
From: CITIBANK, N.A.
To: MORGAN STANLEY SENIOR FUNDING, INC.
Reel/Frame 053547/0421 →
RELEASE OF SECURITY INTEREST Recorded Sep 10, 2019
From: MORGAN STANLEY SENIOR FUNDING, INC.
To: NXP B.V.
Reel/Frame 050744/0097 →
CORRECTIVE ASSIGNMENT TO CORRECT THE TO CORRECT THE APPLICATION NO. FROM 13,883,290 TO 13,833,290 PREVIOUSLY RECORDED ON REEL 041703 FRAME 0536. ASSIGNOR(S) HEREBY CONFIRMS THE THE ASSIGNMENT AND ASSUMPTION OF SECURITY INTEREST IN PATENTS.. Recorded Feb 20, 2019
From: MORGAN STANLEY SENIOR FUNDING, INC.
To: SHENZHEN XINGUODU TECHNOLOGY CO., LTD.
Reel/Frame 048734/0001 →
CORRECTIVE ASSIGNMENT TO CORRECT THE REMOVE PATENTS 8108266 AND 8062324 AND REPLACE THEM WITH 6108266 AND 8060324 PREVIOUSLY RECORDED ON REEL 037518 FRAME 0292. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT AND ASSUMPTION OF SECURITY INTEREST IN PATENTS. Recorded Feb 1, 2017
From: CITIBANK, N.A.
To: MORGAN STANLEY SENIOR FUNDING, INC.
Reel/Frame 041703/0536 →
CORRECTIVE ASSIGNMENT TO CORRECT THE NATURE OF CONVEYANCE PREVIOUSLY RECORDED AT REEL: 040652 FRAME: 0241. ASSIGNOR(S) HEREBY CONFIRMS THE MERGER AND CHANGE OF NAME. Recorded Jan 5, 2017
From: FREESCALE SEMICONDUCTOR, INC.
To: NXP USA, INC.
Reel/Frame 041260/0850 →
MERGER Recorded Nov 8, 2016
From: FREESCALE SEMICONDUCTOR, INC.
To: NXP USA, INC.
Reel/Frame 040652/0241 →
RELEASE OF SECURITY INTEREST Recorded Nov 7, 2016
From: MORGAN STANLEY SENIOR FUNDING, INC.
To: NXP B.V.
Reel/Frame 040928/0001 →
RELEASE OF SECURITY INTEREST Recorded Sep 21, 2016
From: MORGAN STANLEY SENIOR FUNDING, INC.
To: NXP, B.V., F/K/A FREESCALE SEMICONDUCTOR, INC.
Reel/Frame 040925/0001 →
SUPPLEMENT TO THE SECURITY AGREEMENT Recorded Jun 16, 2016
From: FREESCALE SEMICONDUCTOR, INC.
To: MORGAN STANLEY SENIOR FUNDING, INC.
Reel/Frame 039138/0001 →
ASSIGNMENT AND ASSUMPTION OF SECURITY INTEREST IN PATENTS Recorded Jan 13, 2016
From: CITIBANK, N.A.
To: MORGAN STANLEY SENIOR FUNDING, INC.
Reel/Frame 037518/0292 →
ASSIGNMENT AND ASSUMPTION OF SECURITY INTEREST IN PATENTS Recorded Jan 12, 2016
From: CITIBANK, N.A.
To: MORGAN STANLEY SENIOR FUNDING, INC.
Reel/Frame 037486/0517 →
PATENT RELEASE Recorded Dec 21, 2015
From: CITIBANK, N.A., AS COLLATERAL AGENT
To: FREESCALE SEMICONDUCTOR, INC.
Reel/Frame 037357/0455 →
PATENT RELEASE Recorded Dec 21, 2015
From: CITIBANK, N.A., AS COLLATERAL AGENT
To: FREESCALE SEMICONDUCTOR, INC.
Reel/Frame 037357/0476 →
PATENT RELEASE Recorded Dec 21, 2015
From: CITIBANK, N.A., AS COLLATERAL AGENT
To: FREESCALE SEMICONDUCTOR, INC.
Reel/Frame 037357/0521 →
SECURITY AGREEMENT Recorded Nov 6, 2013
From: FREESCALE SEMICONDUCTOR, INC.
To: CITIBANK, N.A., AS NOTES COLLATERAL AGENT
Reel/Frame 031591/0266 →
SECURITY AGREEMENT Recorded Jun 18, 2013
From: FREESCALE SEMICONDUCTOR, INC.
To: CITIBANK, N.A., AS NOTES COLLATERAL AGENT
Reel/Frame 030633/0424 →
SUPPLEMENT TO IP SECURITY AGREEMENT Recorded Apr 20, 2013
From: FREESCALE SEMICONDUCTOR, INC.
To: CITIBANK, N.A., AS NOTES COLLATERAL AGENT
Reel/Frame 030256/0582 →
SUPPLEMENT TO IP SECURITY AGREEMENT Recorded Apr 20, 2013
From: FREESCALE SEMICONDUCTOR, INC.
To: CITIBANK, N.A., AS COLLATERAL AGENT
Reel/Frame 030256/0670 →
SUPPLEMENT TO IP SECURITY AGREEMENT Recorded Apr 20, 2013
From: FREESCALE SEMICONDUCTOR, INC.
To: CITIBANK, N.A., AS NOTES COLLATERAL AGENT
Reel/Frame 030256/0655 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 31, 2012
From: TRAN, THANG M.; SCHINZLER, MICHAEL B.
To: FREESCALE SEMICONDUCTOR, INC.
Reel/Frame 027627/0903 →