# US 2022/0283819 A1 · Processor branch prediction circuit employing back-invalidation of prediction cache entries based on decoded branch instructions and related methods

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2022/0283819 A1
- Document ID: US20220283819A1
- Status: Published application
- Kind: A1
- Application number: 17/192,583
- Filed: 2021-03-04
- Published: 2022-09-08
- Earliest claimed: 2021-03-04
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Daren E. STREETT; Rami Mohammad AL SHEIKH; Michael Scott MCILVAINE; Richard W. DOING; Robert Douglas CLANCY
- Web page: https://patentgrep.com/patent/US20220283819A1

## CPC

- G06F 9/3806: {using address prediction, e.g. return stack, branch history buffer}
- G06F 9/3844: {using dynamic branch prediction, e.g. using branch history tables}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A processor branch prediction circuit employs back-invalidation of prediction cache entries based on decoded branch instructions. The execution information of a previously executed branch instruction is obtained from a prediction cache entry and compared to generated decode information in an instruction decode circuit. Execution information of branch instructions stored in the prediction cache entry is updated in response to a mismatch of the execution information and the decode information of the branch instruction. Existing branch prediction circuits invalidate prediction cache entries of a block of instructions when the block of instructions is invalidated in an instruction cache. As a result, valid branch instruction execution information may be unnecessarily discarded. Updating prediction cache entries in response to a mismatch of the execution information and the decode information of the branch instruction maintains the execution information in the prediction cache.

## Claims

### Claim 1

A processor circuit configured to execute instructions, the processor circuit comprising hardware comprising:
a hardware branch prediction circuit configured to:
generate a memory address of a branch instruction;
obtain execution information of the branch instruction from a first entry in a prediction cache based on the memory address; and
store the execution information of the branch instruction in a fetch queue;
an instruction fetch circuit configured to fetch the branch instruction based on the memory address; and
store the execution information of the branch instruction; and
an instruction decode circuit configured to generate decode information of the branch instruction;
wherein the hardware branch prediction circuit is further configured to update the first entry in the prediction cache based on the decode information of the branch instruction mismatching the execution information stored in the fetch queue.

### Claim 2 (depends on 1)

The processor circuit of claim 1, wherein the hardware branch prediction circuit is further configured to:
determine that the first entry in the prediction cache does not comprise the execution information of the branch instruction; and
determine that a first target address of a first target instruction of the branch instruction is a next sequential address following the branch instruction.

### Claim 3 (depends on 2)

The processor circuit of claim 2, further comprising an execution circuit configured to generate the execution information of the branch instruction, wherein the execution information of the branch instruction comprises a second target address of a second target instruction of the branch instruction.

### Claim 4 (depends on 3)

The processor circuit of claim 3, wherein the hardware branch prediction circuit is further configured to store the execution information of the branch instruction in the first entry in the prediction cache.

### Claim 5 (depends on 1)

The processor circuit of claim 1, wherein:
the hardware branch prediction circuit is further configured to determine that the first entry in the prediction cache comprises the execution information of the branch instruction; and
the instruction fetch circuit is further configured to provide the execution information of the branch instruction to the instruction decode circuit.

### Claim 6 (depends on 5)

The processor circuit of claim 5, wherein the instruction decode circuit is further configured to:
compare the execution information of the branch instruction to the decode information of the branch instruction; and
generate a mismatch indication indicating that the decode information of the branch instruction does not match the execution information of the branch instruction.

### Claim 7 (depends on 6)

The processor circuit of claim 6, wherein the instruction decode circuit is further configured to generate the mismatch indication in response to a mismatch between a first instruction type in the execution information of the branch instruction and a second instruction type in the decode information of the branch instruction.

### Claim 8 (depends on 6)

The processor circuit of claim 6, wherein the instruction decode circuit is further configured to generate the mismatch indication in response to a mismatch between a first size in the execution information of the branch instruction and a second size in the decode information of the branch instruction.

### Claim 9 (depends on 6)

The processor circuit of claim 6, the hardware branch prediction circuit further configured to update the first entry in response to the mismatch indication indicating the decode information of the branch instruction does not match the execution information of the branch instruction, wherein updating the first entry comprises indicating that the execution information of the branch instruction is invalid.

### Claim 10 (depends on 9)

The processor circuit of claim 9, wherein updating the first entry comprises indicating the first entry is invalid.

### Claim 11 (depends on 1)

The processor circuit of claim 1, wherein:
the first entry in the prediction cache comprises execution information of branch instructions in a block of instructions including the branch instruction; and
the hardware branch prediction circuit is further configured to, in response to the block of instructions corresponding to the first entry being invalidated in an instruction cache, maintain the first entry in the prediction cache to indicate that the execution information of the branch instruction is valid.

### Claim 12

An integrated circuit comprising a processor circuit configured to execute instructions, the processor circuit comprising:
a hardware branch prediction circuit configured to:
generate a memory address of a branch instruction;
obtain execution information of the branch instruction from a first entry in a prediction cache based on the memory address; and
store the execution information of the branch instruction in a fetch queue;
an instruction fetch circuit configured to fetch the branch instruction based on the memory address; and
an instruction decode circuit configured to generate decode information of the branch instruction;
wherein the hardware branch prediction circuit is further configured to update the first entry in the prediction cache based on the decode information of the branch instruction mismatching the execution information stored in the fetch queue.

### Claim 13

A method in a processor circuit, the method comprising:
generating a memory address of a branch instruction;
obtaining execution information of the branch instruction from a first entry in a prediction cache based on the memory address;
storing the execution information of the branch instruction in a fetch queue;
fetching the branch instruction based on the memory address of the branch instruction;
generating decode information of the branch instruction; and
updating the first entry in the prediction cache based on the decode information of the branch instruction mismatching the execution information stored in the fetch queue.

### Claim 14 (depends on 13)

The method of claim 13, further comprising:
determining that the first entry in the prediction cache comprises the execution information of the branch instruction; and
providing the execution information of the branch instruction to an instruction decode circuit.

### Claim 15 (depends on 14)

The method of claim 14, further comprising:
comparing the execution information of the branch instruction to the decode information of the branch instruction; and
generating a mismatch indication indicating that the decode information of the branch instruction does not match the execution information of the branch instruction.

### Claim 16 (depends on 15)

The method of claim 15, further comprising:
updating the first entry in the prediction cache to indicate the execution information in the first entry is invalid in response to the mismatch indication.

### Claim 17 (depends on 16)

The method of claim 16, further comprising generating the mismatch indication in response to a mismatch between a first instruction type in the execution information of the branch instruction and a second instruction type in the decode information of the branch instruction.

### Claim 18 (depends on 16)

The method of claim 16, further comprising generating the mismatch indication in response to a mismatch between a first size of the branch instruction in the execution information of the branch instruction and a second size of the branch instruction in the decode information.

### Claim 19 (depends on 16)

The method of claim 16, wherein updating the first entry comprises indicating that a portion of the first entry is invalid.

### Claim 20 (depends on 14)

The method of claim 14, further comprising:
in response to a block of instructions being invalidated in an instruction cache, maintaining the first entry in the prediction cache to indicate that the execution information in the first entry is valid;
wherein the first entry in the prediction cache comprises execution information of branch instructions in the block of instructions.
