Instruction processing method and related device

By detecting the mapping relationship of the source flag architecture register during the processor's instruction renaming stage, and storing only one copy of the source flag and physical register information, the problem of source register storage and retrieval overhead is solved, achieving more efficient instruction processing.

WO2026242507A1PCT designated stage Publication Date: 2026-11-26HYGON INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2026/075181
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-05-22
Filing Date
2026-01-27
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

How to reduce the storage and retrieval overhead of source registers when the processor processes instructions.

Method used

During the renaming phase of the target instruction, it is checked whether multiple source flag architecture registers are mapped to the same physical register. If so, only one set of source flag architecture register and physical register information is stored during the renaming, execution, and exit phases, and the values ​​of multiple source flags are read at once during the execution phase.

Benefits of technology

This reduces storage overhead and lowers the power consumption for reading the source flag, thus improving processor efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2026075181_26112026_PF_FP_ABST
    Figure CN2026075181_26112026_PF_FP_ABST
Patent Text Reader

Abstract

An instruction processing method and a related device. The instruction processing method comprises: at a renaming stage of a target instruction, detecting whether a plurality of source flag architecture registers of the target instruction are mapped to a same physical register; and if the detection result is yes, storing, at each of the renaming stage, an execution stage, and an exit stage of the target instruction, only one piece of information in respect of the source flag architecture registers and the physical register to which the source flag architecture registers are mapped, and at the execution stage of the target instruction, on the basis of the stored one piece of information in respect of the source flag architecture registers and the physical register to which the source flag architecture registers are mapped, reading, from the corresponding physical register, all at once, values of a plurality of source flags corresponding to the target instruction.
Need to check novelty before this filing date? Find Prior Art

Description

Instruction processing methods and related equipment

[0001] Cross-reference to related applications

[0002] This application claims priority to Chinese Patent Application No. 202510668584.8, filed on May 22, 2025, the disclosure of which is incorporated herein by reference in its entirety. Technical Field

[0003] This disclosure relates to an instruction processing method and related equipment. Background Technology

[0004] Instruction Set Architecture (ISA) is a set of instructions that can be decoded and executed by a processor, including but not limited to Intel's x86 instruction set architecture, ARM's standard ARM instruction set architecture, and Thumb instruction set architecture.

[0005] When executing instructions from instruction set architectures such as x86, modern processors typically employ pipelining technology to process instructions in parallel, thereby improving instruction processing efficiency.

[0006] However, how to reduce the storage and retrieval overhead of source registers when the processor processes instructions has become a technical problem that urgently needs to be solved in this field. Summary of the Invention

[0007] The problem addressed by the embodiments of this disclosure is to provide an instruction processing method and related apparatus that can reduce the storage and retrieval overhead of source registers when the processor processes instructions.

[0008] To address the above problems, at least one embodiment of this disclosure provides an instruction processing method, including:

[0009] During the renaming phase of the target instruction, it is detected whether multiple source flag architecture registers of the target instruction are mapped to the same physical register;

[0010] If the detection result is yes, then in the renaming stage, execution stage and exit stage of the target instruction, only one copy of the source flag architecture register and the information of the mapped physical register are stored respectively. In the execution stage of the target instruction, based on the stored information of the source flag architecture register and the mapped physical register, the values ​​of multiple source flags corresponding to the target instruction are read from the corresponding physical register at one time.

[0011] Optionally, the instruction processing method further includes: if the detection result is negative, triggering an exception; and in response to triggering the exception, performing a pipeline flushing operation during the exit phase of the target instruction.

[0012] Optionally, after performing the pipeline flushing operation, the instruction processing method further includes: putting the instruction back into the instruction pipeline for processing, and at each stage of putting the instruction back into the instruction pipeline for processing, obtaining and storing information of all source registers corresponding to the target instruction.

[0013] Optionally, after performing the pipeline flushing operation, the instruction processing method further includes: recording the instruction address information of the target instruction; when it is determined based on the instruction address information of the target instruction that the target instruction will re-enter the instruction pipeline for processing, at each stage when the target instruction re-enters the instruction pipeline for processing, obtaining and storing the information of all source registers corresponding to the target instruction.

[0014] Optionally, before detecting whether multiple source flag architecture registers of the target instruction are mapped to the same physical register, the instruction processing method further includes: in the instruction fetch stage, decode stage and allocation stage before the renaming stage of the target instruction, respectively, obtaining and storing the information of all source registers corresponding to the target instruction.

[0015] Optionally, the target instruction includes the conditional move instruction CMOVcc.

[0016] Accordingly, at least one embodiment of this disclosure also provides an instruction processing apparatus, including:

[0017] The instruction pipeline structure is suitable for detecting whether multiple source flag architecture registers of the target instruction are mapped to the same physical register during the renaming stage of the target instruction. If the detection result is yes, then only one set of information on the source flag architecture register and the mapped physical register is stored during the renaming stage, execution stage, and exit stage of the target instruction, respectively. During the execution stage of the target instruction, the values ​​of multiple source flags corresponding to the target instruction are read from the corresponding physical register at once based on the stored information on the source flag architecture register and the mapped physical register.

[0018] Optionally, the instruction pipeline structure is further adapted to trigger an exception if the detection result is negative; in the exit phase of the target instruction, in response to the triggered exception, a pipeline flushing operation is performed.

[0019] Optionally, the instruction pipeline structure is further adapted to re-enter the instruction into the instruction pipeline for processing after performing the pipeline flushing operation, and to obtain and store the information of all source registers corresponding to the target instruction at each stage of re-entering the instruction into the instruction pipeline for processing.

[0020] Optionally, the instruction pipeline structure is further adapted to record the instruction address information of the target instruction after performing the pipeline flushing operation; when it is determined based on the instruction address information of the target instruction that the target instruction will re-enter the instruction pipeline for processing, at each stage when the target instruction re-enters the instruction pipeline for processing, the information of all source registers corresponding to the target instruction is obtained and stored respectively.

[0021] Optionally, the instruction pipeline structure is further adapted to obtain and store information of all source registers corresponding to the target instruction during the fetch, decode, and allocation stages before the renaming stage of the target instruction, before detecting whether multiple source flag architecture registers of the target instruction are mapped to the same physical register.

[0022] Optionally, the target instruction includes the conditional move instruction CMOVcc.

[0023] Accordingly, at least one embodiment of this disclosure also provides a computer device, including at least one memory and at least one processor, wherein the memory stores one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the instruction processing method as described in any of the preceding claims.

[0024] Accordingly, at least one embodiment of this disclosure also provides a computer program product, including a computer program / instructions, which, when executed by a processor, are used to implement the instruction processing method as described in any of the preceding claims.

[0025] Accordingly, at least one embodiment of this disclosure also provides a storage medium storing one or more computer instructions for implementing the instruction processing method as described in any of the preceding claims.

[0026] The technical solution of this disclosure has the following advantages:

[0027] The instruction processing method provided in at least one embodiment of this disclosure includes: in the renaming stage of a target instruction, detecting whether multiple source flag architecture registers of the target instruction are mapped to the same physical register; if the detection result is yes, then in the renaming stage, execution stage and exit stage of the target instruction, storing only one set of information on the source flag architecture registers and the mapped physical registers respectively; and in the execution stage of the target instruction, reading the values ​​of multiple source flags corresponding to the target instruction from the corresponding physical registers at once based on the stored set of information on the source flag architecture registers and the mapped physical registers.

[0028] The instruction processing method provided in at least one embodiment of this disclosure, during the renaming stage of the target instruction, if it is detected that multiple source flag registers corresponding to the target instruction are mapped to the same physical register, then during the renaming stage, execution stage, and exit stage of the target instruction, only one set of information on the source flag architecture register and the mapped physical register is stored, which helps to reduce storage overhead. Furthermore, during the execution stage of the target instruction, based on the stored information on the source flag architecture register and the mapped physical register, the values ​​of multiple source flags corresponding to the target instruction can be read from the corresponding physical register at once, which helps to reduce the power consumption of reading source flags. Attached Figure Description

[0029] Figure 1 is a flowchart illustrating an embodiment of the instruction processing method provided in this disclosure.

[0030] Figure 2 is a schematic diagram of an instruction processing pipeline;

[0031] Figure 3 is a schematic diagram of a flag register;

[0032] Figure 4 is a schematic diagram of an embodiment of the instruction processing device provided in this disclosure; and

[0033] Figure 5 is a schematic diagram of an optional hardware structure of the computer device provided in this disclosure. Detailed Implementation

[0034] As the background technology shows, how to reduce the storage and reading overhead of the source flag register when the processor processes instructions has become a technical problem that urgently needs to be solved in this field.

[0035] To address the aforementioned technical problems, at least one embodiment of this disclosure provides an instruction processing method comprising: during the renaming phase of a target instruction, detecting whether multiple source flag architecture registers of the target instruction are mapped to the same physical register; if the detection result is yes, then during the renaming phase, execution phase, and exit phase of the target instruction, storing only one set of information on the source flag architecture registers and the mapped physical registers respectively; and during the execution phase of the target instruction, reading the values ​​of multiple source flags corresponding to the target instruction from the corresponding physical registers at once based on the stored set of information on the source flag architecture registers and the mapped physical registers.

[0036] The instruction processing method provided in at least one embodiment of this disclosure, during the renaming stage of the target instruction, if it is detected that multiple source flag registers corresponding to the target instruction are mapped to the same physical register, then during the renaming stage, execution stage, and exit stage of the target instruction, only one set of information on the source flag architecture register and the mapped physical register is stored, which helps to reduce storage overhead. Furthermore, during the execution stage of the target instruction, based on the stored information on the source flag architecture register and the mapped physical register, the values ​​of multiple source flags corresponding to the target instruction can be read from the corresponding physical register at once, which helps to reduce the power consumption of reading source flags.

[0037] Figure 1 shows a flowchart of an embodiment of the instruction processing method provided by this disclosure. Referring to Figure 1, an instruction processing method may specifically include the following steps:

[0038] Step S110: During the renaming phase of the target instruction, detect whether the multiple source flag architecture registers of the target instruction are mapped to the same physical register;

[0039] Step S120: If the detection result is yes, then in the renaming stage, execution stage and exit stage of the target instruction, only one copy of the source flag architecture register and the information of the mapped physical register are stored respectively. In the execution stage of the target instruction, based on the stored information of the source flag architecture register and the mapped physical register, the values ​​of multiple source flags corresponding to the target instruction are read from the mapped physical register.

[0040] In one exemplary embodiment, the instruction processing method further includes:

[0041] Step S130: If the detection result is negative, an exception is triggered; in the exit phase of the target instruction, in response to the triggered exception, a pipeline flushing operation is performed.

[0042] In one exemplary embodiment, after performing the pipeline flushing operation, the instruction processing method further includes:

[0043] Step S140: The instruction is put back into the instruction pipeline for processing, and at each stage of putting the instruction back into the instruction pipeline for processing, the information of all source registers corresponding to the target instruction is obtained and stored.

[0044] Please continue referring to Figure 1 and execute step S110. In the renaming stage of the target instruction, detect whether the multiple source flag architecture registers of the target instruction are mapped to the same physical register.

[0045] During the renaming phase of the target instruction, it is detected whether multiple source flag architecture registers of the target instruction are mapped to the same physical register. This provides a basis for storing only one set of information about the source flag architecture register and the mapped physical register during the renaming phase, execution phase, and exit phase of the target instruction if the detection result is yes. Furthermore, during the execution phase of the target instruction, multiple source flags corresponding to the target instruction are read from the mapped physical register based on the stored information about the source flag architecture register and the mapped physical register.

[0046] To improve performance, CPUs can use a pipelined approach to process instructions. This means that the processing of an instruction is divided into multiple pipeline stages, and an instruction can only run in one pipeline stage at a time. Referring to Figure 2, the instruction pipeline shown includes the fetch stage, decode stage, allocation stage, execution stage, and exit stage.

[0047] In instruction set architectures such as x86, conditional instructions can be executed using multiple flags. For example, the Carry Flag (CF) is used for carry conditions, the Parity Flag (PF) for parity conditions, the Auxiliary Carry Flag (AF) for auxiliary carry conditions, the Zero Flag (ZF) for zero conditions, the Sign Flag (SF) for sign conditions, the Direction Flag (DF) for direction conditions, and the Overflow Flag (OF) for overflow conditions. Specifically, the Carry Flag (CF), Parity Flag (PF), Auxiliary Flag (AF), Zero Flag (ZF), Sign Flag (SF), and Overflow Flag (OF) are used for the operation result, while the Direction Flag (DF) is used for status control.

[0048] Figure 3 shows the structure of a flag register with a 64-bit width, wherein the carry flag CF, parity flag PF, auxiliary carry flag AF, zero flag ZF, sign flag SF, direction flag DF, and overflow flag OF are located at bits 0, 2, 4, 6, 7, 10, and 11 of the flag register, respectively.

[0049] The Conditional Move instruction is a type of conditional instruction that moves data based on a condition. It is used to move data from one position to another according to a given condition. For example, consider the following Conditional Move instruction, CMOVcc:

[0050] if (a >= b)

[0051] a = b.

[0052] For the aforementioned conditional move instruction, the processing procedure includes: using the ALU to perform a subtraction operation between variables a and b, and setting the corresponding flag in the flag register to 1 or 0 according to the result of the subtraction operation. Then, based on the value of the corresponding flag in the flag register, it is determined whether to perform a data move operation.

[0053] Taking a conditional move instruction as an example, the execution of a conditional move instruction typically requires the use of multiple flags, such as the zero flag (ZF), the sign flag (SF), and the carry flag (CF). A conditional move instruction may use the values ​​of multiple flags, but these flags are all generated by the same instruction. The instruction that generates these flags can be a comparison instruction (cmp a,b) that compares the size of variable b. Of course, the target instruction in this application is not limited to conditional instructions.

[0054] Correspondingly, during the renaming stage of the instruction pipeline of the target instruction, multiple flag bits generated by the same instruction are usually stored in the same physical register. That is, multiple source flag bit architecture registers of the conditional move instruction will be mapped to the same physical register.

[0055] Therefore, during the renaming phase of the target instruction, it is detected whether multiple source flag architecture registers of the target instruction are mapped to the same physical register, so as to provide a basis for simplifying the storage of the mapping relationship between the source flag architecture registers and physical registers in the future.

[0056] In one exemplary embodiment, the operation of detecting whether the multiple source flags of the target instruction are mapped to the same physical register is performed by comparing the mappings of multiple source flags of the target instruction to physical registers.

[0057] Please continue with reference to Figure 1 and execute step S120. If the detection result is yes, then in the renaming stage, execution stage and exit stage of the target instruction, only one copy of the source flag architecture register and the information of the mapped physical register are stored respectively. In the execution stage of the target instruction, based on the stored information of the source flag architecture register and the mapped physical register, the values ​​of multiple source flags corresponding to the target instruction are read from the corresponding physical register at one time.

[0058] If the detection result is yes, that is, during the renaming phase of the target instruction, it is detected that multiple source flag architecture registers of the target instruction are mapped to the same physical register, then during the renaming phase, execution phase, and exit phase of the target instruction, only one copy of the information of the source flag architecture register and the mapped physical register is stored. Compared with the method of storing the information of multiple source flag architecture registers and the mapped physical registers of the target instruction separately during the renaming phase, execution phase, and exit phase of the target instruction, this method is beneficial for saving storage overhead.

[0059] More importantly, during the execution phase of the target instruction, the values ​​of multiple source flags corresponding to the target instruction are read from the corresponding physical registers at once based on the stored information of a source flag architecture register and the mapped physical registers. This method saves reading power consumption compared to reading the values ​​of multiple flags from the mapped physical registers multiple times based on the mapping relationship between the stored source flag architecture registers and physical registers.

[0060] In an exemplary embodiment, before detecting whether multiple source flag architecture registers of the target instruction are mapped to the same physical register, the instruction processing method further includes: step S105, obtaining and storing information of all source registers corresponding to the target instruction in the instruction fetch stage, decode stage and allocation stage before the renaming stage of the target instruction.

[0061] In the fetch, decode, and allocation stages preceding the renaming stage of the target instruction, information on all source registers corresponding to the target instruction is obtained and stored, ensuring the correct execution of the fetch, decode, and allocation operations of the target instruction.

[0062] In one exemplary embodiment, the information of all source registers corresponding to the target instruction includes the information of the source operand register number and the source flag bit schema register number.

[0063] Please continue with reference to Figure 1 and execute step S130. If the detection result is negative, an exception is triggered. In the exit phase of the target instruction, in response to the triggered exception, a pipeline flushing operation is executed.

[0064] If the detection result is negative, that is, during the renaming stage of the target instruction, it is detected that multiple source flag architecture registers of the target instruction are mapped to at least two different physical registers, then during the renaming stage, execution stage, and exit stage of the target instruction, only one set of information on the source flag architecture registers and the mapped physical registers is stored. Furthermore, during the execution stage of the target instruction, based on the stored set of information on the source flag architecture registers and the mapped physical registers, it will be impossible to read the values ​​of multiple source flags corresponding to the target instruction from the corresponding physical registers at once, thereby leading to the incorrect execution of the target instruction.

[0065] Accordingly, during the renaming phase of the target instruction, if it is detected that multiple source flag architecture registers of the target instruction are mapped to at least two different physical registers, an exception is triggered. In the exit phase of the target instruction, in response to the triggered exception, a pipeline flushing operation is performed to clear the target instruction and subsequent instructions, so as to restart the processing of the target instruction and ensure the correct execution of the target instruction.

[0066] Please continue referring to Figure 1 and execute step S140. After the pipeline flushing operation is performed, the instruction is put back into the instruction pipeline for processing. At each stage of putting the instruction back into the instruction pipeline for processing, the information of all source registers corresponding to the target instruction is obtained and stored.

[0067] During the renaming phase of the target instruction, if it is detected that multiple source flag architecture registers of the target instruction are mapped to at least two different physical registers, the instruction is put back into the instruction pipeline for processing after the pipeline flushing operation is performed. In each stage of putting the instruction back into the instruction pipeline for processing, the information of all source registers corresponding to the target instruction is obtained and stored, which can ensure the correct execution of the target instruction.

[0068] Specifically, the phrase "in each stage of re-entering the instruction into the instruction pipeline for processing, obtaining and storing the information of all source registers corresponding to the target instruction" means that when reprocessing the target instruction, the information of all source registers corresponding to the target instruction is obtained and stored in the corresponding instruction fetch stage, decoding stage, allocation stage, renaming stage, execution stage, and exit stage, respectively, rather than using the instruction processing method of this application to process the target instruction.

[0069] In an exemplary embodiment, after performing the pipeline flushing operation, the instruction processing method further includes: recording the instruction address information of the target instruction; when it is determined, based on the instruction address information of the target instruction, that the target instruction will re-enter the instruction pipeline for processing, at each stage when the target instruction re-enters the instruction pipeline for processing, acquiring and storing the information of all source registers corresponding to the target instruction.

[0070] Pipeline flushing causes a temporary clearing of the instruction pipeline, meaning the processor needs to start executing new instructions from the fetch stage again, resulting in a performance penalty because it takes time to refill the pipeline.

[0071] After the pipeline flushing operation is performed, the instruction address information of the target instruction is recorded. When it is determined that the target instruction will re-enter the instruction pipeline for processing based on the instruction address information of the target instruction, the information of all source registers corresponding to the target instruction is obtained and stored at each stage of the target instruction re-entering the instruction pipeline for processing. This can reduce the frequency of pipeline flushing operations and thus minimize the impact on processor performance.

[0072] Accordingly, at least one embodiment of this disclosure also provides an instruction processing apparatus.

[0073] Figure 4 shows a schematic diagram of an embodiment of the instruction processing apparatus provided in this disclosure. Referring to Figure 4, an instruction processing apparatus 40 may include: an instruction pipeline structure 401, adapted to detect, during the renaming stage of a target instruction, whether multiple source flag architecture registers of the target instruction are mapped to the same physical register; if the detection result is yes, then during the renaming stage, execution stage, and exit stage of the target instruction, only one set of information on the source flag architecture registers and the mapped physical registers is stored respectively, and during the execution stage of the target instruction, multiple source flags corresponding to the target instruction are read from the mapped physical registers based on the stored information on the source flag architecture registers and the mapped physical registers.

[0074] In an exemplary embodiment, the instruction pipeline structure 401 is further adapted to trigger an exception if the detection result is negative; and in response to the triggering of the exception during the exit phase of the target instruction, to perform a pipeline flushing operation.

[0075] In an exemplary embodiment, the instruction pipeline structure 401 is further adapted to re-enter the instruction into the instruction pipeline for processing after performing a pipeline flushing operation, and to obtain and store information of all source registers corresponding to the target instruction at each stage of re-entering the instruction into the instruction pipeline for processing.

[0076] In an exemplary embodiment, the instruction pipeline structure 401 is further adapted to record the instruction address information of the target instruction after performing a pipeline flushing operation; when it is determined, based on the instruction address information of the target instruction, that the target instruction will re-enter the instruction pipeline for processing, at each stage when the target instruction re-enters the instruction pipeline for processing, the information of all source registers corresponding to the target instruction is obtained and stored respectively.

[0077] In an exemplary embodiment, the instruction pipeline structure 401 is further adapted to acquire and store information of all source registers corresponding to the target instruction during the fetch stage, decode stage, and allocation stage before the renaming stage of the target instruction, before detecting whether multiple source flag architecture registers of the target instruction are mapped to the same physical register.

[0078] In one exemplary embodiment, the target instruction includes the conditional move instruction CMOVcc.

[0079] The instruction processing apparatus in at least one embodiment of this disclosure can be used to execute the aforementioned instruction processing method, or other functional modules can be used to execute the aforementioned instruction processing method. For a detailed description of the instruction processing method provided in at least one embodiment of this disclosure, please refer to the foregoing section; it will not be repeated here.

[0080] Accordingly, at least one embodiment of this disclosure also provides a computer device that can implement the instruction processing method provided in at least one embodiment of this disclosure by loading a program.

[0081] Referring to Figure 5, a schematic diagram of an optional hardware structure of a computer device provided in an embodiment of the present disclosure is shown. The computer device in at least one embodiment of the present disclosure includes: at least one processor 01, at least one communication interface 02, at least one memory 03, and at least one communication bus 04.

[0082] In this embodiment, the number of processor 01, communication interface 02, memory 03 and communication bus 04 is at least one, and processor 01, communication interface 02 and memory 03 communicate with each other through communication bus 04.

[0083] Communication interface 02 can be an interface for a communication module used for network communication, such as the interface for a GSM module.

[0084] Processor 01 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the instruction processing method of this embodiment.

[0085] The memory 03 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device. The memory 03 stores one or more computer instructions, which are executed by the processor 01 to implement the instruction processing method provided in at least one of the foregoing embodiments.

[0086] It should be noted that the aforementioned computer device may also include other devices (not shown) that may not be essential to understanding the content disclosed in this disclosure; given that these other devices may not be essential for understanding the content disclosed in this disclosure, this disclosure will not describe them one by one.

[0087] Accordingly, at least one embodiment of this disclosure also provides a computer program product, including a computer program / instructions, which, when executed by a processor, are used to implement the instruction processing method described in at least one embodiment of this disclosure.

[0088] At least one embodiment of this disclosure also provides a storage medium storing one or more computer instructions for implementing the instruction processing method provided in the foregoing at least one embodiment.

[0089] The embodiments described above are combinations of the elements and features of this disclosure. Unless otherwise stated, elements or features may be considered optional. Individual elements or features may be practiced without combination with other elements or features. Furthermore, embodiments of this disclosure may be constructed by combining some elements and / or features. The order of operations described in the embodiments of this disclosure may be rearranged. Some constructions of any embodiment may be included in another embodiment and may be replaced by corresponding constructions of another embodiment. It will be apparent to those skilled in the art that claims in the appended claims that do not explicitly reference each other may be combined with embodiments of this disclosure, or may be included as new claims in amendments filed after the submission of this application.

[0090] Embodiments of this disclosure can be implemented by various means, such as hardware, firmware, software, or combinations thereof. In a hardware configuration, the methods according to exemplary embodiments of this disclosure can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, etc.

[0091] In firmware or software configuration, the embodiments of this disclosure can be implemented in the form of modules, processes, functions, etc. Software code can be stored in a memory unit and executed by a processor. The memory unit is located inside or outside the processor and can send data to and receive data from the processor via various known means.

[0092] The above description of the disclosed embodiments enables those skilled in the art to make or use this disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments shown herein, but is accorded the widest scope consistent with the principles and novel features disclosed herein.

[0093] While the above disclosure is provided, it is not limited thereto. Any person skilled in the art may make various alterations and modifications without departing from the spirit and scope of this disclosure; therefore, the scope of protection of this disclosure shall be determined by the scope defined in the claims.

Claims

1. An instruction processing method, comprising: During the renaming phase of the target instruction, it is detected whether multiple source flag architecture registers of the target instruction are mapped to the same physical register; If the detection result is yes, then in the renaming stage, execution stage and exit stage of the target instruction, only one copy of the source flag architecture register and the information of the mapped physical register are stored respectively. In the execution stage of the target instruction, based on the stored information of the source flag architecture register and the mapped physical register, the values ​​of multiple source flags corresponding to the target instruction are read from the corresponding physical register at one time.

2. The instruction processing method as described in claim 1, further comprising: If the test result is negative, an exception is triggered; During the exit phase of the target instruction, in response to a triggered exception, a pipeline flushing operation is performed.

3. The instruction processing method as described in claim 2, wherein, After the pipeline flushing operation is performed, the method further includes: putting the instruction back into the instruction pipeline for processing, and at each stage of putting the instruction back into the instruction pipeline for processing, obtaining and storing the information of all source registers corresponding to the target instruction.

4. The instruction processing method as described in claim 2, wherein, After the pipeline flushing operation is performed, the method further includes: recording the instruction address information of the target instruction; when it is determined, based on the instruction address information of the target instruction, that the target instruction will re-enter the instruction pipeline for processing, at each stage when the target instruction re-enters the instruction pipeline for processing, obtaining and storing the information of all source registers corresponding to the target instruction.

5. The instruction processing method according to any one of claims 1 to 4, wherein, Before detecting whether the multiple source flag architecture registers of the target instruction are mapped to the same physical register, the method further includes: in the instruction fetch stage, decoding stage and allocation stage before the renaming stage of the target instruction, respectively, obtaining and storing the information of all source registers corresponding to the target instruction.

6. The instruction processing method according to any one of claims 1 to 5, wherein, The target instruction includes the conditional move instruction CMOVcc.

7. An instruction processing apparatus, wherein, include: The instruction pipeline structure is configured to detect, during the renaming phase of a target instruction, whether multiple source flag architecture registers of the target instruction are mapped to the same physical register; If the detection result is yes, then in the renaming stage, execution stage and exit stage of the target instruction, only one copy of the source flag architecture register and the information of the mapped physical register are stored respectively. In the execution stage of the target instruction, based on the stored information of the source flag architecture register and the mapped physical register, the values ​​of multiple source flags corresponding to the target instruction are read from the corresponding physical register at one time.

8. The instruction processing apparatus as claimed in claim 7, wherein, The instruction pipeline structure is also configured to trigger an exception if the detection result is negative; in response to the triggering exception during the exit phase of the target instruction, a pipeline flushing operation is performed.

9. The instruction processing apparatus as claimed in claim 8, wherein, The instruction pipeline structure is further configured to, after the pipeline flushing operation, put the instruction back into the instruction pipeline for processing, and at each stage of putting the instruction back into the instruction pipeline for processing, obtain and store the information of all source registers corresponding to the target instruction.

10. The instruction processing apparatus of claim 8, wherein, The instruction pipeline structure is further configured to record the instruction address information of the target instruction after the pipeline flushing operation; when it is determined based on the instruction address information of the target instruction that the target instruction will re-enter the instruction pipeline for processing, at each stage when the target instruction re-enters the instruction pipeline for processing, the information of all source registers corresponding to the target instruction is obtained and stored respectively.

11. The instruction processing apparatus of claim 10, wherein, The instruction pipeline structure is further configured to acquire and store information of all source registers corresponding to the target instruction during the fetch, decode, and allocation stages before the renaming stage of the target instruction, prior to detecting whether multiple source flag architecture registers of the target instruction are mapped to the same physical register.

12. The instruction processing apparatus according to any one of claims 7 to 11, wherein, The target instruction includes the conditional move instruction CMOVcc.

13. A computer device comprising at least one memory and at least one processor, wherein, The memory stores one or more computer-executable instructions, which are executed by the processor to implement the instruction processing method as described in any one of claims 1 to 6.

14. A computer program product comprising a computer program / executable instructions, wherein, The computer program / executable instructions are configured to implement the instruction processing method as described in any one of claims 1 to 6 when executed by a processor.

15. A storage medium storing one or more computer-executable instructions, wherein, The one or more computer-executable instructions are configured to implement the instruction processing method as described in any one of claims 1 to 6.