Efficient handling of vector high-level language conditional constructs in a SIMD processor
First Claim
1. An execution unit for use in a computer system for conditionally performing a vector operation defined in a computer instruction, the execution unit comprising:
- first and second input vector registers for holding respective first and second source vector operands on which said vector operation defined in the instruction is to be carried out, wherein each of said first and second input vector registers holds a plurality of vector elements of a predetermined size, each vector element defining one of a plurality of vector element positions;
a vector condition flag register for storing a plurality of condition flags for each of said plurality of vector element positions, each element of said plurality of condition flags defining a true or false condition value;
means for loading said first and second input vector registers;
a plurality of operators associated respectively with said plurality of vector element positions for carrying out said vector operation on respective vector elements of said first source vector operand and said second source vector operand;
a vector compare unit for comparing said first and second source vector operands in accordance with a test field defined in the instruction, and generating a test condition flag for each of said plurality of vector element positions;
a vector condition code calculate logic that compounds said test condition flag with a prior generated condition flag of said vector condition flag register to generate a resultant condition flag for each of said plurality of vector element positions, said prior generated condition flag selected in accordance with a condition field defined in the instruction;
means to store said resultant condition flag into a destination condition flag of said vector condition flag register for each of said plurality of vector element positions, said destination condition flag selected in accordance with destination field defined in the instruction; and
means for storing the output of said vector operation to a destination vector register in accordance with said prior generated condition flag of each respective vector element of said vector condition flag register on a vector element-by-element basis.
1 Assignment
0 Petitions
Accused Products
Abstract
The present invention provides an efficient method to implement nested if-then-else conditional statements in a SIMD processor, which requires only one vector compare instruction for both if and else parts of the conditional construct. No stack and stack-handling instructions are needed for vector condition codes. Two condition code flag bits representing if and else parts of testing per element provide for nesting of multiple if-then-else. All SIMD instructions are conditional including the vector compare instruction, and this provides a method for aggregating multiple conditions in nested if-then-else statements. M full levels of if-then-else nesting requires (2M−1) nodes or vector test instructions and 2M+1 condition code flags per vector element. Also, capability to compare any element of first source vector register with any element of second source vector is provided.
82 Citations
24 Claims
-
1. An execution unit for use in a computer system for conditionally performing a vector operation defined in a computer instruction, the execution unit comprising:
-
first and second input vector registers for holding respective first and second source vector operands on which said vector operation defined in the instruction is to be carried out, wherein each of said first and second input vector registers holds a plurality of vector elements of a predetermined size, each vector element defining one of a plurality of vector element positions; a vector condition flag register for storing a plurality of condition flags for each of said plurality of vector element positions, each element of said plurality of condition flags defining a true or false condition value; means for loading said first and second input vector registers; a plurality of operators associated respectively with said plurality of vector element positions for carrying out said vector operation on respective vector elements of said first source vector operand and said second source vector operand; a vector compare unit for comparing said first and second source vector operands in accordance with a test field defined in the instruction, and generating a test condition flag for each of said plurality of vector element positions; a vector condition code calculate logic that compounds said test condition flag with a prior generated condition flag of said vector condition flag register to generate a resultant condition flag for each of said plurality of vector element positions, said prior generated condition flag selected in accordance with a condition field defined in the instruction; means to store said resultant condition flag into a destination condition flag of said vector condition flag register for each of said plurality of vector element positions, said destination condition flag selected in accordance with destination field defined in the instruction; and means for storing the output of said vector operation to a destination vector register in accordance with said prior generated condition flag of each respective vector element of said vector condition flag register on a vector element-by-element basis. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A method for a vector comparison of a first source vector and a second source vector, and providing a conditional vector operation, each vector comprising at least first and second vector elements, the method comprising:
-
storing said first source vector; storing said second source vector; comparing elements of said stored first source vector and said stored second source vector for a selected comparison test and calculating a test condition flag for each vector element position; accessing stored condition values derived from the results of executing a prior instruction sequence and selecting a condition flag from a plurality of condition flags for each vector element position; calculating a resultant condition flag by compounding said calculated test condition flag with said selected condition flag; storing said resultant condition flag for said vector comparison into a selected destination condition flag of said plurality of condition flags; and storing results of said conditional vector operation for arithmetic and logical vector operations to a destination vector in accordance to said selected condition flag value for each vector element position, said destination vector being the same size as said stored first source vector and said stored second source vector. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17)
-
-
18. An apparatus for a comparison test of first and second source vectors, and for performing nested vector conditional operations, the apparatus comprising:
-
a vector register file including a plurality of vector registers with a plurality of read data ports and at least one write data port, wherein said plurality of vector registers are accessed in parallel and substantially at the same time; a condition flag vector for storing a plurality of condition flags for each respective vector element; means for loading said plurality of vector registers of said vector register file with at least said first and second source vectors; means for performing said comparison test and compounding results of said comparison test with a selected condition flag of said condition flag vector; means for storing output of said vector comparison test into a destination condition flag of said condition flag vector for each vector element position; a vector operation unit including plurality of computing elements coupled to said plurality of read data ports of said vector register file for performing arithmetic or logical operations on the vector elements in parallel; and an enable logic coupled to write port of said vector register file for providing means for storing the output of said vector operation unit in a destination vector register in said vector register file on a vector element-by-element basis in accordance with said selected condition flag of said condition flag vector. - View Dependent Claims (19, 20, 21, 22, 23, 24)
-
Specification