An article comprising an instruction stored on a storage medium. The instruction includes opcode field storing an opcode signal and an operand field storing an operand signal. The operand is compressed prior to being stored in the operand field.
|
10. An apparatus comprising:
a processor to determine if at least a portion of a bit pattern of an immediate operand associated with a current instruction is identical to a bit pattern stored in an operand field associated with an adjacent instruction, and if so, indicate in a control code field that the current instruction and the adjacent instruction can share the stored bit pattern.
1. A method, comprising:
determining, in a processor, if at least a portion of a bit pattern of an immediate operand associated with a current instruction is identical to a bit pattern stored in an operand field associated with an adjacent instruction; and
if so, indicating, by the processor, in a control code field that the current instruction and the adjacent instruction can share the stored bit pattern.
17. An article comprising a processor readable storage medium including instructions that enable the processor to:
determine if at least a portion of a bit pattern of an immediate operand associated with a current instruction is identical to a bit pattern stored in an operand field associated with an adjacent instruction, and if so, indicate in a control code field that the current instruction and the adjacent instruction can share the stored bit pattern.
3. The method according to
4. The method according to
5. The method according to
7. The method according to
8. The method according to
9. The method according to
12. The apparatus of
13. The apparatus of
14. The apparatus of
15. The apparatus of
16. The apparatus of
18. The article of
19. The article of
20. The article of
|
This application is a divisional of U.S. patent application Ser. No. 10/773,848 filed Feb. 5, 2004 now U.S. Pat. No. 7,321,963 which is a continuation of Ser. No. 10/339,571 filed Jan. 10, 2003 now U.S. Pat. No. 6,711,669 issued Mar. 23, 2004 which is a continuation of U.S. patent application Ser. No. 09/984,525 filed Oct. 30, 2001 now U.S. Pat. No. 7,114,057 issued Sep. 26, 2006, which is a divisional of U.S. patent application Ser. No. 09/223,299 filed Dec. 30, 1998 now U.S. Pat. No. 6,338,132 issued Jan. 8, 2002 entitled “A SYSTEM AND METHOD FOR STORING IMMEDIATE DATA” the contents of which are hereby incorporated by reference.
Program instructions control the operation of modern microprocessors. Typically, each program instruction includes a specification of the operation to be performed, the type of operands to be manipulated, and the location of these operands. A typical instruction comprises one to several programming elements. The arrangement of these programming elements is referred to as an instruction format. There are various instruction formats to implement different functionalities for any number of different microprocessors and within a single microprocessor there may be various instruction formats based on the number and type of programming elements used to comprise each instruction.
One example microprocessor, the Intel Pentium®. Pro microprocessor, recognizes various programming elements including, for example, opcodes, immediate operands, register specifiers, memory operands, scale/index/base (SIB) registers, prefixes, displacement and addressing-mode specifiers. These programming elements, either alone or in combination with other programming elements, perform a specified function when included in an instruction. For example, a register specifier specifies either a source register operand and/or a destination register operand. An example instruction comprised of (MOV A, B) is used to move a value from a source register operand (B) to a destination register operand (A).
In the above example, the programming element specifying the move function (MOV), is the opcode. The opcode specifies the operation performed by the instruction. An opcode is typically contained in each instruction, although it is not a requirement. Opcodes can specify numerous operations including, for example, moving, adding, subtracting, multiplying, dividing and storing. Some operations may have several different opcodes, each specifying a different variant of the operation, for example, an exclusive or (XOR) and a logical or (OR). Thus, by combining an opcode and one or more of the other programming elements, a complete instruction can be formed.
The processor does not understand symbolic instructions such as the example above, MOV A, B, but rather understands only bits or a series of bits. An assembler or compiler converts the symbolic instructions, usually generated using a higher level language such as the C programming language, into a long series of bits, termed binary code or machine language. In certain microprocessors, for example complex instruction set computer (CISC) processors, the instruction is further converted to a more basic unit termed a micro-op in order to be executed.
One of the programming elements listed above is an immediate operand. The immediate operand is a value included at the time of programming and is part of the program code. Unlike the example above, where the source register is the address of the value to be moved, an immediate operand is the actual value on which the operation specified by the opcode is to be performed. For example, a symbolic instruction of (MOV A, 512) is used to move the value 512 to a destination register operand (A).
A typical instruction or micro-op includes a fixed number of bits, regardless of the information to be stored in each instruction.
The above described instruction or micro-op that includes an opcode and an immediate operand works reasonably well and is an efficient use of allocated bits when the immediate operand is its maximum size. However, in the case of the average instruction, there will be no immediate operand or the immediate operand will employ less bits than the number of allocated bits. In this average case, the bits assigned to the immediate operand are wasted because the remainder of the allocated bits are unused. This was not a problem in previous implementations because the processor was only holding a few instructions or micro-ops at any given time, however modern processors can hold thousands of instructions or micro-ops causing the space employed by these instructions to become substantial.
An article comprising an instruction stored on a storage medium. The instruction includes opcode field storing an opcode signal and an operand field storing an operand signal. The operand is compressed prior to being stored in the operand field.
Embodiments of the present invention can be applied to any level of the program instruction, e.g., opcode, binary code, etc., thus, when using the term “instruction” throughout this specification it should be understood that it is not limited to any particular type of instruction. Likewise, throughout this specification the term “immediate operand” is used to describe an example type of instruction data that can be implemented using the present invention. Again, it should be understood that this is only an example, and any type of instruction operand can be used with the present invention.
The instruction 200 includes an opcode field (storing an opcode signal) 201, a control field (storing control information signals) 202 and an immediate operand field (storing an immediate operand signal) 203. In this instruction, the opcode field 201 has a bit length of X, the control field 202 has a bit length of Z and the immediate operand field 203 has a bit length of ½Y. The present invention is not limited by the exact number of bits X, ½Y, and Z assigned to the opcode field 201, the immediate operand field 203, and the control field 202, respectively, because the present invention can be implemented independent of any particular allocated bit length for these fields. The following describes a compressed immediate operand field that is one half the size of the original immediate operand field. Those skilled in the art will understand that the described compression techniques can be adapted for use in any size compressed immediate operand field, for example one-third or one-quarter the size of the original immediate operand field. Additionally, the instruction format illustrated in
An example instruction according to the present invention allocates both a minimum number of bits and a fixed number of bits to the immediate operand field 203. For example, a number of bits allocated to the immediate operand field 203 may be one half the size of the maximum immediate operand, i.e., ½Y. For example, if the size of the maximum immediate operand (Y) is 32 bits, (½Y) 16 bits may be allocated to the immediate operand field 203 in the instruction format of
There are several compression techniques that can be used to reduce an immediate operand that is larger than one half the size of the maximum immediate operand. These compression techniques include, for example, sign extending, back scavenging, forward scavenging and sharing, all of which will be described in greater detail below. Of course, other compression techniques may be utilized. These compression techniques may be performed, for example, because when executing any instruction, the processor is capable of reading an immediate operand for the instruction to be executed from either the previous or next instruction. Second, an immediate operand can be compressed because the number of significant bits employed to represent the immediate operand is less than the number of bits allocated to the immediate operand.
The signals (e.g., bits) stored in the control field 202 in example instruction format illustrated by instruction 200 controls the immediate operand by specifying whether immediate operand compression is to be used and which compression technique to use.
The following is a description of the various compression techniques that can be used to compress an immediate operand according to the present invention. In these descriptions of the compression techniques, reference is made to instructions, but it should be understood that this reference is equally applicable to a full line of programming code, an individual micro-op, or any other subpart of a programming instruction. Instructions are stored with their full immediate operand and compressed for processing by an instruction pipeline or processor. The compression techniques may be performed by the processor prior to execution of the instruction. However, these compression techniques may also be performed at different stages of program processing (by software or hardware), for example, during the translation from higher level language to machine language by the compiler or assembler, or during an instruction decode phase in the instruction pipeline.
Sign Extension: Sign extension is commonly used to extend a smaller integer value into a larger integer value by padding the extra bits. For example, a 16 bit signed integer (bits 0-15) can be extended to a 32 bit signed integer by padding the new bits, bits 16-31, using the sign bit value. In the case of a 16 bit negative integer, the sign bit, bit 15, would have a bit value of 1, thus to extend the 16 bit negative integer to a 32 bit negative integer, bits 16-31 would be padded with the sign bit value of 1. Unsigned integers, on the other hand, are extended to the new size by filling all the newly arising bits with 0s. This technique is helpful in working with immediate operands, because as described above, in prior art instruction formats the immediate operand field is generally the size of the maximum immediate operand. Thus, in the average case where the number of bits employed to represent the value of the immediate operand is significantly less than the maximum number of bits, the immediate operand is extended to fill the allocated number of bits.
Sign extension can also be used to compress the immediate operand into a less extensive format because the number of bits needed to represent the value of the immediate operand is less than the number of bits allocated to the immediate operand field. Specifically, if the number of bits employed to represent the immediate operand is less than or equal to half the size of the number of bits allocated to the immediate operand, the immediate operand can be compressed using sign extension, into the improved instruction format of
The sign extension compression for the immediate operand from
Back Scavenging: Back scavenging allows an immediate operand to be compressed because the immediate operand or a portion of the immediate operand for a current instruction can be stored in the previous instruction. An example of back scavenging will be described with reference to
The signals stored in control fields 522, 532 may be used to inform the processor that back scavenging is taking place. For example, the signals stored in the control field 522 of instruction 520 can inform the processor that the value stored in the immediate operand field 523 is not a portion of the current instruction 520 and should be ignored when executing the line. The signals stored in control field 532 of instruction 530 can inform the processor that the value stored in the immediate operand field 533 is not the complete immediate operand for that instruction. Thus, half of the immediate operand is stored in the previous instruction 520. The processor, when executing instruction 530, will read the 16 bit immediate operands stored in the immediate operand fields 523, 533 of instructions 520-530 as a single 32 bit immediate operand for instruction 530. Thus, through the use of back scavenging the 32 bits allocated to the immediate operand in instructions 500-510 in
Forward Scavenging: Forward scavenging allows an immediate operand to be compressed because the immediate operand or a portion of the immediate operand for a current instruction can be stored in the next instruction in a sequence of instructions. An example of forward scavenging will be described with reference to
The signals stored in control fields 622, 632, although not necessarily employed as described above, may be used to inform the processor that forward scavenging is taking place. For example, the signals stored in control field 622 of instruction 620 can inform the processor that the value stored in the immediate operand field 623 is not the complete immediate operand for that instruction, half of the immediate operand is stored in the immediate operand field 633 of the next instruction 630. The control portion of instruction 630 can inform the processor that the value stored in the immediate operand field 633 is not a portion of the current instruction and should be ignored when executing instruction 630. The processor, when executing instruction 620, will read the 16 bit immediate operands stored in the immediate operand fields 623, 633 of instruction 620-630 as a single 32 bit immediate operand for instruction 620. Thus, through the use of forward scavenging, the 32 bits allocated to the immediate operand fields 602,612 in instructions 600-610 in
Sharing: Sharing allows an immediate operand to be compressed because two instructions have the same immediate operand, or a portion of the immediate operand bit pattern for the two instructions are the same. An example of sharing will be described with reference to
The immediate operand stored in immediate operand field 723 of instruction 720 of
In this manner, two instructions can share an immediate operand stored in only one instruction. The advantage of this sharing is that the immediate operand field in the second instruction becomes empty, making it possible for that second instruction to be involved in another compression scheme for the next instruction. For example, if an instruction followed instruction 730, and this next instruction employed back scavenging to reduce its immediate operand, the immediate operand field 733 of instruction 730 would be available to handle the back scavenging for the next instruction.
The above example of sharing shows that the common immediate operand for two instructions stored in the first of the two instructions, however, it should be understood that the common immediate operand can just as easily be stored in the second instruction, thus creating an empty immediate operand field in the first instruction.
The above described methods of compressing the immediate operand, can also be combined to form other methods of compression. The above example of sharing explained with reference to
The signals stored in control fields 842, 852 can be used to inform the processor that sign extension/back scavenging is taking place. For example, the signals stored in control field 842 of instruction 840 can inform the processor that the value stored in the immediate operand field 843 is not a portion of the current instruction and should be ignored when executing instruction 840. Whereas, the signals stored in control field 852 of instruction 850 can inform the processor that even though there is no value stored in the immediate operand field 853, an immediate operand is employed for the execution of instruction 850. The processor when executing instruction 850 will read the 16 bit immediate operand stored in the immediate operand field 843 of instruction 840 as a 16 bit immediate operand for instruction 850. Thus, through the use of sign extension/back scavenging the 32 bits allocated to the immediate operand fields 802, 812 in instructions 800-810 in
The interaction of the above described compression schemes will be described in connection with the flow chart of
The process then determines whether the immediate operand field of the previous instruction is available (908). The purpose of determining whether the immediate operand field of the previous instruction is available first is that it may be desirable that the immediate operand for the present instruction be stored in the previous instruction rather than the next instruction.
This is because the immediate operand field of the previous instruction is empty, the only immediate operand that can be used to fill that field is the immediate operand in the current instruction. If the current instruction does not store the immediate operand in the empty immediate operand field of the previous instruction, that space will remain empty. In the case of an empty immediate operand field of the next instruction, that field may be filled with an immediate operand from both the current instruction or the instruction immediately subsequent to the next instruction. Therefore, an efficient use of the immediate operand fields may be to allow that field of the next instruction to remain empty for later use, unless the field in both the previous and current instruction are filled. A method of compression may be the technique that stores the immediate operand in the previous instruction, then the current instruction, and lastly in the next instruction. Thus, if the immediate operand field of the previous instruction is available, the process proceeds to for back scavenging of the immediate operand of the current instruction is performed (910). This back scavenging could be either true back scavenging, described above, where the immediate operand is split and a portion stored in the immediate operand field of the previous instruction and a portion stored in the immediate operand field of the current instruction or a combination of sign extension/back scavenging, also described above, where the entire immediate operand for the current instruction is stored in the immediate operand field of the previous instruction.
If the immediate operand field of the previous instruction is not available, the process determines whether the bit pattern stored in the immediate operand field of the previous instruction matches the bit pattern or a portion of the bit pattern of the immediate operand of the current instruction (912). If these bit patterns match, the immediate operand stored in the immediate operand field of the previous instruction can be shared by the current instruction and the previous instruction (914). If these bit patterns do not match, the process determines whether the immediate operand field of the current instruction is available (916). The immediate operand field of the current instruction may become unavailable, for example, if it was used for the purpose of forward scavenging the immediate operand of the previous instruction. If the immediate operand field is available, the process determines whether sign extension had been previously performed on the immediate operand of the current instruction (918). If sign extension had occurred, the immediate operand could be stored in the immediate operand field of the current instruction, therefore processing of this instruction is complete and the process can skip to the next instruction to begin the process for the next instruction (928). If sign extension had not been performed on the immediate operand it would remain too large to fit into the smaller immediate operand field of the current instruction or if the immediate operand field of the current instruction is unavailable (916) the process proceeds (920).
Next, it is determined whether the immediate operand field of the next instruction is available or can be made available through one of the compression techniques to be performed on the immediate operand of the next instruction (920). If the immediate operand field of the next instruction is available or can be made available, forward scavenging of the immediate operand of the current instruction is performed (922). This forward scavenging could be either true forward scavenging, described above, where the immediate operand is split and a portion stored in the immediate operand field of the current instruction and a portion stored in the immediate operand field of the next instruction or a combination of sign extension/forward scavenging, where the entire immediate operand for the current instruction is stored in the immediate operand field of the next instruction.
If the immediate operand field of the next instruction is not available and cannot be made available, the process determines whether the bit pattern stored in the immediate operand field of the next instruction matches the bit pattern or a portion of the bit pattern of the immediate operand of the current instruction (924). If these bit patterns match, the immediate operand stored in the immediate operand field of the next instruction can be shared by the current instruction and the next instruction (914).
If these bit patterns do not match, a blank instruction or a no-op instruction may be inserted (926). This signifies that a new instruction is created which does not contain an opcode, but is an instruction created solely for the purpose of creating an extra immediate operand field in the rare case that the compression techniques are not sufficient to compress the immediate operands into corresponding instructions. After the no-op instruction is created, forward scavenging of the immediate operand of the current instruction is performed (922). This forward scavenging, as described above, could be either split the immediate operand and store a portion in the immediate operand field of the current instruction and store a portion in the immediate operand field of the no-op instruction or store the entire immediate operand for the current instruction in the immediate operand field of the no-op instruction. Creating a no-op instruction is rare because, as stated above, it is more common for an instruction to not contain an immediate operand than to contain an immediate operand. Therefore in the normal case, there are a sufficient number of empty immediate operand fields to accommodate the compression of those instructions that contain immediate operands. As can be seen from
Instructions 1005, 1010, 1030, and 1035 employ 32 bits to represent their immediate operand, instructions 1015, 1025, 1040, 1045 and 1050 employ 16 bits to represent their immediate operand, and instructions 1000 and 1020 do not have any immediate operands. Again, the bit lengths in
Instructions 1100-1155 are in the example instruction format according to the present invention. Each of instructions 1100-1155 have a fixed number of bits allocated to the opcode fields 1101-156, a fixed number of bits allocated to the control fields 1102-1157 and a fixed number of bits allocated to the immediate operand fields 1103-1158. In this example, the fixed number of bits allocated to the immediate operand fields 1103-1158 is 16 bits, half the number allocated to the immediate operand fields 1002-1052 for instructions 1000-1050. The column between the two sets of instructions shows the compression techniques used to compress the immediate operand of instructions 1000-1050 into the immediate operand fields 1103-1158 of instructions 1100-1155.
Instruction 1000 had no immediate operand and employs no compression for reformatting into instruction 1100. Thus, the process can advance to the next instruction (902 of
Instruction 1005 has an immediate operand employing 32 bits, therefore compression of the immediate operand is employed for formatting into instruction 1105. In this case, the immediate operand cannot be sign extended (904 and 906 of
Instruction 1010 has an immediate operand employing 32 bits, therefore compression of the immediate operand is employed for formatting into instruction 1110. In this case, the immediate operand cannot be sign extended (904 and 906 of
As can be seen from
Instruction 1045 has an immediate operand employing 16 bits, therefore compression of the immediate operand is employed for formatting into instruction 1145. In this case, the immediate operand can be sign extended (904 and 906 of
While the present invention has been particularly shown and described with reference to an example embodiment, in particular the above examples of showing the various compression techniques for the immediate operand using immediate operand bit lengths of 32 and 16 bits, but it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention.
While the present invention has been described with respect to a limited number of embodiments, those skilled in the art will appreciate numerous modifications and variations therefrom. It is intended that the appended claims cover all such modifications and variations as fall within the true spirit and scope of this present invention.
Hammarlund, Per, Alexander, William, Kyker, Alan B., Lee, Chan, Ahuja, Hitesh, Krick, Robert F., Rohlman, Joseph
Patent | Priority | Assignee | Title |
11036512, | Sep 23 2019 | Microsoft Technology Licensing, LLC | Systems and methods for processing instructions having wide immediate operands |
Patent | Priority | Assignee | Title |
4724517, | Nov 26 1982 | SGS-Thomson Microelectronics Limited | Microcomputer with prefixing functions |
5303358, | Jan 26 1990 | Apple Inc | Prefix instruction for modification of a subsequent instruction |
5625784, | Jul 27 1994 | ATI Technologies ULC | Variable length instructions packed in a fixed length double instruction |
5745722, | Jun 15 1995 | SANYO ELECTRIC CO , LTD | Apparatus for decoding instruction immediate data to produce a string having a single bit different from other bit thereof |
5784585, | Apr 05 1994 | Motorola, Inc. | Computer system for executing instruction stream containing mixed compressed and uncompressed instructions by automatically detecting and expanding compressed instructions |
5819058, | Feb 28 1997 | HANGER SOLUTIONS, LLC | Instruction compression and decompression system and method for a processor |
5896519, | Jun 10 1996 | AVAGO TECHNOLOGIES GENERAL IP SINGAPORE PTE LTD | Apparatus for detecting instructions from a variable-length compressed instruction set having extended and non-extended instructions |
5905893, | Jun 10 1996 | AVAGO TECHNOLOGIES GENERAL IP SINGAPORE PTE LTD | Microprocessor adapted for executing both a non-compressed fixed length instruction set and a compressed variable length instruction set |
5915109, | Aug 12 1996 | Renesas Electronics Corporation | Microprocessor for processing a saturation instruction of an optional-bit length value |
6038657, | Oct 06 1995 | AMD TECHNOLOGIES HOLDINGS, INC ; GLOBALFOUNDRIES Inc | Scan chains for out-of-order load/store execution control |
6049862, | Jul 19 1996 | III Holdings 6, LLC | Signal processor executing compressed instructions that are decoded using either a programmable or hardwired decoder based on a category bit in the instruction |
6167505, | Dec 20 1995 | Seiko Epson Corporation | Data processing circuit with target instruction and prefix instruction |
6253314, | Apr 06 1994 | Mitsubishi Denki Kabushiki Kaisha | Instruction set and executing method of the same by microcomputer |
6338132, | Dec 30 1998 | Intel Corporation | System and method for storing immediate data |
6564314, | Jun 21 1994 | Apple Inc | Computer instruction compression |
6711669, | Dec 30 1998 | Intel Corporation | System and method for storing immediate data |
7114057, | Dec 30 1998 | Intel Corporation | System and method for storing immediate data |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Oct 17 2007 | Intel Corporation | (assignment on the face of the patent) | / |
Date | Maintenance Fee Events |
Nov 13 2012 | ASPN: Payor Number Assigned. |
Jan 10 2014 | REM: Maintenance Fee Reminder Mailed. |
Jun 01 2014 | EXP: Patent Expired for Failure to Pay Maintenance Fees. |
Date | Maintenance Schedule |
Jun 01 2013 | 4 years fee payment window open |
Dec 01 2013 | 6 months grace period start (w surcharge) |
Jun 01 2014 | patent expiry (for year 4) |
Jun 01 2016 | 2 years to revive unintentionally abandoned end. (for year 4) |
Jun 01 2017 | 8 years fee payment window open |
Dec 01 2017 | 6 months grace period start (w surcharge) |
Jun 01 2018 | patent expiry (for year 8) |
Jun 01 2020 | 2 years to revive unintentionally abandoned end. (for year 8) |
Jun 01 2021 | 12 years fee payment window open |
Dec 01 2021 | 6 months grace period start (w surcharge) |
Jun 01 2022 | patent expiry (for year 12) |
Jun 01 2024 | 2 years to revive unintentionally abandoned end. (for year 12) |