Conditional extract instruction for processing vectors
AssigneeApple Inc.
InventorJeffry E. Gonion
Life of this patent
Estimating the term…
Abstract
The described embodiments include a vector processor that executes a ConditionalExtract instruction. In the described embodiments, the processor receives an input scalar variable, an input vector, and a predicate vector, wherein each of the vectors has N elements. The processor then executes the ConditionalExtract instruction, which causes the processor to determine if at least one element in the predicate vector is active. If so, the processor copies a value from a last element in the input vector for which a corresponding element in the predicate vector is active into a scalar result variable. Otherwise, of no elements of the predicate vector are active, the processor copies a value from the input scalar variable into the scalar result variable.
Claims15
A method for executing program code in a processor, comprising:
- receiving an input scalar variable, an input vector, and a predicate vector, wherein each of the vectors has N elements;
- and
- determining if at least one element in the predicate vector is active,
- if so, copying a value from a last element in the input vector for which a corresponding element in the predicate vector is active into a scalar result variable;
- and
- if not, copying a value from the input scalar variable into the scalar result variable.
A processor that executes program code, comprising:
- the processor;
- wherein the processor is configured to:
- receive an input scalar variable, an input vector, and a predicate vector, wherein each of the vectors has N elements;
- and
- determine if at least one element in the predicate vector is active,
- if so, copy a value from a last element in the input vector for which a corresponding element in the predicate vector is active into a scalar result variable;
- and
- if not, copy a value from the input scalar variable into the scalar result variable.
A computer system that executes program code, comprising:
- the processor;
- and
- a memory coupled to the processor, wherein the memory stores instructions and data for the processor;
- wherein the processor is configured to:
- receive an input scalar variable, an input vector, and a predicate vector, wherein each of the vectors has N elements;
- and
- determine if at least one element in the predicate vector is active,
- if so, copy a value from a last element in the input vector for which a corresponding element in the predicate vector is active into a scalar result variable;
- and
- if not, copy a value from the input scalar variable into the scalar result variable.
Dependencies are inferred from the claim text.