# US 2014/0208085 A1 · Instruction and logic to efficiently monitor loop trip count

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

- Number: US 2014/0208085 A1
- Document ID: US20140208085A1
- Status: Published application
- Kind: A1
- Application number: 13/996,861
- Filed: 2012-03-30
- Published: 2014-07-24
- Earliest claimed: 2012-03-30
- Assignees: Intel Corporation
- Inventors: Jaewoong Chung; Hyunchul Park; Hongbo Rong; Cheng Wang; Youfeng Wu
- Web page: https://patentgrep.com/patent/US20140208085A1

## CPC

- G06F 9/325: {for loops, e.g. loop detection or loop counter}
- G06F 9/30072: {to perform conditional operations, e.g. using predicates or guards}
- G06F 9/3842: {Speculative instruction execution}
- G06F 9/3854: {Instruction completion, e.g. retiring, committing or graduating}
- G06F 9/3858: {Result writeback, i.e. updating the architectural state or memory}
- G06F 11/3409: {for performance assessment}
- G06F 11/348: {Circuit details, i.e. tracer hardware}
- G06F 8/443: {Optimisation}
- G06F 2201/88: Monitoring involving counting
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Logic and instruction to efficiently monitor loop trip count. Loop trip count information of a loop may be stored in a dedicated hardware buffer. Average loop trip count of the loop may be calculated based on the stored loop trip count information. Based on the average trip count, loop optimizations may be applied or removed from the loop. The stored loop trip count information may include an identifier identifying the loop, a total loop trip count of the loop, and an exit count of the loop.

## Claims

### Claim 1

A non-transitory machine-readable medium having stored thereon an instruction, which if performed by a machine causes the machine to perform a method comprising:
storing loop trip count information of a loop in a hardware buffer dedicated to store trip count information;
calculating an average loop trip count of the loop based on the stored loop trip count information; and
at least one of: a) applying at least one loop optimization to the loop based on the average loop trip count and b) removing at least one loop optimization from the loop based on the average loop trip count.

### Claim 2 (depends on 1)

The machine-readable medium of claim 1, wherein the stored loop trip count information includes an identifier identifying the loop, a total loop trip count of the loop, and an exit count of the loop.

### Claim 3 (depends on 1)

The machine-readable medium of claim 1, wherein the method further comprises:
skipping execution of at least a commit instruction in the loop.

### Claim 4 (depends on 1)

The machine-readable medium of claim 1, wherein the method further comprises:
removing the stored loop trip count information upon determining that the average loop trip count is one of: a) above a threshold and b) below a threshold.

### Claim 5 (depends on 1)

The machine-readable medium of claim 1, wherein the at least one loop optimization is applied upon determining that the average loop trip count is above a threshold.

### Claim 6 (depends on 1)

The machine-readable medium of claim 1, wherein the at least one loop optimization is removed upon determining that the average loop trip count is below a threshold.

### Claim 7 (depends on 1)

The machine-readable medium of claim 1, wherein the method further comprises:
upon overflow of the hardware buffer replacing the stored loop trip count information based on a cache algorithm.

### Claim 8

A method comprising:
storing loop trip count information of a loop in a hardware buffer dedicated to store trip count information;
calculating an average loop trip count of the loop based on the stored loop trip count information; and
at least one of: a) applying at least one loop optimization to the loop based on the average loop trip count and b) removing at least one loop optimization from the loop based on the average loop trip count.

### Claim 9 (depends on 8)

The method of claim 8, wherein the stored loop trip count information includes an identifier identifying the loop, a total loop trip count of the loop, and an exit count of the loop.

### Claim 10 (depends on 8)

The method of claim 8, further comprising:
skipping execution of at least a commit instruction in the loop.

### Claim 11 (depends on 8)

The method of claim 8, further comprising:
removing the stored loop trip count information upon determining that the average loop trip count is one of: a) above a threshold and b) below a threshold.

### Claim 12 (depends on 8)

The method of claim 8, wherein the at least one loop optimization is applied upon determining that the average loop trip count is above a threshold.

### Claim 13 (depends on 8)

The method of claim 8, wherein the at least one loop optimization is removed upon determining that the average loop trip count is below a threshold.

### Claim 14 (depends on 8)

The method of claim 8, wherein the method further comprises:
upon overflow of the hardware buffer replacing the stored loop trip count information based on a cache algorithm.

### Claim 15

A system comprising:
a dedicated hardware buffer to store loop trip count information of a loop;
a computer processor to calculate an average loop trip count of the loop based on the stored loop trip count information, and at least one of a) apply at least one loop optimization to the loop based on the average loop trip count and b) remove at least one loop optimization from the loop based on the average loop trip count.

### Claim 16 (depends on 15)

The system of claim 15, wherein the stored loop trip count information includes an identifier identifying the loop, a total loop trip count of the loop, and an exit count of the loop.

### Claim at position 17

17-21. (canceled)

### Claim 22

A system comprising:
a processor for executing computer instructions, the computer instructions comprising:
storing loop trip count information of a loop in a hardware buffer dedicated to store trip count information;
calculating an average loop trip count of the loop based on the stored loop trip count information; and
at least one of: a) applying at least one loop optimization to the loop based on the average loop trip count and b) removing at least one loop optimization from the loop based on the average loop trip count.

### Claim 23 (depends on 22)

The system of claim 22, wherein the stored loop trip count information includes an identifier identifying the loop, a total loop trip count of the loop, and an exit count of the loop.

### Claim 24 (depends on 22)

The system of claim 22, wherein the computer instructions further comprise:
skipping execution of at least a commit instruction in the loop.

### Claim 25 (depends on 22)

The system of claim 22, wherein the computer instructions further comprise:
removing the stored loop trip count information upon determining that the average loop trip count is one of: a) above a threshold and b) below a threshold.

### Claim 26 (depends on 22)

The system of claim 22, wherein the at least one loop optimization is applied upon determining that the average loop trip count is above a threshold.

### Claim 27 (depends on 22)

The system of claim 22, wherein the at least one loop optimization is removed upon determining that the average loop trip count is below a threshold.

### Claim 28 (depends on 22)

The system of claim 22, wherein the computer instructions further comprise:
upon overflow of the hardware buffer replacing the stored loop trip count information based on a cache algorithm.

### Claim 29

A non-transitory machine-readable medium having stored thereon data, which if performed by at least one machine, causes the at least one machine to fabricate at least one integrated circuit to perform a method comprising:
storing loop trip count information of a loop in a hardware buffer dedicated to store trip count information;
calculating an average loop trip count of the loop based on the stored loop trip count information; and
at least one of: a) applying at least one loop optimization to the loop based on the average loop trip count and b) removing at least one loop optimization from the loop based on the average loop trip count.

### Claim 30 (depends on 29)

The machine-readable medium of claim 29, wherein the stored loop trip count information includes an identifier identifying the loop, a total loop trip count of the loop, and an exit count of the loop.

### Claim at position 27

31-35. (canceled)
