# US 2021/0342154 A1 · Compression Assist Instructions

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

- Number: US 2021/0342154 A1
- Document ID: US20210342154A1
- Status: Published application
- Kind: A1
- Application number: 17/373,144
- Filed: 2021-07-12
- Published: 2021-11-04
- Earliest claimed: 2019-09-10
- Assignees: Apple Inc.
- Applicants: Apple Inc.
- Inventors: Eric Bainville; Ali Sazegari
- Web page: https://patentgrep.com/patent/US20210342154A1

## CPC

- G06F 9/30145: {Instruction analysis, e.g. decoding, instruction word fields}
- G06F 9/30018: {Bit or string instructions}
- G06F 9/30036: {Instructions to perform operations on packed data, e.g. vector, tile or matrix operations}
- G06F 9/30038: {using a mask}
- G06F 9/3004: {to perform operations on memory}
- G06F 9/30098: {Register arrangements}
- H03M 7/3059: {Digital compression and data reduction techniques where the original information is represented by a subset or similar information, e.g. lossy compression}
- H03M 7/3082: {Vector coding (for television signals, see H04N19/94)}
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H03M: CODING; DECODING; CODE CONVERSION IN GENERAL (using fluidic means F15C4/00; optical analogue/digital converters G02F7/00; coding, decoding or code conversion, specially adapted for particular applications, see the relevant subclasses, e.g. G01D, G01R, G06F, G06T, G09G, G10L, G11B, G11C, H04B, H04L, H04M, H04N; ciphering or deciphering for cryptography or other purposes involving the need for secrecy G09C)
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

In an embodiment, a processor supports one or more compression assist instructions which may be employed in compression software to improve the performance of the processor when performing compression/decompression. That is, the compression/decompression task may be performed more rapidly and consume less power when the compression assist instructions are employed then when they are not. In some cases, the cost of a more effective, more complex compression algorithm may be reduced to the cost of a less effective, less complex compression algorithm.

## Claims

### Claim 1

A processor comprising:
a register file comprising a plurality of vector registers; and
an execution core coupled to the register file, wherein the execution core is configured to execute a first instruction specifying a first vector operand, a second operand, and a result vector operand, wherein the first vector operand is in a first vector register of the plurality of vector registers, the second operand is in a second register, and the result vector operand is to be written to a third vector register of the plurality of vector registers, wherein the execution core comprises:
a plurality of shift circuits configured to shift a plurality of variable-sized bit fields from the second operand to vector element positions based on a plurality of vector elements in the first vector operand; and
a plurality of mask circuits coupled to respective ones of the plurality of shift circuits and configured to mask the plurality of variable-sized bit fields based on the plurality of vector elements, resulting in a plurality of extracted variable-sized bit fields in the vector element positions; and
wherein the execution core is configured to write the plurality of extracted variable-sized bit fields as corresponding vector elements in the result vector operand.

### Claim 2 (depends on 1)

The processor as recited in claim 1 wherein the execution core further comprises an adder circuit coupled to the plurality of shift circuits, wherein the adder circuit is configured to sum subsets of the plurality of vector elements and to generate shift amounts to the plurality of shift circuits based on the sums of the subsets of the plurality of vector elements.

### Claim 3 (depends on 2)

The processor as recited in claim 2 wherein the adder circuit is configured to generate the shift amounts further based on a vector element size of the plurality of vector elements.

### Claim 4 (depends on 3)

The processor as recited in claim 3 wherein the adder circuit is configured to generate the shift amount for a given vector element as a multiple of the vector element size minus a sum of the vector elements to the left of the given vector element in the plurality of vector elements, and wherein the multiple is a number of positions to the left of the given vector element plus one.

### Claim 5 (depends on 2)

The processor as recited in claim 2 wherein the second register is one of the plurality of vector registers, and wherein the execution core is configured to interpret a portion of a value in the second register as a plurality of consecutive bits instead of the plurality of vector elements in response to executing the first instruction.

### Claim 6 (depends on 5)

The processor as recited in claim 5 wherein a second portion of the value is a bit count indicating a number of the plurality of consecutive bits.

### Claim 7 (depends on 6)

The processor as recited in claim 6 wherein the execution core is configured to execute a second instruction specifying the first vector operand, the second operand, and a second result operand, wherein the second result operand is to be written to a fourth register, and wherein the execution core comprises:
a second shift circuit configured to shift a portion of the second operand to remove a number of bits equal to a sum of the vector elements of the first vector operand, wherein the second shift circuit is coupled to the adder circuit, and the adder circuit is configured to add the vector elements and to provide the sum to the second shift circuit as a shift amount; and
wherein the execution core is configured to write a remainder of the portion of the second operand as the second result operand in the fourth register responsive to executing the second instruction.

### Claim 8 (depends on 7)

The processor as recited in claim 7 wherein the removed bits are the most significant bits of the second operand, and wherein the execution core is configured to write a remainder of the portion of the second operand to the most significant bits of the fourth register responsive to executing the second instruction.

### Claim 9 (depends on 8)

The processor as recited in claim 8 wherein the execution core further comprises a compute circuit coupled to the adder circuit, wherein the computer circuit is configured to subtract the sum from the adder circuit from the bit count to generate a second bit count and to write the second bit count to a third portion of the fourth register responsive to executing the second instruction.

### Claim 10 (depends on 2)

The processor as recited in claim 2 wherein the execution core is configured to execute a third instruction specifying a second vector operand in a second vector register of the plurality of vector registers, a third vector operand in a fourth vector register of the plurality of vector registers, and a third result operand, wherein:
the plurality of shift circuits are configured to shift respective vector elements of the second vector operand based on values in respective vector elements of the third vector operand;
the plurality of mask circuits are configured to mask the shifted vector elements based on the respective vector elements of the third vector operand to generate variable-sized bit fields;
the execution core is configured to logically OR the variable-sized bit fields to generate a bit stream comprising a plurality of bit fields in adjacent bits; and
the execution core is configured to write the plurality of bit fields to the third result operand responsive to executing the third instruction.

### Claim 11 (depends on 10)

The processor as recited in claim 10 wherein the adder circuit is configured to sum the values of the respective vector elements of the third vector operand and to write the sum to a second portion of the third result operand responsive to executing the third instruction.

### Claim 12 (depends on 1)

The processor as recited in claim 1 wherein the execution core is configured to execute a fourth instruction having a fifth operand in a fifth register, a sixth operand in a sixth register, and a fourth result operand, and wherein the fifth operand includes a first portion having a first plurality of bits and a second portion having a second bit count indicating a number of the first plurality of bits, and wherein the sixth operand includes a first portion having a second plurality of bits and a second portion having a third bit count indicating a number of the second plurality of bits, wherein:
the execution core comprises a second shift circuit configured to right shift the second plurality of bits by the second bit count; and
the execution core is configured to logically OR the shifted second plurality of bits with the first plurality of bits to concatenate the first plurality of bits and the second plurality of bits in a first portion of the fourth result operand.

### Claim 13 (depends on 12)

The processor as recited in claim 12 wherein the execution core comprises a compute circuit configured to sum the second bit count and the third bit count and to write the sum to a second portion of the fourth result operand responsive to executing the fourth instruction.

### Claim 14

A processor comprising:
a register file comprising a plurality of vector registers; and
an execution core coupled to the register file, wherein the execution core is configured to execute a first instruction specifying a first vector operand, a second operand, and a result operand, wherein the first vector operand is in a first vector register of the plurality of vector registers, the second operand is in a second register, and the result operand is in a third register, wherein the execution core comprises:
an adder circuit configured to sum vector elements of the first vector operand; and
a shift circuit coupled to the adder circuit and configured to shift a portion of the second operand to remove a number of bits equal to the sum from the adder circuit; and
the execution core is configured to write a remainder of the portion as a corresponding portion of the result operand in the third register responsive to executing the first instruction.

### Claim 15 (depends on 14)

The processor as recited in claim 14 wherein the removed bits are the most significant bits of the second operand, and wherein the execution core is configured to write a remainder of the portion of the second operand to the most significant bits of the third register responsive to executing the first instruction.

### Claim 16 (depends on 15)

The processor as recited in claim 15 wherein the execution core comprises a compute circuit configured to subtract the sum from the adder circuit from a first bit count in a second portion of the second register to generate a second bit count and to write the second bit could to the second portion of the result operand responsive to executing the first instruction.

### Claim 17

A processor comprising:
a register file comprising a plurality of vector registers; and
an execution core coupled to the register file, wherein the execution core is configured to execute a first instruction specifying a first vector operand in a first vector register of the plurality of vector registers, a second vector operand in a second vector register of the plurality of vector registers, and a result operand, and wherein the execute core comprises:
a plurality of shift circuits configured to shift respective vector elements of the first vector operand; and
a plurality of mask circuits coupled to respective shift circuits of the plurality of shift circuits, wherein the plurality of mask circuits are configured to mask the shifted vector elements to generate variable-sized bit fields;
wherein the execution core is configured to logically OR the variable-sized bit fields to generate a bit stream comprising a plurality of bit fields in adjacent bits; and
wherein the execution core is configured to write bit stream to a first portion of the result operand.

### Claim 18 (depends on 17)

The processor as recited in claim 17 where the execution core comprises an adder circuit is configured to sum the respective vector elements of the second vector operand, and the execution core is to write the sum to a second portion of the result operand.

### Claim 19 (depends on 18)

The processor as recited in claim 18 is further configured to sum subsets of the respective vector elements and to generate shift amounts based on the sums of the subsets.

### Claim 20 (depends on 19)

The processor as recited in claim 19 wherein the adder circuit is configured generate to the shift amounts further based on a vector element size of the respective vector elements.
