# US 5,838,961 A · Method of operation and apparatus for optimizing execution of short instruction branches

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

- Number: US 5,838,961 A
- Document ID: US5838961A
- Status: Granted
- Kind: A
- Application number: 08/724,198
- Filed: 1996-10-01
- Granted: 1998-11-17
- Earliest claimed: 1996-10-01
- Assignees: CPU Technology, Inc.
- Inventors: Alan G. Smith
- Web page: https://patentgrep.com/patent/US5838961A

## CPC

- G06F 9/30069: {Instruction skipping instructions, e.g. SKIP}
- G06F 9/30058: {Conditional branch instructions}
- G06F 9/324: {using program counter relative addressing}
- G06F 9/3804: {for branches, e.g. hedging, branch folding}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A technique for speeding CPU operations in handling branch instructions in which the target instructions is a short displacement away from its branch instruction is disclosed. When the target instruction is displaced within a predetermined number of instructions away, a logic block and counter issue an invalidating control signal which invalidates the execution of the branch instruction and instructions between the branch instruction and the target instruction. The invalidating control signal is removed when the target instruction is reached. Time is saved if the latency of the computer system is longer than the time required to cycle the instruction queue to the target instruction.

## Claims

### Claim 1

A method of operation in a CPU, said method comprising
fetching a sequence of computer instructions from memory, said sequence including a branch instruction designating a target instruction, said target instruction having a displacement from said branch instruction;
determining whether said displacement is less than a predetermined amount;
invalidating execution of said branch instruction and invalidating instructions between said branch instruction and said target instruction when said displacement is less than said predetermined amount; and
executing said target instruction;
whereby refetching of said target instruction from memory is avoided.

### Claim 2 (depends on 1)

The method of claim 1 wherein said predetermined amount is programmable.

### Claim 3 (depends on 2)

The method of claim 2 wherein said displacement determining step comprises
storing said predetermined value in a register; and
comparing an immediate value in said branch instruction, said immediate value specifying said displacement value of said target instruction from said branch instruction.

### Claim 4 (depends on 1)

The method of claim 1 wherein said predetermined amount is less than nine instructions.

### Claim 5 (depends on 4)

The method of claim 4 wherein said predetermined amount is at least two instructions.

### Claim 6

A CPU in a computer system, said CPU executing a queue of instructions from a memory, said instruction queue including a branch instruction and its target instruction, said branch instruction having a value defining said displacement of said target instruction from said branch instruction, said CPU comprising
a logic block responsive to said branch instruction, said logic block asserting a control signal if said displacement is less than a predetermined amount so that execution of said branch instruction is invalidated;
a counter connected to said logic block for counting the number of instructions between said branch instruction and said target instruction for execution, said logic block responsive to said counter asserting said control signal so that execution of said instructions between said branch instruction and said target instruction is invalidated; and
whereby refetching of said target instruction from said memory is avoided.

### Claim 7 (depends on 6)

The CPU of claim 6 wherein said predetermined amount is programmable.

### Claim 8 (depends on 7)

The CPU of claim 7 further comprising
a programmable register for holding said predetermined value; and
a second register for holding said displacement value from said branch, said programmable and second registers connected to said logic block.

### Claim 9 (depends on 6)

The CPU of claim 6 wherein said predetermined amount is less than nine instructions.

### Claim 10 (depends on 9)

The CPU of claim 9 wherein said predetermined amount is at least two instructions.
