US20010049780A1 - Method and apparatus for performing integer operations in response to a result of a floating point operation - Google Patents
Method and apparatus for performing integer operations in response to a result of a floating point operation Download PDFInfo
- Publication number
- US20010049780A1 US20010049780A1 US09/049,827 US4982798D US2001049780A1 US 20010049780 A1 US20010049780 A1 US 20010049780A1 US 4982798 D US4982798 D US 4982798D US 2001049780 A1 US2001049780 A1 US 2001049780A1
- Authority
- US
- United States
- Prior art keywords
- floating point
- bits
- data
- registers
- integer
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 16
- 230000004044 response Effects 0.000 title claims description 12
- 239000000284 extract Substances 0.000 claims description 4
- 238000006243 chemical reaction Methods 0.000 abstract description 2
- 238000010586 diagram Methods 0.000 description 5
- 238000013500 data storage Methods 0.000 description 2
- 238000000605 extraction Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/30007—Arrangements for executing specific machine instructions to perform operations on data operands
- G06F9/30018—Bit or string instructions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/30007—Arrangements for executing specific machine instructions to perform operations on data operands
- G06F9/30021—Compare instructions, e.g. Greater-Than, Equal-To, MINMAX
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/30007—Arrangements for executing specific machine instructions to perform operations on data operands
- G06F9/30036—Instructions to perform operations on packed data, e.g. vector, tile or matrix operations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30094—Condition code generation, e.g. Carry, Zero flag
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30098—Register arrangements
- G06F9/30105—Register structure
- G06F9/30109—Register structure having multiple operands in a single register
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30098—Register arrangements
- G06F9/30105—Register structure
- G06F9/30112—Register structure comprising data of variable length
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30098—Register arrangements
- G06F9/3012—Organisation of register space, e.g. banked or distributed register file
- G06F9/3013—Organisation of register space, e.g. banked or distributed register file according to data content, e.g. floating-point registers, address registers
Definitions
- the present invention relates to computer systems. More specifically, the present invention relates to performing integer operations based on results of floating point operations.
- Prior art processors typically perform comparisons of data, including integer data, floating point data and packed data. Such comparison operations are often used when determining whether branching should occur. For example, in a branch if greater than operation, two numbers are compared and a branch is taken if the first number is greater than the second number. Otherwise, the branch is not taken. The most basic comparisons are of two integer numbers.
- Packed data generally refers to the representation of multiple values by a single number.
- four eight-bit integer numbers may be represented by a single 32-bit number having four eight-bit segments equivalent to the four eight-bit numbers.
- the significance given to various bit placements is altered from standard 32-bit values in order to accurately represent a greater number of smaller values.
- By performing a compare on the 32-bit packed data four eight-bit integer compares are accomplished with a single compare operation.
- packed data comparisons may be performed on floating point data.
- a method and apparatus for performing a move mask operation is described.
- An operation is performed on floating point data and data is extracted from a result of the operation.
- the data includes a set of one or more bits where each bit represents multiple redundant bits in the result of the floating point operation.
- the set of one or more bits is transferred to an integer register and an operation is performed in response to the set of one or more bits.
- FIG. 1 is one embodiment of a computer system.
- FIG. 2 is one embodiment of an architectural block diagram of a register set and arithmetic circuitry.
- FIG. 3 is one embodiment of a packed data format.
- FIG. 4 is one embodiment of the result of a compare operation performed on two packed data values.
- FIG. 5 is one example of compare, move and branch operations.
- FIG. 6 is one embodiment of a flow diagram for a move mask operation.
- the present invention provides a method and apparatus for performing operations on packed data values of a first size and conversion of the results stored in the first size to data of a second size by eliminating redundant data.
- the present invention is useful, for example, when operations are performed on floating point data that is typically larger (e.g., 64 bits) than integer data (e.g., 32 bits) and integer operations are performed based on the floating point result. Because many processors branch based on integer data, the comparison results stored as floating point data must be transferred to an integer register prior to branching.
- the present invention takes advantage of redundancy of the floating point comparison results to transfer enough data to convey the comparison result to integer registers with a single instruction.
- FIG. 1 is one embodiment of a computer system.
- Computer system 100 comprises bus 101 or other device for communicating information, and processor 102 coupled with bus 101 for processing information.
- Processor 102 may be a complex instruction set computer (CISC) processor, a reduced instruction set computer (RISC) computer, a very long instruction word (VLIW) processor, or any other type of processor.
- processor 102 is a processor in the Pentium® family of processors available from Intel Corporation of Santa Clara, Calif. Of course, other processors may also be used.
- processor 102 includes one or more register sets for storing integer and/or floating point values.
- Computer system 100 further comprises random access memory (RAM) or other dynamic storage device 104 (referred to as main memory), coupled to bus 101 for storing information and instructions to be executed by processor 102 .
- Main memory 104 also may be used for storing temporary variables or other intermediate information during execution of instructions by processor 102 .
- Computer system 100 also comprises read only memory (ROM) and/or other static storage device 106 coupled to bus 101 for storing static information and instructions for processor 102 .
- Data storage device 107 is coupled to bus 101 for storing information and instructions.
- Data storage device 107 such as magnetic disk or optical disc and corresponding drive can be coupled to computer system 100 .
- Computer system 100 can also be coupled via bus 101 to display device 121 , such as a cathode ray tube (CRT) or liquid crystal display (LCD), for displaying information to a computer user.
- display device 121 such as a cathode ray tube (CRT) or liquid crystal display (LCD), for displaying information to a computer user.
- Alphanumeric input device 122 is typically coupled to bus 101 for communicating information and command selections to processor 102 .
- cursor control 123 is Another type of user input device.
- cursor control 123 such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 102 and for controlling cursor movement on display 121 .
- computer system 100 provides graphics functionality.
- Main memory 104 stores sequences of instructions to generate and display graphical or visual displays on display device 121 .
- Processor 102 executes the sequences of instructions to cause display device 121 to display the resulting graphical or video image.
- the sequences of instructions may respond to user input provided via alphanumeric input device 122 , cursor control device 123 , or some other input device (not shown in FIG. 1).
- other systems may also provide graphics functionality or may use the present invention for purposes other than graphics, such as numerical analysis or other mathematical applicaitons.
- FIG. 2 is one embodiment of an architectural block diagram of a register set and arithmetic circuitry.
- the components of FIG. 2 may be part of processor 102 of FIG. 1, or may be included in other circuitry of computer system 100 , either shown or not shown in FIG. 1.
- the present invention is described in terms of floating point registers and integer registers. It is important to note that any register architecture may be used with the present invention. Some architectures, for example, provide a predetermined number of integer registers and a predetermined number of floating point registers. Alternatively, an architecture may provide a pool of registers from which registers may be used for either integer or floating point use, such as in a processor that uses a register renaming scheme.
- a register may be multiple registers treated as a single register.
- a processor may provide multiple 64-bit registers that may be used as integer registers.
- two 64-bit registers may store the upper 64 bits and the lower 64 bits of a floating point number and be treated as a single 128-bit floating point register.
- Alternative architectures may also be used.
- FIG. 2 In general, the components of FIG. 2 provide floating point computation and integer computation functionality.
- Floating point registers 200 store floating point data to be used in operations performed by floating point arithmetic circuitry 205 .
- Integer registers 210 store integer data in registers for use in operations performed by integer arithmetic circuitry 215 . Integer registers 210 are coupled to floating point registers 200 by transfer circuitry 230 . Transfer circuitry 230 may be any circuitry that transfers data from floating point registers in floating point format to integer registers stored in integer format.
- FIG. 3 is one embodiment of a packed data format.
- the packed data format of FIG. 2 stores four 32-bit numbers (X 0 , X 1 , X 2 , and X 3 ) as a 128-bit packed data value 300 .
- bits 0 - 31 represent X 0
- bits 32 - 63 represent X 1
- bits 64 - 95 represent X 2
- bit 96 - 127 represent X 3 .
- the packed data are stored in floating point registers.
- Packed data operations are performed on two 128-bit packed data values in the format of FIG. 2 with each of the 32-bit values being operated on with the corresponding 32-bit value of the corresponding 128-bit packed data value. For example, to AND two packed data values, bits 0 - 31 of the two packed data values are ANDed together to result in a 32-bit result value. The other three 32-bit values may be ANDed in parallel to perform four 32-bit AND operations in a single 128-bit operation. Of course, other operations may be performed on packed data, such as additions, subtractions, etc.
- FIG. 4 is one embodiment of the result of a compare operation performed on two packed data values in the format described above with respect to FIG. 2.
- 128-bit packed data value 400 is compared to 128-bit packed data value 410 .
- the result is 128-bit packed data value 420 .
- Packed data value 400 comprises four values labeled X 0 , X 1 , X 2 , and X 3 and packed data value 410 comprises four values labeled Y 0 , Y 1 , Y 2 , and Y 3 .
- Each value in the respective packed data values is compared to a corresponding value in the other packed data value (e.g., X 3 and Y 3 ).
- Packed data value 420 (Z 0 , Z 1 , Z 2 , and Z 3 ) stores the result of the compare operation.
- Each value in packed data value 420 stores the result of the compare operation of the corresponding X and Y values.
- each value (e.g., Z 1 , Z 1 , Z 2 , and Z 3 ) of packed data value 420 stores either 32 set bits, if the corresponding X value is greater than the Y value, or 32 cleared bits, if the corresponding Y value is greater or equal than the X value.
- the result data represented by packed data value stores redundant information.
- the result information could be stored in four bits, one bit for each of the four 32-bit values stored in the 128-bit result packed data value 420 .
- the present invention extracts the most significant bit (MSB), or sign bit from each result value (e.g., Z 0 , Z 1 , Z 2 , and Z 3 ) stored in packed data value 420 when the result of a comparison is transferred to integer registers.
- MSB most significant bit
- the low four bits or an integer register represent the result of the packed data compare operation.
- FIGS. 4 and 5 are described in terms of a compare operation. It is important to note, however, that the floating point operation that provides a result may be any other floating point operation, whether packed or not.
- FIG. 5 is one example of compare, move and branch operations.
- two floating point numbers stored in floating point registers are compared.
- the result is stored in a third floating point register.
- Selected bits from the result register are transferred to an integer register.
- the data in the integer register is then used to evaluate a branch condition or perform an integer operation.
- FIG. 5 may be useful, for example, when evaluating three-dimensional graphics. Many values may be compared to determine whether two objects overlap, touch, etc. In the following example, four values are compared to four other values as part of a packed data compare operation. Of course, other formats of packed data as well as other floating point operations may also be used.
- the values stored in floating point registers 200 are described in hexadecimal format, while the values stored in integer registers 210 are described in binary format.
- packed data value in floating point register 500 is compared to packed data value in floating point register 510 .
- the result is stored as a packed data value in floating point register 520 .
- Z 3 FFFF
- Other values are compared in a similar manner such that the result from each of the four comparisons is stored in register 520 .
- floating point comparisons are performed by floating point arithmetic circuitry 205 .
- the most significant bits from each of the result values are extracted and transferred, via transfer circuitry 230 , to integer register 530 .
- the binary value 1100 represents the result of the floating point comparison operation and can be used for integer operations such as branching.
- the binary result value 1100 is compared to a conditional binary value 1011 stored in integer register 540 . If the condition is true a branch is taken. Otherwise, the branch is not taken.
- integer operations are performed by integer arithmetic circuitry 215 .
- Performing floating point comparisons in the manner described above is advantageous because the result of the floating point compare is maintained in floating point format and may be used subsequently as a mask for later operations. For example, a logical AND operation my be performed on result packed data value stored in floating point register 520 and the packed data value stored in floating point register 500 to generate a packed data value with the values that are greater than the values of the packed data value stored in floating point register 510 (e.g., X 3 , X 2 , 0, 0).
- the value stored in floating point register 520 may be logically complemented and then logically ANDed with the value stored in floating point register 510 to generate a packed data value with the values that are greater than the greater values stored in floating point register 500 (e.g., 0, 0, Y 1 , Y 0 ).
- the two result values may be logically ORed to generate a packed data value having the values of the respective values stored in floating point registers 500 and 510 (e.g., X 3 , X 2 , Y 1 , Y 0 )
- Another advantage of the present invention is that branches based on floating point comparisons in processors that support integer branching may be performed more efficiently than would otherwise be possible.
- the present invention provides a more compact instruction stream, and therefore more efficient code, when multiple comparisons of floating point values are used to determine a branching condition.
- the present has been described with respect to compare and branch instructions. However, extraction of bits and transfer to integer registers may be performed with any floating point number. For example, the present invention may be used to extract sign bits from each value of a packed floating point number. The results may be used for integer operations such as branching or comparisons. Thus, the present invention has a broader application than to only floating point comparisons and integer branches.
- FIG. 6 is one embodiment of a flow diagram for performing a move mask instruction. The process of FIG. 6 is performed on floating point values.
- the floating point values are packed floating point values. Alternatively, the floating point values are not packed data values.
- a floating point operation is performed on the floating point values.
- the floating point operation may be, for example, a packed floating point compare, a packed floating point add, a floating point multiply, etc.
- step 620 one or more bits are extracted from a floating point result register.
- the most significant bit of each value of a packed floating point value is extracted.
- a different bit, such as the least significant bit may be extracted. Extracting the most significant bit provides the advantage that the most significant bit provides the sign of the floating point number.
- bits from non-packed data may also be extracted.
- the extracted bits are placed in a predetermined format in step 630 .
- the extracted bits are stored in the least significant bits of the integer format.
- the bit representing Z 0 shown in FIG. 4
- the bit representing Z 1 shown in FIG. 4
- the extracted bits may be stored in the most significant bits of the integer format.
- step 640 an integer operation is performed based on the extracted bits stored in an integer register. For example, a branch on equal may be performed in response to bits extracted from a floating point operation. Of course, other operations, such as integer compare, integer add, etc. may also be performed on the extracted bits.
- the present invention provides a method and apparatus for performing integer operations based on floating point values without losing the floating point value. This leaves the floating point value for later floating point operations, should subsequent operations be performed.
- the present invention thereby provides more compact code by transferring information to integer registers for integer operations and by maintaining floating point values for possible subsequent floating point operations.
Abstract
A method and apparatus for performing a move mask operation. The present invention provides a method and apparatus for performing operations on packed data values of a first size and format and conversion of the results to data of a second size and format by eliminating redundant data. The present invention is useful, for example, when comparisons are performed on floating point data that is typically larger (e.g., 64 bits) than integer data (e.g., 32 bits) and integer operations are preformed based on the result. Because many processors branch based on integer data, the comparison results stored as floating point data must be transferred to an integer register prior to branching. The present invention takes advantage of redundancy of the floating point comparison results to transfer enough data to convey the comparison result to integer registers with a single instruction.
Description
- The present invention relates to computer systems. More specifically, the present invention relates to performing integer operations based on results of floating point operations.
- Prior art processors typically perform comparisons of data, including integer data, floating point data and packed data. Such comparison operations are often used when determining whether branching should occur. For example, in a branch if greater than operation, two numbers are compared and a branch is taken if the first number is greater than the second number. Otherwise, the branch is not taken. The most basic comparisons are of two integer numbers.
- In some applications, such as three-dimensional graphics, many numbers are compared to determine the “location” of various objects with respect to each other. In such applications, comparisons are performed more efficiently by operating on packed data. Packed data generally refers to the representation of multiple values by a single number. For example, four eight-bit integer numbers may be represented by a single 32-bit number having four eight-bit segments equivalent to the four eight-bit numbers. Thus, the significance given to various bit placements is altered from standard 32-bit values in order to accurately represent a greater number of smaller values. By performing a compare on the 32-bit packed data, four eight-bit integer compares are accomplished with a single compare operation. Similarly, packed data comparisons may be performed on floating point data.
- Because many prior art processors branch on integer operations and many applications operate on floating point data, what is needed is an improved method and apparatus for performing branch instructions based on integer instructions in response to results of floating point operations.
- A method and apparatus for performing a move mask operation is described. An operation is performed on floating point data and data is extracted from a result of the operation. The data includes a set of one or more bits where each bit represents multiple redundant bits in the result of the floating point operation. The set of one or more bits is transferred to an integer register and an operation is performed in response to the set of one or more bits.
- The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings in which like reference numerals refer to similar elements.
- FIG. 1 is one embodiment of a computer system.
- FIG. 2 is one embodiment of an architectural block diagram of a register set and arithmetic circuitry.
- FIG. 3 is one embodiment of a packed data format.
- FIG. 4 is one embodiment of the result of a compare operation performed on two packed data values.
- FIG. 5 is one example of compare, move and branch operations.
- FIG. 6 is one embodiment of a flow diagram for a move mask operation.
- A method and apparatus for performing a move mask operation is described. In the following description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid obscuring the present invention.
- The present invention provides a method and apparatus for performing operations on packed data values of a first size and conversion of the results stored in the first size to data of a second size by eliminating redundant data. The present invention is useful, for example, when operations are performed on floating point data that is typically larger (e.g., 64 bits) than integer data (e.g., 32 bits) and integer operations are performed based on the floating point result. Because many processors branch based on integer data, the comparison results stored as floating point data must be transferred to an integer register prior to branching. The present invention takes advantage of redundancy of the floating point comparison results to transfer enough data to convey the comparison result to integer registers with a single instruction.
- FIG. 1 is one embodiment of a computer system. Computer system100 comprises
bus 101 or other device for communicating information, andprocessor 102 coupled withbus 101 for processing information.Processor 102 may be a complex instruction set computer (CISC) processor, a reduced instruction set computer (RISC) computer, a very long instruction word (VLIW) processor, or any other type of processor. In one embodiment,processor 102 is a processor in the Pentium® family of processors available from Intel Corporation of Santa Clara, Calif. Of course, other processors may also be used. In one embodiment,processor 102 includes one or more register sets for storing integer and/or floating point values. - Computer system100 further comprises random access memory (RAM) or other dynamic storage device 104 (referred to as main memory), coupled to
bus 101 for storing information and instructions to be executed byprocessor 102.Main memory 104 also may be used for storing temporary variables or other intermediate information during execution of instructions byprocessor 102. Computer system 100 also comprises read only memory (ROM) and/or otherstatic storage device 106 coupled tobus 101 for storing static information and instructions forprocessor 102.Data storage device 107 is coupled tobus 101 for storing information and instructions. -
Data storage device 107 such as magnetic disk or optical disc and corresponding drive can be coupled to computer system 100. Computer system 100 can also be coupled viabus 101 to displaydevice 121, such as a cathode ray tube (CRT) or liquid crystal display (LCD), for displaying information to a computer user.Alphanumeric input device 122, including alphanumeric and other keys, is typically coupled tobus 101 for communicating information and command selections toprocessor 102. Another type of user input device is cursor control 123, such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections toprocessor 102 and for controlling cursor movement ondisplay 121. - In one embodiment, computer system100 provides graphics functionality.
Main memory 104 stores sequences of instructions to generate and display graphical or visual displays ondisplay device 121.Processor 102 executes the sequences of instructions to causedisplay device 121 to display the resulting graphical or video image. The sequences of instructions may respond to user input provided viaalphanumeric input device 122, cursor control device 123, or some other input device (not shown in FIG. 1). Of course, other systems may also provide graphics functionality or may use the present invention for purposes other than graphics, such as numerical analysis or other mathematical applicaitons. - FIG. 2 is one embodiment of an architectural block diagram of a register set and arithmetic circuitry. The components of FIG. 2 may be part of
processor 102 of FIG. 1, or may be included in other circuitry of computer system 100, either shown or not shown in FIG. 1. - The present invention is described in terms of floating point registers and integer registers. It is important to note that any register architecture may be used with the present invention. Some architectures, for example, provide a predetermined number of integer registers and a predetermined number of floating point registers. Alternatively, an architecture may provide a pool of registers from which registers may be used for either integer or floating point use, such as in a processor that uses a register renaming scheme.
- It is also important to note that what is called a register may be multiple registers treated as a single register. For example, a processor may provide multiple 64-bit registers that may be used as integer registers. Within the same architecture, two 64-bit registers may store the upper 64 bits and the lower 64 bits of a floating point number and be treated as a single 128-bit floating point register. Alternative architectures may also be used.
- In general, the components of FIG. 2 provide floating point computation and integer computation functionality. Floating point registers200 store floating point data to be used in operations performed by floating point
arithmetic circuitry 205. - Integer registers210 store integer data in registers for use in operations performed by
integer arithmetic circuitry 215. Integer registers 210 are coupled to floating point registers 200 bytransfer circuitry 230.Transfer circuitry 230 may be any circuitry that transfers data from floating point registers in floating point format to integer registers stored in integer format. - FIG. 3 is one embodiment of a packed data format. The packed data format of FIG. 2 stores four 32-bit numbers (X0, X1, X2, and X3) as a 128-bit packed data value 300. In such an embodiment, bits 0-31 represent X0, bits 32-63 represent X1, bits 64-95 represent X2, and bit 96-127 represent X3. In one embodiment, the packed data are stored in floating point registers.
- Packed data operations are performed on two 128-bit packed data values in the format of FIG. 2 with each of the 32-bit values being operated on with the corresponding 32-bit value of the corresponding 128-bit packed data value. For example, to AND two packed data values, bits0-31 of the two packed data values are ANDed together to result in a 32-bit result value. The other three 32-bit values may be ANDed in parallel to perform four 32-bit AND operations in a single 128-bit operation. Of course, other operations may be performed on packed data, such as additions, subtractions, etc.
- FIG. 4 is one embodiment of the result of a compare operation performed on two packed data values in the format described above with respect to FIG. 2. In the example of FIG. 4, 128-bit
packed data value 400 is compared to 128-bitpacked data value 410. The result is 128-bitpacked data value 420. - To perform comparison operation on two 128-bit packed data values, each of the four components of the packed data value are compared to each other.
Packed data value 400 comprises four values labeled X0, X1, X2, and X3 and packeddata value 410 comprises four values labeled Y0, Y1, Y2, and Y3. Each value in the respective packed data values is compared to a corresponding value in the other packed data value (e.g., X3 and Y3). - Packed data value420 (Z0, Z1, Z2, and Z3) stores the result of the compare operation. Each value in packed
data value 420 stores the result of the compare operation of the corresponding X and Y values. In one embodiment, each value (e.g., Z1, Z1, Z2, and Z3) of packeddata value 420 stores either 32 set bits, if the corresponding X value is greater than the Y value, or 32 cleared bits, if the corresponding Y value is greater or equal than the X value. Thus, the result data represented by packed data value stores redundant information. The result information could be stored in four bits, one bit for each of the four 32-bit values stored in the 128-bit result packeddata value 420. - In one embodiment, the present invention extracts the most significant bit (MSB), or sign bit from each result value (e.g., Z0, Z1, Z2, and Z3) stored in packed
data value 420 when the result of a comparison is transferred to integer registers. Of course, a bit other than the most significant bit could be extracted to convey similar information. In one embodiment, the low four bits or an integer register represent the result of the packed data compare operation. - The example of FIGS. 4 and 5 are described in terms of a compare operation. It is important to note, however, that the floating point operation that provides a result may be any other floating point operation, whether packed or not.
- FIG. 5 is one example of compare, move and branch operations. In the example of FIG. 5, two floating point numbers stored in floating point registers are compared. The result is stored in a third floating point register. Selected bits from the result register are transferred to an integer register. The data in the integer register is then used to evaluate a branch condition or perform an integer operation.
- The example of FIG. 5 may be useful, for example, when evaluating three-dimensional graphics. Many values may be compared to determine whether two objects overlap, touch, etc. In the following example, four values are compared to four other values as part of a packed data compare operation. Of course, other formats of packed data as well as other floating point operations may also be used. The values stored in floating point registers200 are described in hexadecimal format, while the values stored in integer registers 210 are described in binary format.
- In the following example, packed data value in floating
point register 500 is compared to packed data value in floatingpoint register 510. The result is stored as a packed data value in floatingpoint register 520. For example, X3=FF00 and Y3=F300. Thus, X3 is greater than Y3. The result (Z3=FFFF) is stored in packeddata value 520. Other values are compared in a similar manner such that the result from each of the four comparisons is stored inregister 520. In one embodiment, floating point comparisons are performed by floating pointarithmetic circuitry 205. - In one embodiment, the most significant bits from each of the result values (e.g., Z0, Z1, Z2, and Z3) are extracted and transferred, via
transfer circuitry 230, to integer register 530. Thus, the binary value 1100 represents the result of the floating point comparison operation and can be used for integer operations such as branching. In the example of FIG. 5, the binary result value 1100 is compared to a conditional binary value 1011 stored in integer register 540. If the condition is true a branch is taken. Otherwise, the branch is not taken. In one embodiment, integer operations are performed byinteger arithmetic circuitry 215. - Performing floating point comparisons in the manner described above is advantageous because the result of the floating point compare is maintained in floating point format and may be used subsequently as a mask for later operations. For example, a logical AND operation my be performed on result packed data value stored in floating
point register 520 and the packed data value stored in floatingpoint register 500 to generate a packed data value with the values that are greater than the values of the packed data value stored in floating point register 510 (e.g., X3, X2, 0, 0). - The value stored in floating
point register 520 may be logically complemented and then logically ANDed with the value stored in floatingpoint register 510 to generate a packed data value with the values that are greater than the greater values stored in floating point register 500 (e.g., 0, 0, Y1, Y0). The two result values may be logically ORed to generate a packed data value having the values of the respective values stored in floating point registers 500 and 510 (e.g., X3, X2, Y1, Y0) Another advantage of the present invention is that branches based on floating point comparisons in processors that support integer branching may be performed more efficiently than would otherwise be possible. For example, assuming that the comparison of floating point values, extraction of bits, and transfer of bits to an integer register is performed by a single instruction (e.g., MOVEMASK), the following instruction sequence may be used to perform a branch based on a floating point comparison:Z = MOVEMASK (X, Y) // compare fp values X and Y, result is int value Z COMPARE (Z, V) // compare int values Z and V JUMP GREATER THAN // jump if Z > V - Thus, the present invention provides a more compact instruction stream, and therefore more efficient code, when multiple comparisons of floating point values are used to determine a branching condition.
- The present has been described with respect to compare and branch instructions. However, extraction of bits and transfer to integer registers may be performed with any floating point number. For example, the present invention may be used to extract sign bits from each value of a packed floating point number. The results may be used for integer operations such as branching or comparisons. Thus, the present invention has a broader application than to only floating point comparisons and integer branches.
- FIG. 6 is one embodiment of a flow diagram for performing a move mask instruction. The process of FIG. 6 is performed on floating point values. In one embodiment, the floating point values are packed floating point values. Alternatively, the floating point values are not packed data values.
- In
step 610, a floating point operation is performed on the floating point values. The floating point operation may be, for example, a packed floating point compare, a packed floating point add, a floating point multiply, etc. - In
step 620, one or more bits are extracted from a floating point result register. In one embodiment, the most significant bit of each value of a packed floating point value is extracted. Alternatively, a different bit, such as the least significant bit may be extracted. Extracting the most significant bit provides the advantage that the most significant bit provides the sign of the floating point number. Of course, bits from non-packed data may also be extracted. - The extracted bits are placed in a predetermined format in step630. In one embodiment, the extracted bits are stored in the least significant bits of the integer format. For example, the bit representing Z0 (shown in FIG. 4) is stored in the least significant bit of the integer format. The bit representing Z1 (shown in FIG. 4) is stored in the next to least significant bit of the integer format, and so on. Of course, alternative integer formats may be used. For example, the extracted bits may be stored in the most significant bits of the integer format.
- In
step 640, an integer operation is performed based on the extracted bits stored in an integer register. For example, a branch on equal may be performed in response to bits extracted from a floating point operation. Of course, other operations, such as integer compare, integer add, etc. may also be performed on the extracted bits. - Thus, the present invention provides a method and apparatus for performing integer operations based on floating point values without losing the floating point value. This leaves the floating point value for later floating point operations, should subsequent operations be performed. The present invention thereby provides more compact code by transferring information to integer registers for integer operations and by maintaining floating point values for possible subsequent floating point operations.
- In the foregoing specification, the present invention has been described with reference to specific embodiments thereof. It will, however, be evident that various modifications and changes may be made thereto without departing from the broader spirit and scope of the invention. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.
Claims (20)
1. In a computer system, method comprising the computer-implemented steps of:
performing an operation on data stored in a first format;
extracting data from a result of the operation stored in the first format, wherein the data includes a set of one or more bits each bit in the set of one or more bits represents multiple redundant bits in the result;
transferring the set of one or more bits to a second format; and
performing an operation in response to the set of one or more bits.
2. The method of , wherein the first format is packed floating point data.
claim 1
3. The method of , where in the second format is integer data.
claim 1
4. The method of , wherein the step of performing an operation on packed floating point data comprises performing a comparison of two sets of packed floating point data.
claim 1
5. The method of , wherein the step of extracting data comprises setting a bit in a result mask register equal to a corresponding most significant bit of each associated packed floating point data value.
claim 1
6. The method of , wherein the step of transferring comprises transferring the set of one or more bits from a floating point register to an integer register.
claim 1
7. The method of , wherein the step of performing an operation in response to the set of one or more bits comprises performing a branch operation in response to the set of one or more bits.
claim 1
8. A circuit comprising:
a first set of registers that store data in a first format;
a first arithmetic unit coupled to the first set of registers, wherein the first arithmetic unit performs compare operations on data stored in the first set of registers and stores a result in a register in the first set of registers, and further wherein the first arithmetic unit extracts a set of from the result, where each bit in the set of bits represents a redundant set of bits stored in the result;
a second set of registers storing data in a second format;
a transfer circuit coupled between the first set of registers and the second set of registers, the transfer circuit transferring the set of bits to a register in the first set of registers; and
a second arithmetic unit that performs operations in response to set of bits stored in the second set of registers.
9. The circuit of , wherein the set of registers are floating point registers.
claim 8
10. The circuit of , wherein the second set of registers are integer registers.
claim 8
11. An apparatus comprising:
means for performing an operation on data stored in a first format;
means for extracting data from a result of the operation stored in the first format, wherein the data includes a set of one or more bits each bit in the set of one or more bits represents multiple redundant bits in the result;
means for transferring the set of one or more bits to a second format; and
means for performing an operation in response to the set of one or more bits.
12. The apparatus of , wherein the means for performing an operation on packed floating point data comprises means for performing a comparison of two sets of packed floating point data.
claim 11
13. The apparatus of , wherein the means for extracting data comprises setting a bit in a result mask register equal to a corresponding most significant bit of each associated packed floating point data value.
claim 11
14. The apparatus of , wherein the means for transferring comprises means for transferring the set of one or more bits from a floating point register to an integer register.
claim 11
15. The apparatus of , wherein the means for performing an operation in response to the set of one or more bits comprises means for performing a branch operation in response to the set of one or more bits.
claim 11
16. A graphics display system comprising:
a bus;
a display device coupled to the bus; and
a processor coupled to the display device, the processor having a plurality of registers that store floating point data and integer data, the processor further comprising circuitry that extracts one or more bits of data from one of the registers that stores floating point data and transfers the extracted bits to an integer register to perform an integer operation, wherein the processor causes the display device to change what is displayed in response to the integer operation.
17. The graphics display system of , wherein the floating point data represents a portion of what is displayed by the display device.
claim 16
18. The graphics display system of , wherein the floating point data comprises packed floating point data.
claim 16
19. The graphics display system of , wherein the processor extracts a most significant bit from each value represented by the packed floating point data.
claim 18
20. The graphics display system of wherein the integer operation is a branch operation.
claim 16
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US09/049,827 US6317824B1 (en) | 1998-03-27 | 1998-03-27 | Method and apparatus for performing integer operations in response to a result of a floating point operation |
Publications (1)
Publication Number | Publication Date |
---|---|
US20010049780A1 true US20010049780A1 (en) | 2001-12-06 |
Family
ID=21961961
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US09/049,827 Expired - Lifetime US6317824B1 (en) | 1998-03-27 | 1998-03-27 | Method and apparatus for performing integer operations in response to a result of a floating point operation |
US09/049,827 Granted US20010049780A1 (en) | 1998-03-27 | 1998-03-27 | Method and apparatus for performing integer operations in response to a result of a floating point operation |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US09/049,827 Expired - Lifetime US6317824B1 (en) | 1998-03-27 | 1998-03-27 | Method and apparatus for performing integer operations in response to a result of a floating point operation |
Country Status (1)
Country | Link |
---|---|
US (2) | US6317824B1 (en) |
Families Citing this family (35)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7301541B2 (en) * | 1995-08-16 | 2007-11-27 | Microunity Systems Engineering, Inc. | Programmable processor and method with wide operations |
US7932911B2 (en) * | 1998-08-24 | 2011-04-26 | Microunity Systems Engineering, Inc. | Processor for executing switch and translate instructions requiring wide operands |
ATE557342T1 (en) | 1998-08-24 | 2012-05-15 | Microunity Systems Eng | PROCESSOR AND METHOD FOR MATRIX MULTIPLICATION WITH A WIDE OPERAND |
US7051060B2 (en) * | 2001-09-28 | 2006-05-23 | Intel Corporation | Operand conversion optimization |
EP1607858A1 (en) * | 2004-06-16 | 2005-12-21 | Koninklijke Philips Electronics N.V. | Bit-plane extraction operation |
WO2006112045A1 (en) * | 2005-03-31 | 2006-10-26 | Matsushita Electric Industrial Co., Ltd. | Processor |
US7958181B2 (en) * | 2006-09-21 | 2011-06-07 | Intel Corporation | Method and apparatus for performing logical compare operations |
US8327120B2 (en) | 2007-12-29 | 2012-12-04 | Intel Corporation | Instructions with floating point control override |
US8327344B2 (en) * | 2008-10-14 | 2012-12-04 | International Business Machines Corporation | Array reference safety analysis in the presence of loops with conditional control flow |
US7900025B2 (en) * | 2008-10-14 | 2011-03-01 | International Business Machines Corporation | Floating point only SIMD instruction set architecture including compare, select, Boolean, and alignment operations |
US8423983B2 (en) * | 2008-10-14 | 2013-04-16 | International Business Machines Corporation | Generating and executing programs for a floating point single instruction multiple data instruction set architecture |
US7865693B2 (en) * | 2008-10-14 | 2011-01-04 | International Business Machines Corporation | Aligning precision converted vector data using mask indicating offset relative to element boundary corresponding to precision type |
US9652231B2 (en) * | 2008-10-14 | 2017-05-16 | International Business Machines Corporation | All-to-all permutation of vector elements based on a permutation pattern encoded in mantissa and exponent bits in a floating-point SIMD architecture |
US9697174B2 (en) | 2011-12-08 | 2017-07-04 | Oracle International Corporation | Efficient hardware instructions for processing bit vectors for single instruction multiple data processors |
US9792117B2 (en) | 2011-12-08 | 2017-10-17 | Oracle International Corporation | Loading values from a value vector into subregisters of a single instruction multiple data register |
US10534606B2 (en) | 2011-12-08 | 2020-01-14 | Oracle International Corporation | Run-length encoding decompression |
EP2788902B1 (en) | 2011-12-08 | 2019-04-17 | Oracle International Corporation | Techniques for more efficient usage of memory-to-cpu bandwidth |
US9342314B2 (en) | 2011-12-08 | 2016-05-17 | Oracle International Corporation | Efficient hardware instructions for single instruction multiple data processors |
WO2013095603A1 (en) * | 2011-12-23 | 2013-06-27 | Intel Corporation | Apparatus and method for down conversion of data types |
US9292569B2 (en) | 2012-10-02 | 2016-03-22 | Oracle International Corporation | Semi-join acceleration |
CN105653499B (en) * | 2013-03-15 | 2019-01-01 | 甲骨文国际公司 | Hardware-efficient for single instruction multidata processor instructs |
US9378232B2 (en) | 2013-09-21 | 2016-06-28 | Oracle International Corporation | Framework for numa affinitized parallel query on in-memory objects within the RDBMS |
US9785565B2 (en) | 2014-06-30 | 2017-10-10 | Microunity Systems Engineering, Inc. | System and methods for expandably wide processor instructions |
US10025823B2 (en) | 2015-05-29 | 2018-07-17 | Oracle International Corporation | Techniques for evaluating query predicates during in-memory table scans |
US9990308B2 (en) | 2015-08-31 | 2018-06-05 | Oracle International Corporation | Selective data compression for in-memory databases |
US10055358B2 (en) | 2016-03-18 | 2018-08-21 | Oracle International Corporation | Run length encoding aware direct memory access filtering engine for scratchpad enabled multicore processors |
US10061832B2 (en) | 2016-11-28 | 2018-08-28 | Oracle International Corporation | Database tuple-encoding-aware data partitioning in a direct memory access engine |
US10402425B2 (en) | 2016-03-18 | 2019-09-03 | Oracle International Corporation | Tuple encoding aware direct memory access engine for scratchpad enabled multi-core processors |
US10061714B2 (en) | 2016-03-18 | 2018-08-28 | Oracle International Corporation | Tuple encoding aware direct memory access engine for scratchpad enabled multicore processors |
US10599488B2 (en) | 2016-06-29 | 2020-03-24 | Oracle International Corporation | Multi-purpose events for notification and sequence control in multi-core processor systems |
US10380058B2 (en) | 2016-09-06 | 2019-08-13 | Oracle International Corporation | Processor core to coprocessor interface with FIFO semantics |
US10783102B2 (en) | 2016-10-11 | 2020-09-22 | Oracle International Corporation | Dynamically configurable high performance database-aware hash engine |
US10459859B2 (en) | 2016-11-28 | 2019-10-29 | Oracle International Corporation | Multicast copy ring for database direct memory access filtering engine |
US10176114B2 (en) | 2016-11-28 | 2019-01-08 | Oracle International Corporation | Row identification number generation in database direct memory access engine |
US10725947B2 (en) | 2016-11-29 | 2020-07-28 | Oracle International Corporation | Bit vector gather row count calculation and handling in direct memory access engine |
Family Cites Families (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4972314A (en) * | 1985-05-20 | 1990-11-20 | Hughes Aircraft Company | Data flow signal processor method and apparatus |
US4896133A (en) | 1987-02-10 | 1990-01-23 | Davin Computer Corporation | Parallel string processor and method for a minicomputer |
US5073864A (en) | 1987-02-10 | 1991-12-17 | Davin Computer Corporation | Parallel string processor and method for a minicomputer |
CA2045735A1 (en) * | 1990-06-29 | 1991-12-30 | Richard Lee Sites | Computer performance by eliminating branches |
US5493687A (en) * | 1991-07-08 | 1996-02-20 | Seiko Epson Corporation | RISC microprocessor architecture implementing multiple typed register sets |
US5388209A (en) * | 1991-08-02 | 1995-02-07 | Sony Corporation | Apparatus for high-speed recording compressed digital data with increased compression |
US5581778A (en) * | 1992-08-05 | 1996-12-03 | David Sarnoff Researach Center | Advanced massively parallel computer using a field of the instruction to selectively enable the profiling counter to increase its value in response to the system clock |
US5701508A (en) * | 1995-12-19 | 1997-12-23 | Intel Corporation | Executing different instructions that cause different data type operations to be performed on single logical register file |
US5889984A (en) * | 1996-08-19 | 1999-03-30 | Intel Corporation | Floating point and integer condition compatibility for conditional branches and conditional moves |
-
1998
- 1998-03-27 US US09/049,827 patent/US6317824B1/en not_active Expired - Lifetime
- 1998-03-27 US US09/049,827 patent/US20010049780A1/en active Granted
Also Published As
Publication number | Publication date |
---|---|
US6317824B1 (en) | 2001-11-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6317824B1 (en) | Method and apparatus for performing integer operations in response to a result of a floating point operation | |
US4439828A (en) | Instruction substitution mechanism in an instruction handling unit of a data processing system | |
US6961845B2 (en) | System to perform horizontal additions | |
US5907842A (en) | Method of sorting numbers to obtain maxima/minima values with ordering | |
US6009191A (en) | Computer implemented method for compressing 48-bit pixels to 16-bit pixels | |
US7480787B1 (en) | Method and structure for pipelining of SIMD conditional moves | |
US20060149953A1 (en) | Conditional execution per lane | |
US20010016902A1 (en) | Conversion from packed floating point data to packed 8-bit integer data in different architectural registers | |
EP0752643A1 (en) | Expansion of data | |
US5867145A (en) | Graphical image recasting | |
US6282628B1 (en) | Method and system for a result code for a single-instruction multiple-data predicate compare operation | |
US6728874B1 (en) | System and method for processing vectorized data | |
US6061782A (en) | Mechanism for floating point to integer conversion with RGB bias multiply | |
US5210839A (en) | Method and apparatus for providing a memory address from a computer instruction using a mask register | |
JPH08329039A (en) | Data-driven type information processor | |
CN100380315C (en) | Instruction encoding within a data processing apparatus having multiple instruction sets | |
US6470440B1 (en) | Vector compare and maximum/minimum generation apparatus and method therefor | |
KR100735944B1 (en) | Method and computer program for single instruction multiple data management | |
US6499046B1 (en) | Saturation detection apparatus and method therefor | |
JPH034936B2 (en) | ||
US6396504B1 (en) | Graphical image data reformatting method and apparatus | |
US5912995A (en) | Method and apparatus for rotating or transposing a binary image | |
US5812836A (en) | System for processing iterative tasks in data processing systems | |
CA2058260C (en) | Mask register for computer processor | |
US5838297A (en) | Method for color image scaling and other geometrical transformations |