WO2012093489A1 - 演算処理装置および分岐予測方法 - Google Patents

演算処理装置および分岐予測方法 Download PDF

Info

Publication number
WO2012093489A1
WO2012093489A1 PCT/JP2011/050189 JP2011050189W WO2012093489A1 WO 2012093489 A1 WO2012093489 A1 WO 2012093489A1 JP 2011050189 W JP2011050189 W JP 2011050189W WO 2012093489 A1 WO2012093489 A1 WO 2012093489A1
Authority
WO
WIPO (PCT)
Prior art keywords
branch
branch destination
destination address
instruction
predicted
Prior art date
Application number
PCT/JP2011/050189
Other languages
English (en)
French (fr)
Inventor
恵美 鵜飼
Original Assignee
富士通株式会社
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 富士通株式会社 filed Critical 富士通株式会社
Priority to PCT/JP2011/050189 priority Critical patent/WO2012093489A1/ja
Priority to JP2012551781A priority patent/JP5494832B2/ja
Priority to EP11855093.8A priority patent/EP2662767A1/en
Publication of WO2012093489A1 publication Critical patent/WO2012093489A1/ja
Priority to US13/914,002 priority patent/US8751776B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3842Speculative instruction execution
    • G06F9/3844Speculative instruction execution using dynamic branch prediction, e.g. using branch history tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline or look ahead
    • G06F9/3802Instruction prefetching
    • G06F9/3804Instruction prefetching for branches, e.g. hedging, branch folding
    • G06F9/3806Instruction prefetching for branches, e.g. hedging, branch folding using address prediction, e.g. return stack, branch history buffer
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/32Address formation of the next instruction, e.g. by incrementing the instruction counter
    • G06F9/322Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address

Definitions

  • the present invention relates to an arithmetic processing unit and a branch prediction method.
  • a technique in which processing performance is improved by speculatively starting processing of a subsequent instruction without waiting for execution of one instruction.
  • a branch instruction when a branch instruction is executed, the instruction address to be executed is not known until after the instruction is executed, and therefore, the processing of the subsequent instruction cannot be started. Therefore, a branch prediction technique is widely used that predicts an instruction address to be executed next so that processing of a subsequent instruction can be started before the branch instruction is executed.
  • a technique called branch history or global history that predicts a branch destination using information storing past branch history is known.
  • the return address by the return instruction is stored in the return address stack when the call instruction of the subroutine is executed, and the branch destination by the return instruction is stored in the return address stack.
  • the branch prediction technique when using a general-purpose register for generating the branch destination address of a branch instruction, the change of the contents of the general-purpose register used to generate the branch destination address is managed, and the branch history is changed according to the content change. There is one that determines whether or not the branch prediction result based on is correct.
  • a plurality of branch destination addresses corresponding to a branch instruction and their branch frequencies are obtained by simulation and registered in a table, and an address to be executed next is predicted based on this table.
  • the instruction address of the branch destination is always constant for instructions such as conditional branch, unconditional branch, and subroutine call.
  • the present invention has been made in view of such problems, and an object of the present invention is to provide an arithmetic processing apparatus and a branch prediction method that can predict a branch destination by a branch instruction that can take a plurality of branch destinations.
  • an arithmetic processing device having a plurality of branch destination address tables and a branch destination prediction unit.
  • a branch destination address table is provided for each branch instruction that can take a plurality of branch destinations, and each branch destination address table has a history of a plurality of past branch destination addresses by branch instructions corresponding to itself.
  • the branch destination prediction unit predicts a predicted branch destination address for a branch instruction based on a history of branch destination addresses stored in a branch destination address table corresponding to the branch instruction.
  • a branch prediction method is provided in order to achieve the above object.
  • the following processing is executed by the arithmetic processing unit.
  • the arithmetic processing unit is provided for each branch instruction that can take a plurality of branch destinations, and refers to a plurality of branch destination address tables each storing a plurality of past branch destination addresses by a branch instruction corresponding to itself as a history,
  • the predicted branch destination address for the branch instruction is predicted based on the history of the branch destination address stored in the branch destination address table corresponding to the branch instruction.
  • FIG. (3) which shows the specific example of a branch destination prediction process.
  • FIG. (3) which shows the specific example of a branch destination prediction process.
  • FIG. (3) which shows the principal part structural example of the arithmetic processing unit which concerns on 4th Embodiment.
  • It is a flowchart which shows the branch destination prediction process sequence of the table jump instruction in 4th Embodiment.
  • FIG. (1) which shows the specific example of a branch destination prediction process.
  • FIG. (2) which shows the specific example of a branch destination prediction process.
  • FIG. (1) shows the specific example of a branch destination prediction process.
  • FIG. (2) shows the specific example of a branch destination prediction process.
  • FIG. 1 is a diagram illustrating a configuration example of an arithmetic processing device according to the first embodiment.
  • the arithmetic processing device 1 shown in FIG. 1 is a device that reads an instruction from a predetermined address in a memory (not shown), decodes the read instruction, and executes a process according to the decoding result.
  • the arithmetic processing device 1 is realized, for example, as a semiconductor circuit generally called a CPU, MPU (Microprocessor Unit), or the like. Further, the arithmetic processing unit 1 has a function of predicting a branch destination address for a branch instruction and prefetching the branch destination instruction from the memory before the execution of the branch instruction is completed based on the prediction result.
  • the arithmetic processing unit 1 includes a plurality of branch destination address tables 11, a branch destination prediction unit 12, and a processing function for realizing a branch destination address prediction process for a branch instruction that can take a plurality of branch destinations. It has.
  • the branch destination address table 11 is provided for each branch instruction that can take a plurality of branch destinations, and stores a plurality of past branch destination addresses by each branch instruction as a history.
  • the branch destination prediction unit 12 predicts a predicted branch destination address for a branch instruction that can take a plurality of branch destinations based on the history of the branch destination address stored in the branch destination address table 11 corresponding to the branch instruction.
  • predicted branch destination address predicted by the branch destination prediction unit 12 may be registered in the predicted branch destination address storage unit 13.
  • the predicted branch destination address storage unit 13 can hold one predicted branch destination address for each branch instruction address.
  • the predicted branch destination address storage unit 13 is referred to by, for example, an instruction fetch control unit 14 that controls instruction fetch. When fetching a branch instruction from the memory, the instruction fetch control unit 14 acquires a predicted branch destination address corresponding to the address of the branch instruction from the predicted branch destination address storage unit 13 and uses the acquired predicted branch destination address. Prefetch the branch destination instruction.
  • branch destination prediction unit 12 also performs registration processing in the branch destination address table 11, but the registration processing in the branch destination address table 11 is performed in the branch destination prediction unit. 12 may be performed by another processing unit.
  • branch instruction that can take a plurality of branch destinations is simply referred to as a “branch instruction”.
  • the branch destination prediction unit 12 selects the branch destination address table 11 corresponding to the branch instruction that has been executed. Then, the branch destination prediction unit 12 registers the determined branch destination address in the selected branch destination address table 11.
  • the branch destination address may be registered in the branch destination address table 11 as necessary.
  • the branch destination prediction unit 12 registers branch destination addresses until there are no more empty entries in the branch destination address table 11.
  • the branch destination prediction unit 12 registers the branch destination address for the branch instruction that has been executed, depending on whether or not the branch destination prediction based on the predicted branch destination address determined by the branch destination prediction unit 12 is successful. Whether or not to do so may be determined.
  • the branch destination prediction unit 12 stores the branch destination address in the branch destination address table 11 every time the execution of the branch instruction is completed in the period from the start of the branch destination prediction to before the first successful prediction. Register sequentially. Then, the branch destination prediction unit 12 does not register the branch destination address after the prediction is successful.
  • the branch destination prediction unit 12 determines a predicted branch destination address for a branch instruction corresponding to the branch destination address table 11 based on the history of the branch destination address registered in one branch destination address table 11.
  • the branch destination prediction unit 12 selects one of the branch destination addresses registered in each branch destination address table 11 as a predicted branch destination address and registers it in the predicted branch destination address storage unit 13.
  • the predicted branch destination address output from the branch destination address table 11 corresponding to a certain branch instruction is registered in the predicted branch destination address storage unit 13 in association with the same branch instruction.
  • the determination of the predicted branch destination address may be performed at the timing when execution of the branch instruction is completed and processing for reflecting the confirmed branch destination address in the branch destination address table 11 is executed. For example, if a sufficient number of branch destination addresses are registered in the branch destination address table 11, the branch destination prediction unit 12 starts the entry in the branch destination address table 11 from the top every time a branch instruction is completed. Select while shifting in order. Then, the branch destination prediction unit 12 registers the branch destination address registered in the selected entry in the predicted branch destination address storage unit 13 as a predicted branch destination address.
  • the predicted branch destination address determined by the branch destination prediction unit 12 is directly referred from the instruction fetch control unit 14 without using the predicted branch destination address storage unit 13. It may be configured.
  • the branch destination prediction unit 12 predicts one predicted branch destination address for each branch instruction based on the history of branch destination addresses stored for each branch instruction. Therefore, it is possible to predict a predicted branch destination address for a branch instruction that can take a plurality of branch destinations, and the prediction accuracy of the branch destination in the arithmetic processing device 1 is improved, and the processing performance of the arithmetic processing device 1 is improved. be able to.
  • FIG. 2 is a diagram illustrating an example of the overall configuration of the arithmetic processing apparatus according to the second embodiment. 2 includes an instruction fetch control unit 111, an instruction cache control unit 112, a memory 113, an instruction buffer 114, a decoder 115, an instruction execution control unit 116, an operation unit 117, an operand cache control unit 118, a branch instruction. An execution control unit 119, an instruction completion management unit 120, a branch prediction unit 121, and a program counter 122 are provided.
  • the instruction fetch control unit 111 outputs an address to be fetched next to the instruction cache control unit 112 and requests an instruction fetch.
  • the instruction fetch control unit 111 determines the address of the instruction to be fetched based on the count value of the program counter 122, the predicted branch destination address output from the branch prediction unit 121, the re-instruction fetch request from the branch instruction execution control unit 119, and the like. To decide.
  • the instruction fetch control unit 111 notifies the branch instruction execution control unit 119 of the branch prediction information including the predicted branch destination address output from the branch prediction unit 121.
  • the instruction cache control unit 112 includes therein an instruction cache (not shown) that caches instructions stored in the memory 113.
  • the instruction cache control unit 112 reads an instruction from the instruction cache based on the address output from the instruction fetch control unit 111 and stores the read instruction in the instruction buffer 114.
  • the decoder 115 reads and decodes the instruction stored in the instruction buffer 114. When the decoded instruction is a branch instruction, the decoder 115 outputs the decoded instruction to the branch instruction execution control unit 119. When the decoded instruction is an instruction other than the branch instruction, the decoder 115 outputs the decoded instruction to the instruction. The data is output to the execution control unit 116. The decoder 115 outputs the decoded instruction to the instruction completion management unit 120 regardless of the type of the decoded instruction.
  • the instruction execution control unit 116 includes, for example, a reservation station, and outputs an instruction from the decoder 115 to the arithmetic unit 117 or the operand cache control unit 118 for execution.
  • the reservation station queues the instructions decoded by the decoder 115, and controls to sequentially output the instructions that can be input to the arithmetic unit 117 or the operand cache control unit 118.
  • the calculation unit 117 includes, for example, a general-purpose calculation unit, and executes a calculation according to a command from the command execution control unit 116.
  • the calculation unit 117 that has executed the calculation writes the calculation result in a register or the like (not shown) and reports the completion of the instruction execution to the instruction completion management unit 120.
  • the operand cache control unit 118 includes an operand cache that caches data stored in the memory 113. For example, the operand cache control unit 118 generates an operand address based on a load instruction from the instruction execution control unit 116, and reads data corresponding to the generated operand address from the operand cache. When the operand cache control unit 118 reads data from the operand cache, the operand cache control unit 118 reports the completion of instruction execution to the instruction completion management unit 120.
  • the branch instruction execution control unit 119 includes, for example, a branch reservation station therein, and manages execution of the branch instruction by registering the branch instruction decoded by the decoder 115 in the branch reservation station.
  • the branch instruction execution control unit 119 compares the branch prediction information received from the instruction fetch control unit 111 with the execution result of the branch instruction received from the decoder 115, and determines the success or failure of the branch prediction.
  • the branch instruction execution control unit 119 determines whether or not branch prediction is successful after completion of execution of the branch instruction
  • the branch instruction execution control unit 119 reports the completion of instruction execution to the instruction completion management unit 120, and also determines whether or not branch prediction is successful, Information such as each address of the previous instruction is output to the branch prediction unit 121.
  • the instruction completion management unit 120 manages the execution state of the instruction decoded by the decoder 115.
  • the instruction completion management unit 120 for example, completes an instruction executed out of order by the instruction execution control unit 116 or the branch instruction execution control unit 119, in order.
  • the instruction completion management unit 120 increments the count value of the program counter 122 every time an instruction is completed.
  • the branch prediction unit 121 includes a branch prediction table in which a branch instruction address and a predicted branch destination address are registered in association with each other.
  • the branch prediction unit 121 receives the address of the next instruction to be fetched from the instruction fetch control unit 111, and searches the branch prediction table using the received address.
  • the branch prediction unit 121 acquires branch prediction information including a predicted branch destination address as a search result from the branch prediction table, and uses the acquired branch prediction information as an instruction fetch control unit. To 111.
  • branch prediction unit 121 predicts the branch destination by the branch instruction based on the success / failure of the branch prediction, the information of each address of the branch instruction and the branch destination instruction received from the branch instruction execution control unit 119, and the prediction result
  • the branch prediction table is updated according to
  • the program counter 122 counts up the count value in response to a request from the instruction completion management unit 120. Further, the program counter 122 updates the count value with the branch destination address from the branch instruction execution control unit 119.
  • FIG. 3 is a diagram illustrating a data configuration example in a branch prediction table provided in the branch prediction unit.
  • the branch prediction table 131 included in the branch prediction unit 121 is a set associative storage device, for example, and has a plurality of ways. In each way of the branch prediction table 131, a branch instruction address (or a part of the address) is registered as a tag, and a branch instruction type indicating a branch instruction type and a branch instruction are associated with each branch instruction address. A flag indicating predetermined information other than the type and a predicted branch destination address are registered.
  • FIG. 4 is a diagram illustrating an internal configuration example of the branch prediction unit.
  • FIG. 4 also shows an instruction fetch control unit 111 and a branch instruction execution control unit 119 in addition to the branch prediction unit 121.
  • the operations of the branch prediction unit 121 are the same as the operations of the instruction fetch control unit 111 and the branch instruction execution control unit 119. It explains together.
  • the branch prediction unit 121 includes a branch prediction table 131, a global history 132, a table jump prediction unit 133, a branch prediction control unit 134, a speculative return address stack 135, a return address stack 136, and a selector 137.
  • the branch prediction table 131 stores a branch instruction address and a predicted branch destination address in association with each other.
  • the registration process for the branch prediction table 131 is performed by the branch prediction control unit 134.
  • the instruction fetch control unit 111 When the instruction fetch control unit 111 outputs the address of the instruction to be fetched to the instruction cache control unit 112, the instruction fetch control unit 111 also outputs the same address to the branch prediction table 131 and requests the branch prediction table 131 to perform a search.
  • the way whose address output from the instruction fetch control unit 111 is registered in the tag is searched from the branch prediction table 131, the information in the searched way and the way number of the searched way are determined as branch prediction information. Is output to the instruction fetch control unit 111 via the selector 137.
  • the branch prediction table 131 outputs the retrieved branch instruction address to the speculative return address stack 135,
  • the return address stack 135 holds a predicted branch destination address corresponding to the branch instruction address output from the branch prediction table 131.
  • the predicted branch destination address obtained from the speculative return address stack 135 or the return address stack 136 is The instruction is output to the instruction fetch control unit 111 via 137.
  • the instruction fetch control unit 111 When receiving the branch prediction information from the selector 137, the instruction fetch control unit 111 outputs the branch prediction destination address in the received branch prediction information to the instruction cache control unit 112, and requests an instruction fetch. At the same time, the instruction fetch control unit 111 also outputs the branch prediction information received from the selector 137 to the branch instruction execution control unit 119.
  • the branch instruction execution control unit 119 compares the branch prediction information received from the instruction fetch control unit 111 with the execution result of the branch instruction received from the decoder 115, and determines the success or failure of the branch prediction. If the branch instruction execution control unit 119 determines that the branch prediction is wrong, the branch instruction execution control unit 119 causes the instruction execution unit (not shown) to cancel the speculative execution of the branch destination instruction, and also instructs the instruction fetch control unit 111 to correct the branch destination address. And request to refetch the branch destination instruction.
  • the branch instruction execution control unit 119 determines whether the branch prediction is successful after the execution of the branch instruction is completed, the branch instruction execution control unit 119 reports the completion of the instruction execution to the instruction completion management unit 120. At the same time, the branch instruction execution control unit 119 outputs the branch instruction execution result to the branch prediction unit 121.
  • the execution completion signal, the address of the executed branch instruction, the type information of the executed branch instruction, the address of the branch destination instruction, the success / failure information indicating the success or failure of the branch prediction, and the predicted branch destination address are registered.
  • the way number in the power branch prediction table 131 is included.
  • the global history 132 operates by fetching the execution result of the conditional branch instruction among the branch instruction execution results output from the branch instruction execution control unit 119.
  • the global history 132 stores a branch / non-branch history by execution of a conditional branch instruction based on the fetched branch instruction execution result, and outputs a predicted branch destination address based on the stored history.
  • the global history 132 stores the number of consecutive branches and the number of consecutive non-branches that have occurred in the past based on the fetched branch instruction execution result.
  • the global history 132 predicts the next time as a non-branch when the number of current consecutive branches reaches a predetermined value, and predicts the next time as a branch when the number of current non-branches reaches a predetermined value.
  • the global history 132 predicts the next time as a branch
  • the global history 132 outputs the branch destination address corresponding to the executed branch instruction to the branch prediction control unit 134 as the predicted branch destination address, and registers it in the branch prediction table 131.
  • the table jump prediction unit 133 operates by fetching the execution result of a branch instruction that can take a plurality of branch destinations, excluding the subroutine return instruction, from the branch instruction execution result output from the branch instruction execution control unit 119. To do.
  • the instruction fetched by the table jump prediction unit 133 includes an instruction called “table jump” indicated by a switch case sentence in C language. Therefore, in the following description, an instruction fetched by the table jump prediction unit 133 is referred to as a “table jump instruction”.
  • the table jump prediction unit 133 includes a table capable of holding a history of a plurality of branch destination addresses executed for each address of one or more table jump instructions, as will be described later.
  • the table jump prediction unit 133 determines the predicted branch destination address corresponding to the table jump instruction using the internal table, outputs the determined predicted branch destination address to the branch prediction control unit 134, and stores it in the branch prediction table 131. Let me register.
  • FIG. 5 is a diagram illustrating an example of a program for executing a table jump instruction.
  • FIG. 5 shows an example of a program described using a C language switch case statement.
  • the program shown in FIG. 5 is executed, different processing is executed according to the value of conditional expression a.
  • the process Pa is executed.
  • the process Pb is executed.
  • the process Pc is executed. Is executed.
  • the arithmetic processing unit 100 executes different branch destination instructions according to the value of the conditional expression a.
  • the branch prediction control unit 134 registers the predicted branch destination address in the branch prediction table 131.
  • the branch prediction control unit 134 registers the predicted branch destination address output from the global history 132 in the branch prediction table 131.
  • the branch prediction control unit 134 registers the predicted branch destination address output from the table jump prediction unit 133 in the branch prediction table 131.
  • branch prediction control unit 134 executes the branch instruction when the predicted branch destination address is not output from the global history 132 and the table jump prediction unit 133, for example, when the execution of the subroutine call instruction or the subroutine return instruction is completed.
  • the branch destination address included in the branch instruction execution result output from the control unit 119 is registered in the branch prediction table 131 as a predicted branch destination address.
  • the branch prediction control unit 134 registers the branch instruction address, type information, and various flags corresponding to the predicted branch destination address together with the predicted branch destination address in the same way in the branch prediction table 131.
  • the branch prediction control unit 134 acquires the branch instruction address, type information, and various flags registered in the branch prediction table 131 from the branch instruction execution result output from the branch instruction execution control unit 119.
  • the branch prediction control unit 134 updates information other than the tag in the way with new information.
  • the branch prediction control unit 134 registers information for the way indicated by the way number included in the branch instruction execution result from the branch instruction execution control unit 119 among the ways of the branch prediction table 131.
  • the branch prediction control unit 134 registers information including a tag with respect to an empty way in the branch prediction table 131. To do.
  • the branch prediction control unit 134 selects a way by, for example, a method according to LRU (Least Recently Used) or the like, and information including a tag for the selected way. Register.
  • the branch prediction control unit 134 may designate the way where the predicted branch destination address is registered in the branch prediction table 131 based on the correspondence table between the branch instruction address and the way in the branch prediction table 131. Good.
  • the speculative return address stack 135 speculatively predicts the return address for the subroutine return instruction before executing the subroutine call instruction corresponding to the subroutine return instruction. As described above, the speculative return address stack 135 acquires the searched branch instruction address from the branch prediction table 131 when the branch instruction address in the way searched from the branch prediction table 131 is the address of the subroutine call instruction. To do. The speculative return address stack 135 performs an operation of converting the address of the searched subroutine call instruction into the address of the subroutine return instruction corresponding to the subroutine call instruction, and holds the operation result on the stack.
  • the speculative return address stack 135 calculates the address of the subroutine return instruction corresponding to the subroutine call instruction by adding a predetermined value to the address of the subroutine call instruction, for example.
  • the speculative return address stack 135 outputs the address held in the stack as a predicted return destination address (that is, a predicted branch destination address) for the subroutine return instruction.
  • the return address stack 136 stores the return address of the subroutine return instruction corresponding to the subroutine call instruction that has been executed, based on the branch instruction execution result from the branch instruction execution control unit 119.
  • the return address stack 136 performs an operation of converting the address of the subroutine call instruction that has been executed into the address of the subroutine return instruction corresponding to the subroutine call instruction, and holds the operation result on the stack. For example, the return address stack 136 calculates the address of the subroutine return instruction corresponding to the subroutine call instruction by adding a predetermined value to the address of the subroutine call instruction.
  • the return address stack 136 outputs the address held in the stack as the predicted return destination address (that is, the predicted branch destination address) for the subroutine return instruction.
  • the selector 137 When the instruction fetch control unit 111 requests the branch prediction table 131 to search, the selector 137 outputs branch prediction information based on the way searched from the branch prediction table 131 to the instruction fetch control unit 111.
  • This branch prediction information includes a predicted branch destination address.
  • the selector 137 determines whether the speculative return address stack 135 or the stack that holds a valid predicted branch destination address from the return address stack 136 The predicted branch destination address is acquired and output to the instruction fetch control unit 111.
  • FIG. 6 is a diagram illustrating an internal configuration example of the table jump prediction unit.
  • the table jump prediction unit 133 is provided with a plurality of branch destination address tables 140.
  • the branch destination address table 140 is prepared for each branch instruction, and each branch destination address table 140 can hold one branch instruction address and a plurality of branch destination addresses based on the executed branch instruction. .
  • the table jump prediction unit 133 includes a branch instruction identification unit 151, a table management unit 152, and a table selection unit 153.
  • the branch instruction identification unit 151 When the branch instruction execution is completed, the branch instruction identification unit 151 outputs the branch instruction execution result as a table jump instruction based on the type information included in the branch instruction execution result output from the branch instruction execution control unit 119. It is determined whether it is an execution result for.
  • the branch instruction identification unit 151 determines that the branch instruction execution result is the execution result for the table jump instruction, the branch instruction identification unit 151 starts the process of the table management unit 152.
  • the table management unit 152 performs processing such as generation and search of the branch destination address table 140 and determination of the predicted branch destination address.
  • the table management unit 152 selects the branch destination address table 140 in which the address of the table jump instruction that has been executed is registered. At this time, if there is no branch destination address table 140 in which the address of the table jump instruction that has been executed is registered, the table management unit 152 creates a new branch destination in which the address of the table jump instruction that has been executed is registered. An address table 140 is generated.
  • the table management unit 152 outputs a table selection signal to the table selection unit 153 to select an output from the selected or newly generated branch destination address table 140.
  • the table management unit 152 registers the branch destination address included in the branch instruction execution result for the selected or newly generated branch destination address table 140. At the same time, the table management unit 152 selects an entry holding a branch destination address as a predicted branch destination address from the entries of the branch destination address table 140, and outputs the predicted branch destination address from the selected entry. An entry selection signal for instructing is output.
  • the table selection unit 153 selects one of the branch destination address tables 140 based on the table selection signal from the table management unit 152.
  • the table selection unit 153 outputs the predicted branch destination address output from the selected branch destination address table 140 to the branch prediction table 131 via the branch prediction control unit 134.
  • FIG. 7 is a diagram illustrating a configuration example of a branch destination address table in the second embodiment.
  • FIG. 7 also shows the table management unit 152 and the table selection unit 153 for reference.
  • Each of the branch destination address tables 140 is provided with an index unit 141 and a branch destination address storage unit 142 as areas for holding information.
  • the index part 141 holds a table valid and an index.
  • the table valid is a flag indicating whether or not the branch destination address table 140 is valid (that is, whether or not the branch instruction address and at least one branch destination address are registered in the branch destination address table 140). is there.
  • the table valid indicates that the branch destination address table 140 is valid when the value is “1”, and the branch destination address table 140 is not valid when the value is “0”.
  • all or part of the address of the branch instruction is registered.
  • the value registered in the index identifies which table jump instruction the branch destination address table 140 corresponds to.
  • the branch destination address storage unit 142 is provided with a plurality of entries each including a valid flag (indicated as “V” in FIG. 7) and a branch destination address. Under the control of the table management unit 152, the branch destination address is registered in order from the first entry in the branch destination address storage unit 142, and the valid flag is set to “1” in the entry in which the branch destination address is registered.
  • an entry selection unit 143 is provided in each branch destination address table 140.
  • the entry selection unit 143 selects one entry in the branch destination address table 140 in response to the entry selection signal from the table management unit 152, and selects the predicted branch destination address output from the selected entry as the table selection unit 153. Output to.
  • FIG. 8 is a flowchart illustrating a branch destination prediction processing procedure for a table jump instruction according to the second embodiment.
  • Step S11 When the execution of the branch instruction is completed, the execution completion signal included in the branch instruction execution result from the branch instruction execution control unit 119 becomes “1” indicating ON. At this time, a signal other than the execution completion signal included in the branch instruction execution result from the branch instruction execution control unit 119 becomes valid.
  • the branch instruction identifying unit 151 determines that the instruction that has been executed is jumped from the branch instruction execution control unit 119 based on the type information included in the branch instruction execution result. Determine if it is an instruction.
  • the branch instruction identification unit 151 determines that the instruction that has been executed is a table jump instruction, for example, an enable signal is output from the branch instruction identification unit 151 to the table management unit 152, thereby performing the processing from step S12 onward. Is executed.
  • the table management unit 152 refers to the index unit 141 in each of the plurality of branch destination address tables 140 included in the table jump prediction unit 133. Then, the table management unit 152 searches the plurality of branch destination address tables 140 for a table in which the branch instruction address included in the branch instruction execution result from the branch instruction execution control unit 119 is registered as an index. In this step S12, the index part 141 searches the branch destination address table 140 in which the branch instruction address included in the branch instruction execution result is registered as an index and the table valid is “1”.
  • Step S13 If the branch destination address table 140 in which the branch instruction address included in the branch instruction execution result is registered as a result of the search in step S12 (S13: Yes), the table management unit 152 determines the branch destination. The address table 140 is selected as a subsequent process target, and the process of step S16 is executed. On the other hand, if the branch destination address table 140 in which the branch instruction address included in the branch instruction execution result is not registered by the search in step S12 (S13: No), the table management unit 152 performs the process of step S14. Execute.
  • Step S14 The table management unit 152 newly selects the branch destination address table 140 in which the table valid in the index unit 141 is “0” indicating invalidity as a subsequent processing target. At this time, the table management unit 152 updates the table valid in the selected branch destination address table 140 to “1”.
  • the table management unit 152 manages the branch destination address table 140 as follows using, for example, a round robin counter. If the number of branch destination address tables 140 is N (where N is an integer equal to or greater than 1), the initial count value of the round robin counter is “0”, and the upper limit value of the count value is “N ⁇ 1”. . In step S14, the table management unit 152 selects the branch destination address table 140 corresponding to the current count value of the round robin counter as a processing target. At this time, the table management unit 152 updates the table valid in the selected branch destination address table 140 to “1” and adds “1” to the count value of the round robin counter.
  • Step S15 The table management unit 152 registers the branch instruction address included in the branch instruction execution result from the branch instruction execution control unit 119 as an index in the branch destination address table 140 selected in Step S14. Thereafter, the process of step S16 is executed.
  • Step S16 The table management unit 152 determines the predicted branch destination address based on the registration information in the branch destination address table 140 selected as the processing target. In step S16, the table management unit 152 causes the entry selection unit 143 to select one of the entries in the branch destination address storage unit 142, and uses the address registered in the selected entry as the predicted branch destination address. The table selection unit 153 outputs the data. The process in step S16 will be described in detail with reference to FIG.
  • Step S17 The table management unit 152 outputs a selection signal to the table selection unit 153 to select an output from the entry selection unit 143 in the branch destination address table 140 selected as the processing target.
  • the selection signal itself is output after confirming the existence of the branch destination address table 140 in which the branch instruction address is registered at step S13 or after newly selecting the branch destination address table 140 at step S14. It may be performed at any stage up to the execution timing of step S17.
  • the predicted branch destination address output from the entry selection unit 143 is output to the branch prediction control unit 134 through the table selection unit 153.
  • the branch prediction control unit 134 registers the predicted branch destination address output from the table selection unit 153 in the branch prediction table 131 together with the branch instruction address, branch instruction type, and various flags corresponding to the predicted branch destination address.
  • the branch prediction control unit 134 acquires the branch instruction address, branch instruction type, and various flags registered in the branch prediction table 131 from the branch instruction execution result output from the branch instruction execution control unit 119.
  • the branch prediction control unit 134 indicates the way number included in the branch instruction execution result from the branch instruction execution control unit 119 when the way corresponding to the executed branch instruction already exists in the branch prediction table 131.
  • the predicted branch destination address, branch instruction type, and various flags are overwritten on the way in the branch prediction table 131.
  • FIG. 9 is a flowchart illustrating a procedure of a predicted branch destination address determination process according to the second embodiment.
  • the processing in FIG. 9 corresponds to step S16 in FIG. [Step S21]
  • the table management unit 152 reads the branch destination address for the branch instruction that has been executed from the branch destination address storage unit 142 in the branch destination address table 140 selected as the processing target (that is, from the branch instruction execution control unit 119). Branch entry included in the execution result of the branch instruction) is searched.
  • Step S22 The table management unit 152 obtains the nth entry (where n is an integer with 0 as an initial value) as an entry in which the branch destination address included in the branch instruction execution result is registered by the search processing in step S21. If they match (S22: Yes), the process of step S23 is executed. On the other hand, when there is no entry in which the branch destination address included in the branch instruction execution result is registered (S22: No), the table management unit 152 executes the process of step S25.
  • n is an integer with 0 as an initial value
  • Step S23 The table management unit 152 determines whether the entry ((n + 1) th entry) next to the entry matched in Step S22 is valid among the entries in the branch destination address storage unit 142.
  • the case where the (n + 1) th entry is valid (S23: Yes) is a case where the valid flag is “1” and the branch destination address is registered in the (n + 1) th entry. .
  • the table management unit 152 executes the process of step S24.
  • the valid flag of the (n + 1) th entry is “0”, or the nth entry is a branch destination address storage unit. This is a case where the (n + 1) th entry does not exist because it is the entry at the end of 142.
  • the table management unit 152 executes the process of step S27.
  • Step S24 The table management unit 152 outputs a selection signal to the entry selection unit 143 to select an output from the next entry ((n + 1) th entry) matched in step S22. As a result, the branch destination address registered in the (n + 1) th entry is output to the table selection unit 153 through the entry selection unit 143 as a predicted branch destination address.
  • Step S25 When the entry in which the branch destination address included in the branch instruction execution result is registered does not exist in the branch destination address storage unit 142 (S22: No), the table management unit 152 stores the branch destination address in the branch destination address storage unit 142. Then, it is determined whether there is an empty entry whose valid flag is “0”. The table management unit 152 executes the process of step S26 when there is a free entry (S25: Yes), and executes the process of step S27 when there is no free entry (S25: No).
  • Step S26 The table management unit 152 updates the valid flag to “1” in the entry with the smallest number among the empty entries in the branch destination address storage unit 142, and also includes the branch destination address included in the branch instruction execution result. Register. Thereafter, the process of step S27 is executed.
  • Step S27 The table management unit 152 outputs a selection signal to the entry selection unit 143 to select an output from the first entry (0th entry) of the branch destination address storage unit 142.
  • the branch destination address registered in the head entry of the branch destination address storage unit 142 is output to the table selection unit 153 through the entry selection unit 143 as a predicted branch destination address.
  • the table management unit 152 searches the branch destination address storage unit 142 for an entry in which an address that matches the branch destination address after execution of the table jump instruction is registered. If the branch destination address after execution of the table jump instruction is not stored in the branch destination address storage unit 142, the table management unit 152 registers the branch destination address in the empty entry with the smallest number in the branch destination address storage unit 142. To do. In this case, the table management unit 152 determines the branch destination address registered in the top entry of the table management unit 152 as the predicted branch destination address.
  • the table management unit 152 when an entry in which the branch destination address after execution of the table jump instruction is registered is retrieved from the branch destination address storage unit 142, the table management unit 152 newly registers the branch destination address in the branch destination address storage unit 142. do not do. In this case, the table management unit 152 determines the branch destination address registered in the valid entry located next to the searched entry as the predicted branch destination address.
  • FIG. 10 is a diagram illustrating a specific example of the branch destination prediction process.
  • “previous prediction” means that the instruction fetch control unit 111 reads from the branch prediction table 131 when prefetching the table jump instruction corresponding to the branch destination address output from the branch instruction execution control unit 119. Indicates the acquired predicted branch destination address. If the branch destination address and the “previous prediction” address do not match, it indicates that the prediction has failed.
  • the “next prediction” is a predicted branch address registered in the branch prediction table 131 from the table jump prediction unit 133 in that state, and is the same as the “previous prediction” address in the next state.
  • the branch destination address storage unit 142 branches whenever a different branch destination address appears for the first time as the branch destination address history after the execution of the table jump instruction.
  • the destination address is registered. Therefore, different branch destination addresses are registered in the branch destination address storage unit 142, and one branch destination address is registered in only one entry. If the branch destination address after execution of the table jump instruction is registered in the nth entry in the branch destination address storage unit 142, if a different branch destination address is registered in the (n + 1) th entry, The branch destination address registered in the (n + 1) th entry is output as the predicted branch destination address.
  • the branch destination instruction by executing the table jump instruction can be obtained with high accuracy, particularly when the appearance pattern of the branch destination address is a pattern having a plurality of different branch destination addresses. Predictable.
  • the table jump prediction unit 133 performs a table jump instruction executed in the past with respect to the branch destination address table 140 prepared for each address of the executed table jump instruction.
  • the branch destination address history for is registered.
  • one predicted branch destination address is output from each branch destination address table 140, and the output predicted branch destination address is registered in the branch prediction table 131 together with the address of the table jump instruction.
  • the instruction fetch control unit 111 can acquire the predicted branch destination address for the table jump instruction by searching the branch prediction table 131 in the same manner as the predicted branch destination address for the conditional branch instruction.
  • the branch prediction table 131 as a means for supplying the predicted branch destination address to the instruction fetch control unit 111 is not only supplied with the predicted branch destination address for the conditional branch instruction but also the predicted branch for the table jump instruction. It can also be used in common for supplying the destination address. Therefore, it is necessary to greatly change the circuit configuration and control method for realizing that the instruction fetch control unit 111 obtains the predicted branch destination address from the branch prediction table 131 while achieving the effect that the branch destination of the table jump instruction can be predicted. The increase in manufacturing / development cost and circuit area can be suppressed.
  • FIG. 11 is a diagram illustrating a configuration example of a main part of the arithmetic processing device according to the third embodiment.
  • components corresponding to those in FIG. 7 are denoted by the same reference numerals.
  • the arithmetic processing device is different from the arithmetic processing device according to the second embodiment in the configuration of the branch destination address table and is based on a table management unit using the branch destination address table.
  • the procedure of branch destination prediction processing is also different. That is, the arithmetic processing unit according to the third embodiment includes a branch destination address table 140a and a table management unit 152a shown in FIG. 11 instead of the branch destination address table 140 and the table management unit 152 shown in FIG. . Similar to the second embodiment, a plurality of branch destination address tables 140a are provided.
  • Each branch destination address table 140a includes a branch destination address storage unit 142, similar to the branch destination address table 140 shown in FIG. Each branch destination address table 140a further includes an index part 141a and an entry selection part 143a.
  • the index unit 141a holds a Next pointer.
  • the Next pointer indicates an entry for outputting a predicted branch destination address among the entries in the branch destination address storage unit 142. For example, when the Next pointer is “0”, the Next pointer points to the 0th entry in the branch destination address storage unit 142, and when the Next pointer is “1”, the Next pointer is the first one in the branch destination address storage unit 142. Point to entry.
  • the initial value of the Next pointer is “0”, and the value of the Next pointer is counted by the table management unit 152a.
  • the entry selection unit 143a selects one of the entries in the branch destination address storage unit 142, and outputs the branch destination address registered in the selected entry to the table selection unit 153 as a predicted branch destination address.
  • the entry selection unit 143a selects the entry indicated by the Next pointer in the index unit 141a from the entries in the branch destination address storage unit 142.
  • the table management unit 152a selects the branch destination address table 140a corresponding to the address of the branch instruction that has been executed, and determines the predicted branch destination address based on the information in the selected branch destination address table 140a. Unlike the table management unit 152 shown in FIG. 7, the table management unit 152a stores the branch destination address only when branch prediction fails based on the success / failure information included in the branch instruction execution result from the branch instruction execution control unit 119. The branch destination address is registered in the unit 142. Further, the table management unit 152a registers the branch destination address until there is no more free space for the entry in the branch destination address storage unit 142. Due to these differences, the table management unit 152a can predict the branch destination even when the repetition pattern of the branch destination address is more complicated than in the case of the second embodiment.
  • FIG. 12 is a flowchart illustrating a branch destination prediction process procedure of a table jump instruction according to the third embodiment.
  • the process of step S11 is the same as the process of step S11 shown in FIG.
  • the table management unit 152a executes processing instead of the table management unit 152
  • the processing target is the branch destination address table 140a instead of the branch destination address table 140. Except for this, it is the same as the processing of steps S12 to S15, S17 shown in FIG.
  • the points different from the process of FIG. 8 are that step S31 is executed after step S15, and step S16a is executed instead of step S16.
  • the table management unit 152a 152a when the branch management address table 140a in which the branch instruction address included in the branch instruction execution result is not registered by the search in step S12 (S13: No), the table management unit 152a 152a newly selects the branch destination address table 140a in which the table valid of the index part 141a is “0” indicating invalidity as a subsequent processing target. At this time, the table management unit 152a updates the table valid in the selected branch destination address table 140a to “1” (step S14). Next, the table management unit 152a registers the branch instruction address included in the branch instruction execution result from the branch instruction execution control unit 119 as an index in the branch destination address table 140a selected in step S14 (step S15). .
  • the table management unit 152a sets the Next pointer of the index unit 141a to “0” in the branch destination address table 140a selected in step S14 (step S31). That is, in the newly enabled branch destination address table 140a, the Next pointer in the index unit 141a is set to “0” which is an initial value. Note that the processing order of steps S15 and S31 may be reversed. Or each process of step S15, S31 may be performed simultaneously.
  • step S12 If the branch destination address table 140a in which the branch instruction address included in the branch instruction execution result is registered by the search in step S12 (S13: Yes), or is included in the branch instruction execution result by the search in step S12.
  • the table management unit 152a selects the processing target.
  • the predicted branch destination address is determined based on the registration information in the branch destination address table 140a and the success / failure information included in the branch instruction execution result from the branch instruction execution control unit 119 (step S16a). Thereafter, the process of step S17 is executed.
  • FIG. 13 is a flowchart illustrating a procedure of a predicted branch destination address determination process according to the third embodiment. The processing in FIG. 13 corresponds to step S16a in FIG.
  • Step S41 The table management unit 152a determines whether or not the branch destination prediction has failed based on the success / failure information included in the branch instruction execution result from the branch instruction execution control unit 119. When it is determined that the branch destination prediction has failed (S41: Yes), the table management unit 152a executes step S42, and when it is determined that the branch destination prediction has been successful (S41: No), The process of step S43 is executed.
  • Step S42 The table management unit 152a sets the Next pointer of the index unit 141a to “0” in the branch destination address table 140a selected as the processing target. Thereafter, the process of step S45 is executed.
  • Step S43 The table management unit 152a adds “1” to the Next pointer of the index unit 141a in the branch destination address table 140a selected as the processing target.
  • the table management unit 152a determines whether or not the entry pointed to by the Next pointer among the entries in the branch destination address storage unit 142 is valid.
  • the entry is valid means that the valid flag of the entry indicated by the Next pointer is “1” and a valid branch destination address is registered in the entry.
  • the valid flag of the entry pointed to by the Next pointer is “0”, or the entry pointed to by the Next pointer does not exist (that is, the value of the Next pointer is the value of the branch destination address storage unit 142). The number of entries is exceeded.
  • the table management unit 152a executes the process of step S45. If the entry pointed to by the Next pointer is not valid (S44: No), the table management unit 152a Execute the process.
  • Step S45 It is determined whether or not there is an empty entry whose valid flag is “0” in the branch destination address storage unit 142.
  • the table management unit 152a executes the process of step S46, and when there is no free entry (S45: No), the table management unit 152a executes the process of step S47.
  • Step S46 The table management unit 152a updates the valid flag to “1” in the entry with the smallest number among the empty entries in the branch destination address storage unit 142, and also includes the branch destination address included in the branch instruction execution result. Register. Thereafter, the process of step S47 is executed.
  • the table management unit 152a outputs a selection request signal to the entry selection unit 143a.
  • the entry selection unit 143a that has received the selection request signal selects an entry indicated by the Next pointer among the entries of the branch destination address storage unit 142, and sets the branch destination address registered in the selected entry as a predicted branch destination address.
  • the data is output to the selection unit 153.
  • the table management unit 152a sets the branch destination address to the branch destination address storage unit 142 each time execution of the table jump instruction is completed until there is no empty entry in the branch destination address storage unit 142. To accumulate. When the branch destination prediction fails, the table management unit 152a outputs the branch destination address registered in the head entry of the branch destination address storage unit 142 as the predicted branch destination address. Furthermore, even if the branch destination prediction is successful, the table management unit 152a is registered in the first entry of the branch destination address storage unit 142 if the entry next to the entry indicated by the Next pointer is not valid at that time. The branch destination address is output as the predicted branch destination address.
  • the table management unit 152a determines the branch destination address registered in the next entry as follows: Output as predicted branch destination address.
  • branch destination prediction process based on the branch destination address registered in the branch destination address table 140a will be described assuming that the program as shown in FIG. 5 is executed.
  • 14 to 16 are diagrams illustrating specific examples of the branch destination prediction process.
  • the branch destination address storage unit 142 includes eight entries from the 0th to the 7th.
  • FIG. 14 it is assumed that a table jump instruction is executed from a state in which the branch destination address is not registered in the branch destination address storage unit 142, and a transition is made to state 11 in which the branch destination is determined to be address A.
  • the Next pointer remains “0” (S42)
  • the branch destination address A is the head in the branch destination address storage unit 142. Is registered in the 0th entry, which is an empty entry (S46). Further, the address A registered in the 0th entry is output as the predicted branch destination address (S47). Thereafter, the branch destination address is accumulated in the branch destination address storage unit 142 until the entry 18 is full.
  • the branch destination is successfully predicted (S41 of FIG. 13: No).
  • the Next pointer is increased to “1” (S43), and the address B registered in the first entry is output as the predicted branch destination address (S47).
  • the Next pointer is increased to “2” (S43), and the predicted branch destination address As a result, the address A registered in the second entry is output (S47).
  • the prediction of the branch destination fails (S41 in FIG. 13: Yes).
  • the Next pointer is returned to “0” (S42), and the address A registered in the 0th entry is output as the predicted branch destination address (S47).
  • the branch destination prediction fails (S41 in FIG. 13: Yes)
  • the Next pointer remains “0” (S42)
  • the predicted branch destination address is set.
  • the address A registered in the 0th entry is output (S47).
  • the branch destination address storage unit 142 stores the appearance pattern of the branch destination address for one pattern.
  • the Next pointer returns to “0”, and the predicted branch destination address is output from the first entry. Therefore, after this, the branch destination addresses are address A (state 17), address B (state 18), address A (state 19), address B (state 20), address C (state 21), address C (state 22).
  • the prediction of the branch destination continues to be successful. That is, according to the processing of FIG. 13, branch destinations are predicted for the appearance patterns of addresses A, B, A, B, C, and C that are more complicated than the patterns predictable in the second embodiment. It becomes possible to do.
  • the branch destination when a pattern including instruction addresses within the number of entries in the branch destination address storage unit 142 appears, the branch destination can be predicted with a probability of 50% or more. Become.
  • the third embodiment described above has the effect of being able to predict the branch destination of a table jump instruction, and is similar to the second embodiment in that it is possible to suppress an increase in manufacturing / development cost and circuit area. The effect of can be obtained. Further, according to the third embodiment, branch destinations can be predicted even for more complicated instruction address appearance patterns as compared to the second embodiment.
  • FIG. 17 is a diagram illustrating a configuration example of a main part of an arithmetic processing device according to the fourth embodiment.
  • components corresponding to those in FIG. 11 are denoted by the same reference numerals.
  • the arithmetic processing device is different from the arithmetic processing device according to the third embodiment in the configuration of the branch destination address table and is based on a table management unit using the branch destination address table.
  • the procedure of branch destination prediction processing is also different. That is, the arithmetic processing unit according to the fourth embodiment includes a branch destination address table 140b and a table management unit 152b shown in FIG. 17 instead of the branch destination address table 140a and the table management unit 152a shown in FIG. . Similar to the third embodiment, a plurality of branch destination address tables 140b are provided.
  • Each branch destination address table 140b includes a branch destination address storage unit 142 and an entry selection unit 143a, similar to the branch destination address table 140a shown in FIG.
  • Each branch destination address table 140b further includes an index unit 141b and an upper limit register 144.
  • a Create flag is held in the index part 141b.
  • the Create flag is set by the table management unit 152b and indicates whether or not it is currently the entry registration period of the branch destination address storage unit 142.
  • the entry registration period indicates a period in which sufficient information for predicting the branch destination address is not held.
  • the entry registration period can be said to be a period in which the branch destination address storage unit 142 has not completed registration of a branch destination address that is a predicted branch destination candidate.
  • the Create flag is set to “1” during the entry registration period of the branch destination address storage unit 142, and the Create flag is updated to “0” when the entry registration period ends.
  • the upper limit register 144 has a function of counting the number of valid entries (that is, entries whose valid flag is “1”) in the branch destination address storage unit 142. However, the minimum value of the upper limit register 144 is “0”, “0” when the number of valid entries is 1, “1” when the number of valid entries is 2, and so on. Is done. When the Create flag changes to “1”, the upper limit register 144 counts the number of valid entries in the branch destination address storage unit 142, holds the count value, and allows the table management unit 152b to refer to it.
  • the table management unit 152b selects the branch destination address table 140b corresponding to the address of the branch instruction that has been executed, information in the selected branch destination address table 140b, and the branch instruction execution result from the branch instruction execution control unit 119
  • the predicted branch destination address is determined based on the success / failure information included in.
  • the table management unit 152b counts the Next pointer with the value held in the upper limit register 144 as the upper limit. It will begin to work.
  • FIG. 18 is a flowchart illustrating a branch destination prediction process procedure of a table jump instruction according to the fourth embodiment.
  • the process of step S11 is the same as the process of step S11 shown in FIGS.
  • the table management unit 152b executes processing instead of the table management unit 152a, and the processing target is the branch destination address table 140b instead of the branch destination address table 140a. Except for this, it is the same as the processing of steps S12 to S15 and S17 shown in FIG. Other than these, the point of difference from the process of FIG. 12 is that step S32 is executed instead of step S31, and step S16b is executed instead of step S16a.
  • the table management unit 152b 152b when the branch management address table 140b in which the branch instruction address included in the branch instruction execution result is not registered by the search in step S12 (S13: No), the table management unit 152b 152b newly selects the branch destination address table 140b in which the table valid of the index part 141a is “0” indicating invalidity as a subsequent processing target. At this time, the table management unit 152b updates the table valid in the selected branch destination address table 140b to “1” (step S14). Next, the table management unit 152b registers, as an index, the branch instruction address included in the branch instruction execution result from the branch instruction execution control unit 119 in the branch destination address table 140b selected in step S14 (step S15). .
  • the table management unit 152b sets the Next pointer of the index unit 141b to “0” and the Create flag to “1” in the branch destination address table 140b selected in step S14 (step S32). That is, in the newly enabled branch destination address table 140b, the Next pointer in the index unit 141b is set to “0” which is an initial value, and the Create flag is set to “1”. Note that the processing order of steps S15 and S32 may be reversed. Or each process of step S15 and S32 may be performed simultaneously.
  • step S12 If there is a branch destination address table 140b in which the branch instruction address included in the branch instruction execution result is registered by the search in step S12 (S13: Yes), or is included in the branch instruction execution result by the search in step S12.
  • the table management unit 152b selects the processing target.
  • the predicted branch destination address is determined based on the registration information in the branch destination address table 140b and the success / failure information included in the branch instruction execution result from the branch instruction execution control unit 119 (step S16b). Thereafter, the process of step S17 is executed.
  • FIG. 19 is a flowchart showing the procedure of the predicted branch destination address determination process in the fourth embodiment.
  • the processing in FIG. 19 corresponds to step S16b in FIG.
  • Step S61 The table management unit 152b determines whether or not branch destination prediction has failed based on the success / failure information included in the branch instruction execution result from the branch instruction execution control unit 119. When it is determined that the branch destination prediction has failed (S61: Yes), the table management unit 152b executes Step S62, and when it is determined that the branch destination prediction has been successful (S61: No), The process of step S66 is executed.
  • Step S62 The table management unit 152b determines whether or not there is an empty entry whose valid flag is “0” in the branch destination address storage unit 142 in the branch destination address table 140b selected as the processing target.
  • the table management unit 152b executes the process of step S63 when there is a free entry (S62: Yes), and executes the process of step S65 when there is no free entry (S62: No).
  • the table management unit 152b refers to the Create flag of the index unit 141b.
  • the table management unit 152b executes the process of step S64, and when the Create flag is “0” (S63: No), the table management unit 152b performs step S65. Execute the process.
  • Step S64 The table management unit 152b updates the valid flag to “1” in the entry with the smallest number among the empty entries in the branch destination address storage unit 142, and also includes the branch destination address included in the branch instruction execution result. Register. Thereafter, the process of step S65 is executed.
  • Step S65 The table management unit 152b sets the Next pointer of the index unit 141b to “0”. Thereafter, the process of step S71 is executed.
  • Step S66 The table management unit 152b determines whether the Create flag of the index unit 141b is “1” in the branch destination address table 140b selected as the processing target. When the Create flag is “1” (S66: Yes), the table management unit 152b executes the process of Step S67, and when the Create flag is “0” (S66: No), the table management unit 152b performs Step S69. Execute the process.
  • Step S67 The table management unit 152b updates the Create flag to “0”.
  • Step S ⁇ b> 68 The upper limit register 144 that has detected that the Create flag has changed to “0” counts the number of valid entries in the branch destination address storage unit 142 and holds the count value. Thereafter, the process of step S69 is executed.
  • Step S69 The table management unit 152b adds “1” to the Next pointer of the index unit 141b.
  • Step S ⁇ b> 70 Whether the entry indicated by the Next pointer is valid and the value of the Next pointer is less than or equal to the value held in the upper limit register 144 among the entries in the branch destination address storage unit 142. Determine. When these conditions are satisfied (S70: Yes), the table management unit 152b executes the process of step S71, and when these conditions are not satisfied (S70: No), the table management unit 152b executes the process of step S65. .
  • the table management unit 152b outputs a selection request signal to the entry selection unit 143a.
  • the entry selection unit 143a that has received the selection request signal selects an entry indicated by the Next pointer among the entries of the branch destination address storage unit 142, and sets the branch destination address registered in the selected entry as a predicted branch destination address.
  • the data is output to the selection unit 153.
  • the table management unit 152b in the initial state, sequentially starts with the first entry in the branch destination address storage unit 142 each time execution of the table jump instruction is completed with respect to the branch destination address storage unit 142. Register branch destination addresses. At the same time, the table management unit 152b keeps the branch destination registered in the first entry of the branch destination address storage unit 142 until the branch destination is first predicted successfully (that is, while the Create flag is “1”). The address is output as the predicted branch destination address.
  • the table management unit 152b ends address registration in the branch destination address storage unit 142 when the branch destination prediction is first successful. As a result, the branch destination address storage unit 142 registers a history of branch destination addresses up to immediately before the same branch destination address appears as a result of the execution of the table jump instruction.
  • the table management unit 152b sets the value of the Next pointer as the upper limit of the Next pointer in the upper limit register 144, and thereafter registers it in the entry indicated by the Next pointer.
  • the branched branch destination address is output as a predicted branch destination address.
  • the table management unit 152b counts up the Next pointer every time branch destination prediction succeeds, and when the branch destination prediction fails or the value of the next pointer after the count up exceeds the upper limit value, The Next pointer is returned to “0”.
  • 20 and 21 are diagrams illustrating a specific example of the branch destination prediction process.
  • branch destination instruction address repeatedly appears in a pattern of addresses A, B, and B by executing a table jump instruction.
  • FIG. 20 it is assumed that a table jump instruction is executed from a state in which the branch destination address is not registered in the branch destination address storage unit 142 and the state is changed to a state 31 in which the branch destination is determined to be the address A.
  • the prediction of the branch destination fails (S61: Yes in FIG. 19), and the Create flag is “1” (S63: Yes), so that the address A as the branch destination is the first in the branch destination address storage unit 142. It is registered in the 0th entry which is an empty entry (S64). Further, the Next pointer remains “0” (S65), and the address A registered in the 0th entry is output as the predicted branch destination address (S71).
  • the branch destination prediction fails (S61: Yes), and the Create flag is “1” (S63: Yes), so that the branch destination address B Is registered in the second entry in the branch destination address storage unit 142 (S64). Further, the Next pointer remains “0” (S65), and the address A registered in the 0th entry is output as the predicted branch destination address (S71).
  • the branch destination is successfully predicted (S61: No), and the Create flag is updated to “0” (S67).
  • “2” which is the number of valid entries in the branch destination address storage unit 142, is set in the upper limit register 144 (S68), and the Next pointer is counted up to “1” (S69). Since the first entry in the branch destination address storage unit 142 is valid and the value of the Next pointer is less than or equal to the value of the upper limit register 144 (S70: Yes), it is registered in the first entry in the branch destination address storage unit 142.
  • the branch destination address thus output is output as a predicted branch address (S71). Since the Create flag is “0” in the state 34, the branch destination address is not registered in the branch destination address storage unit 142 thereafter.
  • the branch destination prediction is successful, and the Next pointer is counted up to “2”. Further, even in the state 36 in which the branch destination address is determined as the address B, the branch destination prediction is successful. At this time, since the value obtained by adding “1” to the Next pointer (S69) exceeds the value of the upper limit register 144 (S70: No), the Next pointer is returned to “0” (S65). Therefore, the branch destination address registered in the 0th entry in the branch destination address storage unit 142 is output as the predicted branch destination address.
  • branch destinations are predicted for the appearance patterns of addresses A, B, and B that have a higher degree of freedom in combination of instruction addresses than the pattern predictable in the second embodiment. Is possible.
  • the branch destination of the table jump instruction can be predicted, and an increase in manufacturing / development cost and circuit area can be suppressed.
  • the same effect as the form can be obtained.
  • FIG. 22 is a diagram illustrating a configuration example of a main part of the arithmetic processing device according to the fifth embodiment.
  • components corresponding to those in FIG. 17 are denoted by the same reference numerals.
  • the arithmetic processing unit according to the fifth embodiment is different from the arithmetic processing unit according to the fourth embodiment in the configuration of the branch destination address table and is based on a table management unit using the branch destination address table.
  • the procedure of branch destination prediction processing is also different. That is, the arithmetic processing unit according to the fifth embodiment includes a branch destination address table 140c and a table management unit 152c shown in FIG. 22 instead of the branch destination address table 140b and the table management unit 152b shown in FIG. . Similar to the fourth embodiment, a plurality of branch destination address tables 140c are provided.
  • Each branch destination address table 140c includes a branch destination address storage unit 142, an index unit 141b, and an upper limit register 144, similarly to the branch destination address table 140b shown in FIG. However, the Next pointer of the index unit 141b is output not only to the entry selection unit 143c but also to the branch destination address storage unit 142, and is used when determining the branch destination address for the branch destination address storage unit 142.
  • Each branch destination address table 140c includes an entry selection unit 143c. Similarly to the entry selection unit 143a shown in FIG. 17, the entry selection unit 143c selects one of the entries in the branch destination address storage unit 142 and selects the branch destination address registered in the selected entry as a table. Output to the unit 153. However, if the Create flag is “1” when the selection request signal is received from the table management unit 152c, the entry selection unit 143c selects the 0th entry (first entry) in the branch destination address storage unit 142. . When the selection flag is “0” when receiving the selection request signal from the table management unit 152c, the entry selection unit 143c selects the entry indicated by the Next pointer among the entries in the branch destination address storage unit 142. .
  • the table management unit 152c selects the branch destination address table 140c corresponding to the address of the branch instruction that has been executed, information in the selected branch destination address table 140c, and the branch instruction execution result from the branch instruction execution control unit 119
  • the predicted branch destination address is determined based on the success / failure information included in.
  • the main difference between the processing of the table management unit 152c and the processing of the table management unit 152b shown in FIG. 17 is that the branch destination address storage unit 142 stores the branch destination address when the branch destination address is registered. On the other hand, only the registration request signal is output, and the registration destination entry of the branch destination address is not designated. However, the table management unit 152c may specify the branch destination address registration destination entry for the branch destination address storage unit 142.
  • FIG. 23 is a flowchart illustrating the procedure of the predicted branch destination address determination process according to the fifth embodiment. The processing in FIG. 23 corresponds to step S16b in FIG.
  • Step S81 The table management unit 152c determines whether or not the branch destination prediction has failed based on the success / failure information included in the branch instruction execution result from the branch instruction execution control unit 119. When it is determined that the branch destination prediction has failed (S81: Yes), the table management unit 152c executes Step S82, and when it is determined that the branch destination prediction has been successful (S81: No), The process of step S88 is executed.
  • Step S82 The table management unit 152c determines whether there is an empty entry whose valid flag is “0” in the branch destination address storage unit 142 in the branch destination address table 140c selected as the processing target. When there is a free entry (S82: Yes), the table management unit 152c executes the process of step S83, and when there is no free entry (S82: No), the table management unit 152c executes the process of step S87.
  • whether or not there is an empty entry in the branch destination address storage unit 142 can be determined based on the value of the Next pointer. In this case, if the value of the Next pointer is equal to or less than the maximum number of entries in the branch destination address storage unit 142, the table management unit 152c determines that there is an empty entry, and the value of the Next pointer exceeds the maximum number of entries. In this case, it is determined that there is no empty entry.
  • the table management unit 152c refers to the Create flag of the index unit 141b.
  • the table management unit 152c executes the process of step S84, and when the Create flag is “0” (S83: No), the table management unit 152c performs step S87. Execute the process.
  • the table management unit 152c outputs a registration request signal to the branch destination address storage unit 142.
  • the branch destination address storage unit 142 that has received the registration request signal registers the branch destination address included in the branch instruction execution result from the branch instruction execution control unit 119 for the entry indicated by the Next pointer among its own entries. .
  • the table management unit 152c adds “1” to the Next pointer of the index unit 141b.
  • the table management unit 152c outputs a selection request signal to the entry selection unit 143c.
  • the entry selection unit 143c that has received the selection request signal refers to the Create flag.
  • the entry selection unit 143c selects the first entry (0th entry) in the branch destination address storage unit 142, and selects the branch destination address registered in the selected entry. , Output to the table selection unit 153 as the predicted branch destination address.
  • Step S87 The table management unit 152c updates the Next pointer to “0”. Thereafter, the process of step S93 is executed.
  • Step S88 If the branch destination prediction is successful (S81: No), the table management unit 152c determines whether the Create flag of the index unit 141b is “1” in the branch destination address table 140c selected as the processing target. judge. When the Create flag is “1” (S88: Yes), the table management unit 152c executes the process of Step S89, and when the Create flag is “0” (S88: No), the table management unit 152c performs Step S91. Execute the process.
  • Step S89 The table management unit 152c updates the Create flag to “0”.
  • Step S90 The upper limit register 144 that has detected that the Create flag has changed to “0” counts the number of valid entries in the branch destination address storage unit 142, and holds the count value. Thereafter, the process of step S91 is executed.
  • Step S91 The table management unit 152c adds “1” to the Next pointer of the index unit 141b.
  • the table management unit 152c determines whether the entry pointed to by the Next pointer is valid among the entries in the branch destination address storage unit 142 and the value of the Next pointer is equal to or smaller than the value held in the upper limit register 144. Determine. When these conditions are satisfied (S92: Yes), the table management unit 152c executes the process of step S93, and when these conditions are not satisfied (S92: No), the table management unit 152c executes the process of step S87. .
  • the table management unit 152c outputs a selection request signal to the entry selection unit 143c.
  • the entry selection unit 143c that has received the selection request signal refers to the Create flag.
  • the entry selection unit 143c selects the entry indicated by the Next pointer among the entries of the branch destination address storage unit 142, and the branch destination address registered in the selected entry Is output to the table selection unit 153 as a predicted branch destination address.
  • the branch destination address is registered in order from the first entry in the branch destination address storage unit 142. To go. At the same time, until the first branch destination prediction succeeds (that is, while the Create flag is “1”), the branch destination address registered in the head entry of the branch destination address storage unit 142 is the predicted branch destination. Output as an address.
  • the address registration in the branch destination address storage unit 142 ends. As a result, the branch destination address storage unit 142 registers the history of the branch destination addresses up to immediately before the same branch destination address appears as a result of the execution of the table jump instruction.
  • the table management unit 152c sets the value of the Next pointer at that time as the upper limit of the Next pointer in the upper limit register 144 and updates the Create flag to “0”. .
  • the branch destination address registered in the entry pointed to by the Next pointer is output as the predicted branch destination address.
  • the table management unit 152c counts up the Next pointer every time the branch destination prediction succeeds, and when the branch destination prediction fails or the value of the next pointer after the count up exceeds the upper limit value, The Next pointer is returned to “0”.
  • FIG. 5 a specific example of the branch destination prediction process based on the branch destination address registered in the branch destination address table 140c will be described assuming that a program as shown in FIG. 5 is executed.
  • 24 and 25 are diagrams illustrating specific examples of the branch destination prediction process.
  • the table jump instruction is executed from the state where the branch destination address is not registered in the branch destination address storage unit 142 and the state is changed to the state 41 where the branch destination is determined to be the address A.
  • the prediction of the branch destination fails (S81: Yes in FIG. 23) and the Create flag is “1” (S83: Yes), so that the address A as the branch destination is the entry in the branch destination address storage unit 142.
  • the first entry (0th entry) indicated by the Next pointer is registered (S84).
  • the Next pointer is counted up to “1” (S85), and the address A registered in the 0th entry is output as the predicted branch destination address (S86).
  • the branch destination prediction fails (S81: Yes), and the Create flag is “1” (S83: Yes). Therefore, the branch destination address B Is registered in the second entry pointed to by the Next pointer (S84). The Next pointer is counted up to “3” (S85), and the address A registered in the 0th entry is output as the predicted branch destination address (S86).
  • the branch destination is successfully predicted (S81: No), and the Create flag is updated to “0” (S89).
  • “2” which is the number of valid entries in the branch destination address storage unit 142, is set in the upper limit register 144 (S90), and the Next pointer is counted up to “4” (S91).
  • the Next pointer is returned to “0” (S87). Since the Create flag is “0”, the branch destination address (address A) registered in the 0th entry pointed to by the Next pointer is output as the predicted branch destination address (S93). Since the Create flag is “0” in the state 44, the branch destination address is not registered in the branch destination address storage unit 142 thereafter.
  • the branch destination prediction fails (S81: Yes).
  • the Create flag is “0” (S83: No)
  • the Next pointer remains “0” (S87)
  • the branch destination address (address A) registered in the 0th entry pointed to by the Next pointer ) Is output as a predicted branch destination address (S93).
  • the same operation as in the state 45 is performed.
  • the branch destination address is successfully predicted (S81: No).
  • the Create flag is “0” (S88: No)
  • the Next pointer is counted up to “1” (S91), and the branch destination address (address B) registered in the first entry pointed to by the Next pointer. ) Is output as a predicted branch destination address (S93).
  • the branch destination prediction is successful, and the Next pointer is counted up to “2”. Further, even in the state 49 where the branch destination address is determined to be the address B, the branch destination prediction is successful. At this time, since the value obtained by adding “1” to the Next pointer (S91) exceeds the value of the upper limit register 144 (S92), the Next pointer is returned to “0” (S87). Therefore, the branch destination address registered in the 0th entry in the branch destination address storage unit 142 is output as the predicted branch destination address.
  • the prediction of the branch destination continues to succeed. That is, according to the processing of FIG. 23, as in the fourth embodiment, the addresses A, B, and B appear with a higher degree of freedom in combination of instruction addresses than the pattern predictable in the second embodiment.
  • the branch destination can be predicted for the pattern.
  • the processing procedure of the table management unit 152c in the process of registering the branch destination address in the branch destination address storage unit 142 and the process of selecting the output source entry of the predicted branch destination address is simplified. Is done.
  • the effects of being able to predict the branch destination of a table jump instruction can be obtained, and the increase in manufacturing / development cost and circuit area can be suppressed. The same effect as the form can be obtained. Further, according to the fifth embodiment, compared to the second embodiment, it becomes possible to predict a branch destination even for an occurrence pattern having a high degree of freedom in combination of instruction addresses, and the prediction accuracy is improved. .
  • the branch prediction table 131 and the branch destination address table for each branch instruction address are arranged separately.
  • the branch prediction table 131 and the branch destination are used.
  • the address table may be integrated.
  • a plurality of branch destination address tables and ways in the branch prediction table 131 corresponding to each branch destination address table are directly connected without going through the table selection unit 153 or the branch prediction control unit 134. Also good.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Advance Control (AREA)

Abstract

 複数の分岐先をとり得る分岐命令による分岐先を予測可能にする。 分岐先アドレステーブル(11)は、複数の分岐先をとり得る分岐命令ごとに設けられる。各分岐先アドレステーブル(11)は、それぞれに対応する分岐命令による過去の複数回の分岐先アドレスを履歴として記憶する。分岐先予測部(12)は、分岐命令についての予測分岐先アドレスを、この分岐命令に対応する分岐先アドレステーブル(11)に記憶された分岐先アドレスの履歴に基づいて予測する。予測の結果得られた予測分岐先アドレスは、例えば、予測分岐先アドレス記憶部(13)において分岐命令に対応付けて記憶され、分岐先命令を先読みする際に命令フェッチ制御部(14)によって参照される。

Description

演算処理装置および分岐予測方法
 本発明は、演算処理装置および分岐予測方法に関する。
 CPU(Central Processing Unit)などの演算処理装置においては、1つの命令の実行を待たずに、投機的に後続命令の処理を開始することで、演算性能の向上を図る技術が知られている。しかし、分岐命令を実行する場合には、命令を実行した後でないと次の実行する命令アドレスが判明しないため、後続命令の処理を開始することができない。そこで、次に実行する命令アドレスを予測することで、分岐命令を実行する前に後続命令の処理の開始を可能にする分岐予測技術が、広く使用されている。
 分岐予測技術の一例として、ブランチヒストリあるいはグローバルヒストリと呼ばれる、過去の分岐履歴を記憶した情報を用いて、分岐先を予測する技術が知られている。また、サブルーチンからのリターン命令による分岐の予測精度を高める技術として、サブルーチンのコール命令の実行時にリターン命令による戻り先のアドレスをリターンアドレススタックに格納しておき、リターン命令による分岐先をリターンアドレススタックを用いて予測するものがある。さらに、分岐命令の分岐先アドレスの生成に汎用レジスタを使用する場合の分岐予測技術として、分岐先アドレスの生成に使用した汎用レジスタの内容の変更を管理し、その内容変更に応じて、ブランチヒストリに基づく分岐予測結果が正しいか否かを判定するものがある。
 なお、他の参考技術として、分岐命令に対応する複数の分岐先アドレスとその分岐頻度とをシミュレーションにより求めてテーブルに登録し、このテーブルを基に次に実行されるアドレスを予測するようにした、デバッグ用のプログラム開発支援装置がある。
特開2006-155374号公報 特開平4-225429号公報 特開2001-184231号公報
 ところで、分岐命令のうち、条件分岐、無条件分岐、サブルーチンコールなどの命令では、分岐先の命令アドレスは常に一定となる。これに対して、例えば、C言語のスイッチ・ケース文で示される命令のように、条件によって複数の分岐先をとり得るような命令もある。複数の分岐先をとり得る分岐命令を実行する場合、その分岐命令の後に分岐することが予測できたとしても、どの命令アドレスに分岐するかは事前の命令を実行するまでわからないことから、分岐先を予測することが難しかった。
 本発明はこのような課題に鑑みてなされたものであり、複数の分岐先をとり得る分岐命令による分岐先を予測可能にした演算処理装置および分岐予測方法を提供することを目的とする。
 上記目的を達成するために、複数の分岐先アドレステーブルと、分岐先予測部とを有する演算処理装置が提供される。この演算処理装置において、分岐先アドレステーブルは、複数の分岐先をとり得る分岐命令ごとに設けられ、各分岐先アドレステーブルは、自身に対応する分岐命令による過去の複数回の分岐先アドレスを履歴として記憶する。また、分岐先予測部は、分岐命令についての予測分岐先アドレスを、当該分岐命令に対応する分岐先アドレステーブルに記憶された分岐先アドレスの履歴に基づいて予測する。
 また、上記目的を達成するために、分岐予測方法が提供される。この分岐予測方法では、演算処理装置によって次のような処理が実行される。演算処理装置は、複数の分岐先をとり得る分岐命令ごとに設けられ、自身に対応する分岐命令による過去の複数回の分岐先アドレスを履歴としてそれぞれ記憶する複数の分岐先アドレステーブルを参照し、分岐命令についての予測分岐先アドレスを、当該分岐命令に対応する分岐先アドレステーブルに記憶された分岐先アドレスの履歴に基づいて予測する。
 上記の演算処理装置および分岐予測方法では、複数の分岐先をとり得る分岐命令による分岐先を予測することができる。
 本発明の上記および他の目的、特徴および利点は本発明の例として好ましい実施の形態を表す添付の図面と関連した以下の説明により明らかになるであろう。
第1の実施の形態に係る演算処理装置の構成例を示す図である。 第2の実施の形態に係る演算処理装置の全体構成例を示す図である。 分岐予測部が備える分岐予測テーブルにおけるデータの構成例を示す図である。 分岐予測部の内部構成例を示す図である。 テーブルジャンプ命令を実行させるプログラムの例を示す図である。 テーブルジャンプ予測部の内部構成例を示す図である。 第2の実施の形態における分岐先アドレステーブルの構成例を示す図である。 第2の実施の形態におけるテーブルジャンプ命令の分岐先予測処理手順を示すフローチャートである。 第2の実施の形態における予測分岐先アドレスの決定処理の手順を示すフローチャートである。 分岐先予測処理の具体例を示す図である。 第3の実施の形態に係る演算処理装置の要部構成例を示す図である。 第3の実施の形態におけるテーブルジャンプ命令の分岐先予測処理手順を示すフローチャートである。 第3の実施の形態における予測分岐先アドレスの決定処理の手順を示すフローチャートである。 分岐先予測処理の具体例を示す図(その1)である。 分岐先予測処理の具体例を示す図(その2)である。 分岐先予測処理の具体例を示す図(その3)である。 第4の実施の形態に係る演算処理装置の要部構成例を示す図である。 第4の実施の形態におけるテーブルジャンプ命令の分岐先予測処理手順を示すフローチャートである。 第4の実施の形態における予測分岐先アドレスの決定処理の手順を示すフローチャートである。 分岐先予測処理の具体例を示す図(その1)である。 分岐先予測処理の具体例を示す図(その2)である。 第5の実施の形態に係る演算処理装置の要部構成例を示す図である。 第5の実施の形態における予測分岐先アドレスの決定処理の手順を示すフローチャートである。 分岐先予測処理の具体例を示す図(その1)である。 分岐先予測処理の具体例を示す図(その2)である。
 以下、実施の形態について図面を参照して詳細に説明する。
 〔第1の実施の形態〕
 図1は、第1の実施の形態に係る演算処理装置の構成例を示す図である。
 図1に示す演算処理装置1は、命令をメモリ(図示せず)の所定アドレスから読み出し、読み出した命令をデコードして、デコード結果に応じた処理を実行する装置である。この演算処理装置1は、例えば、一般的にCPU、MPU(Microprocessor Unit)などと呼ばれる半導体回路として実現される。また、演算処理装置1は、分岐命令についての分岐先アドレスを予測し、その予測結果に基づいて、分岐命令の実行完了前に分岐先命令をメモリから先読みする機能を備えている。
 演算処理装置1は、分岐命令のうち、複数の分岐先をとり得る分岐命令についての分岐先アドレスの予測処理を実現する処理機能として、複数の分岐先アドレステーブル11と、分岐先予測部12とを備えている。分岐先アドレステーブル11は、複数の分岐先をとり得る分岐命令ごとに設けられ、各分岐命令による過去の複数回の分岐先アドレスをそれぞれ履歴として記憶する。分岐先予測部12は、複数の分岐先をとり得る分岐命令についての予測分岐先アドレスを、この分岐命令に対応する分岐先アドレステーブル11に記憶された分岐先アドレスの履歴に基づいて予測する。
 また、分岐先予測部12によって予測された予測分岐先アドレスは、予測分岐先アドレス記憶部13に登録されてもよい。予測分岐先アドレス記憶部13は、分岐命令のアドレスごとに1つの予測分岐先アドレスを保持することが可能になっている。この予測分岐先アドレス記憶部13は、例えば、命令フェッチの制御を行う命令フェッチ制御部14によって参照される。命令フェッチ制御部14は、分岐命令をメモリからフェッチする際に、その分岐命令のアドレスに対応する予測分岐先アドレスを、予測分岐先アドレス記憶部13から取得し、取得した予測分岐先アドレスを用いて分岐先の命令を先読みする。
 以下、分岐先アドレステーブル11への登録処理および分岐先の予測処理について説明する。なお、以下の第1の実施の形態の説明では、分岐先アドレステーブル11への登録処理も分岐先予測部12が行うものとするが、分岐先アドレステーブル11への登録処理は分岐先予測部12とは別の処理部が行ってもよい。また、以下の第1の実施の形態の説明では、複数の分岐先をとり得る分岐命令を単に「分岐命令」と呼称する。
 分岐命令の実行が完了し、その分岐命令による分岐先のアドレスが確定すると、分岐先予測部12は、実行が完了した分岐命令に対応する分岐先アドレステーブル11を選択する。そして、分岐先予測部12は、選択した分岐先アドレステーブル11に対して、確定した分岐先のアドレスを登録する。
 ただし、分岐先アドレステーブル11への分岐先アドレスの登録は、必要に応じて行われればよい。例えば、分岐先予測部12は、分岐先アドレステーブル11における空きエントリがなくなるまで、分岐先アドレスを登録する。あるいは、分岐先予測部12は、実行が完了した分岐命令について、分岐先予測部12が決定した予測分岐先アドレスに基づく分岐先の予測に成功したか否かに応じて、分岐先アドレスを登録するか否かを決定してもよい。例えば、分岐先予測部12は、分岐先の予測を開始してから、初めて予測に成功する前までの期間において、分岐命令の実行が完了されるたびに分岐先アドレスを分岐先アドレステーブル11に順次登録する。そして、分岐先予測部12は、予測に成功した後では分岐先アドレスの登録を行わないようにする。
 分岐先予測部12は、1つの分岐先アドレステーブル11に登録された分岐先アドレスの履歴に基づいて、その分岐先アドレステーブル11に対応する分岐命令についての予測分岐先アドレスを決定する。分岐先予測部12は、各分岐先アドレステーブル11に登録された分岐先アドレスのうち1つを、予測分岐先アドレスとして選択し、予測分岐先アドレス記憶部13に登録する。ある分岐命令に対応する分岐先アドレステーブル11から出力された予測分岐先アドレスは、予測分岐先アドレス記憶部13において、同じ分岐命令に対応付けて登録される。
 予測分岐先アドレスの決定は、分岐命令の実行が完了し、確定した分岐先アドレスを分岐先アドレステーブル11に反映する処理が実行されたタイミングで行われればよい。分岐先予測部12は、例えば、分岐先アドレステーブル11に十分な数の分岐先アドレスが登録された状態であれば、分岐命令が完了するごとに、分岐先アドレステーブル11内のエントリを先頭から順にシフトさせながら選択していく。そして、分岐先予測部12は、選択したエントリに登録された分岐先アドレスを、予測分岐先アドレスとして予測分岐先アドレス記憶部13に登録する。
 なお、演算処理装置1においては、分岐先予測部12によって決定された予測分岐先アドレスが、予測分岐先アドレス記憶部13を介さずに、命令フェッチ制御部14から直接的に参照されるような構成とされてもよい。
 以上の演算処理装置1では、分岐先予測部12は、分岐命令ごとに記憶された分岐先アドレスの履歴に基づいて、分岐命令ごとに1つの予測分岐先アドレスを予測する。従って、複数の分岐先をとり得る分岐命令についての予測分岐先アドレスを予測することが可能になり、演算処理装置1における分岐先の予測精度が向上し、演算処理装置1の処理性能を向上させることができる。
 〔第2の実施の形態〕
 図2は、第2の実施の形態に係る演算処理装置の全体構成例を示す図である。
 図2に示す演算処理装置100は、命令フェッチ制御部111、命令キャッシュ制御部112、メモリ113、命令バッファ114、デコーダ115、命令実行制御部116、演算部117、オペランドキャッシュ制御部118、分岐命令実行制御部119、命令完了管理部120、分岐予測部121およびプログラムカウンタ122を備える。
 命令フェッチ制御部111は、命令キャッシュ制御部112に対して、次にフェッチさせるアドレスを出力し、命令フェッチを要求する。命令フェッチ制御部111は、フェッチさせる命令のアドレスを、プログラムカウンタ122のカウント値、分岐予測部121から出力された予測分岐先のアドレス、分岐命令実行制御部119からの再命令フェッチ要求などに基づいて決定する。また、命令フェッチ制御部111は、分岐予測部121から出力された、予測分岐先アドレスなどを含む分岐予測情報を、分岐命令実行制御部119に通知する。
 命令キャッシュ制御部112は、その内部に、メモリ113に記憶された命令をキャッシュする命令キャッシュ(図示せず)を備える。命令キャッシュ制御部112は、命令フェッチ制御部111から出力されたアドレスに基づいて、命令キャッシュから命令を読み出し、読み出した命令を命令バッファ114に格納する。
 デコーダ115は、命令バッファ114に格納された命令を読み出してデコードする。デコーダ115は、デコードした命令が分岐命令である場合には、デコードした命令を分岐命令実行制御部119に出力し、デコードした命令が分岐命令以外の命令である場合には、デコードした命令を命令実行制御部116に出力する。また、デコーダ115は、デコードした命令の種類に関係なく、デコードした命令を命令完了管理部120に出力する。
 命令実行制御部116は、例えばリザベーションステーションを備え、デコーダ115からの命令を演算部117またはオペランドキャッシュ制御部118に出力して実行させる。なお、リザベーションステーションは、デコーダ115によってデコードされた命令をキューイングしておき、投入可能な命令から順次、演算部117またはオペランドキャッシュ制御部118に出力するように制御する。
 演算部117は、例えば汎用の演算器を備え、命令実行制御部116からの命令に応じた演算を実行する。演算を実行した演算部117は、演算結果を図示しないレジスタなどに書き込むとともに、命令実行の完了を命令完了管理部120に報告する。
 オペランドキャッシュ制御部118は、その内部に、メモリ113に記憶されたデータをキャッシュするオペランドキャッシュを備える。オペランドキャッシュ制御部118は、例えば、命令実行制御部116からのロード命令に基づいてオペランドアドレスを生成し、生成したオペランドアドレスに対応するデータをオペランドキャッシュから読み出す。オペランドキャッシュ制御部118は、オペランドキャッシュからのデータ読み出しを実行すると、命令実行の完了を命令完了管理部120に報告する。
 分岐命令実行制御部119は、例えば、その内部に分岐リザベーションステーションを備え、デコーダ115によってデコードされた分岐命令を分岐リザベーションステーションに登録することで、分岐命令の実行を管理する。分岐命令実行制御部119は、命令フェッチ制御部111から受信した分岐予測情報と、デコーダ115から受信した分岐命令の実行結果とを比較し、分岐予測の成否を判定する。また、分岐命令実行制御部119は、分岐命令の実行が完了して分岐予測の成否を判定すると、命令実行の完了を命令完了管理部120に報告するとともに、分岐予測の成否、分岐命令および分岐先命令の各アドレスなどの情報を、分岐予測部121に出力する。
 命令完了管理部120は、デコーダ115によってデコードされた命令の実行状態を管理する。命令完了管理部120は、例えば、命令実行制御部116や分岐命令実行制御部119によってアウトオブオーダで実行された命令を、インオーダで完了させる。命令完了管理部120は、命令を完了させるたびに、プログラムカウンタ122のカウント値をカウントアップさせる。
 分岐予測部121は、後述するように、分岐命令のアドレスと予測分岐先のアドレスとが対応付けて登録された分岐予測テーブルを備える。分岐予測部121は、命令フェッチ制御部111から次にフェッチさせる命令のアドレスを受信し、受信したアドレスを用いて分岐予測テーブルを検索する。次にフェッチさせる命令が分岐命令の場合、分岐予測部121は、検索結果として、予測分岐先のアドレスなどを含む分岐予測情報を分岐予測テーブルから取得し、取得した分岐予測情報を命令フェッチ制御部111に出力する。また、分岐予測部121は、分岐命令実行制御部119から受信した、分岐予測の成否、分岐命令および分岐先命令の各アドレスの情報などに基づいて、分岐命令による分岐先を予測し、予測結果に応じて分岐予測テーブルを更新する。
 プログラムカウンタ122は、命令完了管理部120からの要求に応じてカウント値をカウントアップする。また、プログラムカウンタ122は、分岐命令実行制御部119からの分岐先アドレスによってカウント値を更新する。
 次に、分岐予測部について説明する。まず、図3は、分岐予測部が備える分岐予測テーブルにおけるデータの構成例を示す図である。
 分岐予測部121が備える分岐予測テーブル131は、例えばセットアソシアティブの記憶装置であり、複数のウェイを有する。分岐予測テーブル131の各ウェイには、タグとして分岐命令アドレス(またはそのアドレスの一部)が登録され、各分岐命令アドレスに対応付けて、分岐命令の種別を示す分岐命令種別、分岐命令についての種別以外の所定の情報を示すフラグ、および予測分岐先アドレスが登録されている。
 図4は、分岐予測部の内部構成例を示す図である。なお、図4では、分岐予測部121に加えて命令フェッチ制御部111および分岐命令実行制御部119も示し、分岐予測部121の動作を、命令フェッチ制御部111および分岐命令実行制御部119の動作とともに説明する。
 分岐予測部121は、分岐予測テーブル131、グローバルヒストリ132、テーブルジャンプ予測部133、分岐予測制御部134、投機リターンアドレススタック135、リターンアドレススタック136およびセレクタ137を備えている。
 図3に示したように、分岐予測テーブル131には、分岐命令アドレスと予測分岐先アドレスとが対応付けて記憶されている。分岐予測テーブル131に対する登録処理は、分岐予測制御部134によって行われる。
 命令フェッチ制御部111は、フェッチさせる命令のアドレスを命令キャッシュ制御部112に出力する際に、同じアドレスを分岐予測テーブル131にも出力し、分岐予測テーブル131に対して検索を要求する。命令フェッチ制御部111から出力されたアドレスがタグに登録されたウェイが分岐予測テーブル131から検索された場合、検索されたウェイ内の情報と、検索されたウェイのウェイ番号とが、分岐予測情報として、セレクタ137を介して命令フェッチ制御部111に出力される。
 ただし、分岐予測テーブル131から検索されたウェイにおける分岐命令アドレスがサブルーチンコール命令を示すものであった場合、分岐予測テーブル131は、検索された分岐命令アドレスを投機リターンアドレススタック135に出力し、投機リターンアドレススタック135は、分岐予測テーブル131から出力された分岐命令アドレスに対応する予測分岐先アドレスを保持する。後述するように、分岐予測テーブル131から検索されたウェイにおける分岐命令アドレスがサブルーチンリターン命令であった場合には、投機リターンアドレススタック135またはリターンアドレススタック136から取得された予測分岐先アドレスが、セレクタ137を介して命令フェッチ制御部111に出力される。
 命令フェッチ制御部111は、セレクタ137から分岐予測情報を受信した場合、受信した分岐予測情報内の分岐予測先アドレスを命令キャッシュ制御部112に出力し、命令フェッチを要求する。これとともに、命令フェッチ制御部111は、セレクタ137から受信した分岐予測情報を、分岐命令実行制御部119にも出力する。
 分岐命令実行制御部119は、命令フェッチ制御部111から受信した分岐予測情報と、デコーダ115から受信した分岐命令の実行結果とを比較し、分岐予測の成否を判定する。分岐命令実行制御部119は、分岐予測が間違っていたことが判明した場合、分岐先命令の投機実行を図示しない命令実行部にキャンセルさせるとともに、命令フェッチ制御部111に対して、正しい分岐先アドレスを通知して分岐先命令の再フェッチを要求する。
 また、分岐命令実行制御部119は、分岐命令の実行が完了して分岐予測の成否を判定すると、命令実行の完了を命令完了管理部120に報告する。これとともに、分岐命令実行制御部119は、分岐命令実行結果を分岐予測部121に出力する。分岐命令実行結果には、実行完了信号、実行された分岐命令のアドレス、実行された分岐命令の種別情報、分岐先命令のアドレス、分岐予測の成否を示す成否情報、予測分岐先アドレスを登録すべき分岐予測テーブル131内のウェイ番号などを含む。
 グローバルヒストリ132は、分岐命令実行制御部119から出力される分岐命令実行結果のうち、条件分岐命令についての実行結果を内部に取り込んで動作する。グローバルヒストリ132は、取り込んだ分岐命令実行結果に基づいて、条件分岐命令の実行による分岐/非分岐の履歴を記憶し、記憶した履歴に基づいて予測分岐先アドレスを出力する。
 例えば、グローバルヒストリ132は、取り込んだ分岐命令実行結果に基づき、過去に発生した連続分岐回数および連続非分岐回数を記憶する。グローバルヒストリ132は、現在連続している分岐の回数が所定値になると、次回を非分岐と予測し、現在連続している非分岐の回数が所定値になると、次回を分岐と予測する。グローバルヒストリ132は、次回を分岐と予測した場合に、実行された分岐命令に対応する分岐先のアドレスを、予測分岐先のアドレスとして分岐予測制御部134に出力し、分岐予測テーブル131に登録させる。
 テーブルジャンプ予測部133は、分岐命令実行制御部119から出力される分岐命令実行結果のうち、サブルーチンリターン命令を除く、複数の分岐先をとり得る分岐命令についての実行結果を、内部に取り込んで動作する。ここで、テーブルジャンプ予測部133が取り込む命令には、代表的な例として、C言語のスイッチ・ケース文で示される「テーブルジャンプ」と呼ばれる命令を含む。そこで、以下の説明では、テーブルジャンプ予測部133が取り込む命令を、「テーブルジャンプ命令」と呼ぶことにする。
 テーブルジャンプ予測部133は、後述するように、1つ以上のテーブルジャンプ命令のそれぞれのアドレスに対して、実行された複数回の分岐先アドレスの履歴を保持可能なテーブルを備える。テーブルジャンプ予測部133は、内部のテーブルを用いて、テーブルジャンプ命令に対応する予測分岐先アドレスを決定し、決定した予測分岐先アドレスを分岐予測制御部134に出力して、分岐予測テーブル131に登録させる。
 ここで、図5は、テーブルジャンプ命令を実行させるプログラムの例を示す図である。図5では、C言語のスイッチ・ケース文を用いて記述されたプログラムの例を示す。
 図5に示したプログラムが実行されると、条件式aの値に応じて異なる処理が実行される。条件式aの値がa1である場合、処理Paが実行され、条件式aの値がa2である場合、処理Pbが実行され、条件式aの値がa1およびa2以外である場合、処理Pcが実行される。すなわち、演算処理装置100は、図5に示したプログラムに従って命令を実行したとき、条件式aの値に応じて異なる分岐先の命令を実行する。
 以下、図4に戻って説明する。
 分岐予測制御部134は、分岐命令の実行が完了し、分岐命令実行制御部119から分岐命令実行結果が出力されると、予測分岐先アドレスを分岐予測テーブル131に登録する。条件分岐命令の実行が完了した場合、分岐予測制御部134は、グローバルヒストリ132から出力された予測分岐先アドレスを分岐予測テーブル131に登録する。また、テーブルジャンプ命令の実行が完了した場合、分岐予測制御部134は、テーブルジャンプ予測部133から出力された予測分岐先アドレスを分岐予測テーブル131に登録する。さらに、分岐予測制御部134は、例えば、サブルーチンコール命令やサブルーチンリターン命令の実行が完了した場合など、グローバルヒストリ132およびテーブルジャンプ予測部133から予測分岐先アドレスが出力されない場合には、分岐命令実行制御部119から出力された分岐命令実行結果に含まれる分岐先アドレスを、予測分岐先アドレスとして分岐予測テーブル131に登録する。
 分岐予測制御部134は、予測分岐先アドレスとともに、この予測分岐先アドレスに対応する分岐命令アドレス、種別情報および各種フラグを、分岐予測テーブル131内の同じウェイに登録する。分岐予測制御部134は、分岐予測テーブル131に登録する分岐命令アドレス、種別情報および各種フラグを、分岐命令実行制御部119から出力された分岐命令実行結果から取得する。
 また、分岐予測制御部134は、実行された分岐命令に対応するウェイがすでに分岐予測テーブル131に存在する場合には、そのウェイ内のタグ以外の情報を新たな情報によって更新する。この場合、分岐予測制御部134は、分岐予測テーブル131のウェイのうち、分岐命令実行制御部119からの分岐命令実行結果に含まれるウェイ番号が示すウェイに対して、情報を登録する。一方、分岐予測制御部134は、実行された分岐命令に対応するウェイが分岐予測テーブル131に存在しない場合には、分岐予測テーブル131内の空いているウェイに対して、タグを含む情報を登録する。ただし、分岐予測制御部134は、分岐予測テーブル131に空いているウェイがなければ、例えばLRU(Least Recently Used)またはそれに準じる方法などでウェイを選択し、選択したウェイに対してタグを含む情報を登録する。なお、分岐予測制御部134は、例えば、分岐命令アドレスと、分岐予測テーブル131内のウェイとの対応表に基づいて、分岐予測テーブル131における予測分岐先アドレスの登録先のウェイを指定してもよい。
 投機リターンアドレススタック135は、サブルーチンリターン命令についての戻り先アドレスを、このサブルーチンリターン命令に対応するサブルーチンコール命令の実行前に投機的に予測する。投機リターンアドレススタック135は、前述のように、分岐予測テーブル131から検索されたウェイにおける分岐命令アドレスがサブルーチンコール命令のアドレスであった場合に、検索された分岐命令アドレスを分岐予測テーブル131から取得する。投機リターンアドレススタック135は、検索されたサブルーチンコール命令のアドレスをこのサブルーチンコール命令に対応するサブルーチンリターン命令のアドレスに変換する演算を行い、演算結果をスタックに保持する。投機リターンアドレススタック135は、例えば、サブルーチンコール命令のアドレスに所定の値を加算することで、このサブルーチンコール命令に対応するサブルーチンリターン命令のアドレスを算出する。投機リターンアドレススタック135は、スタックに保持されたアドレスを、サブルーチンリターン命令についての予測戻り先アドレス(すなわち予測分岐先アドレス)として出力する。
 リターンアドレススタック136は、分岐命令実行制御部119からの分岐命令実行結果に基づき、実行が完了したサブルーチンコール命令に対応するサブルーチンリターン命令の戻り先アドレスを記憶する。リターンアドレススタック136は、実行が完了したサブルーチンコール命令のアドレスを、このサブルーチンコール命令に対応するサブルーチンリターン命令のアドレスに変換する演算を行い、演算結果をスタックに保持する。リターンアドレススタック136は、例えば、サブルーチンコール命令のアドレスに所定の値を加算することで、このサブルーチンコール命令に対応するサブルーチンリターン命令のアドレスを算出する。リターンアドレススタック136は、スタックに保持されたアドレスを、サブルーチンリターン命令についての予測戻り先アドレス(すなわち予測分岐先アドレス)として出力する。
 セレクタ137は、命令フェッチ制御部111から分岐予測テーブル131に対して検索が要求されると、分岐予測テーブル131から検索されたウェイに基づく分岐予測情報を、命令フェッチ制御部111に出力する。この分岐予測情報には、予測分岐先アドレスが含まれる。ただし、セレクタ137は、分岐予測テーブル131に対してサブルーチンリターン命令の検索が要求された場合には、投機リターンアドレススタック135またはリターンアドレススタック136のうち有効な予測分岐先アドレスを保持するスタックから、予測分岐先アドレスを取得して、命令フェッチ制御部111に出力する。
 次に、テーブルジャンプ予測部133における処理について説明する。図6は、テーブルジャンプ予測部の内部構成例を示す図である。
 テーブルジャンプ予測部133には、分岐先アドレステーブル140が複数設けられる。分岐先アドレステーブル140は、分岐命令ごとに用意され、各分岐先アドレステーブル140には、1つの分岐命令アドレスと、実行された分岐命令による複数の分岐先アドレスとが保持できるようになっている。
 また、テーブルジャンプ予測部133は、分岐命令識別部151、テーブル管理部152およびテーブル選択部153を備えている。
 分岐命令識別部151は、分岐命令の実行が完了したとき、分岐命令実行制御部119から出力された分岐命令実行結果に含まれる種別情報に基づいて、出力された分岐命令実行結果がテーブルジャンプ命令についての実行結果かを判定する。分岐命令識別部151は、分岐命令実行結果がテーブルジャンプ命令についての実行結果であると判定した場合、テーブル管理部152の処理を開始させる。
 テーブル管理部152は、分岐先アドレステーブル140の生成および検索や、予測分岐先アドレスの決定などの処理を行う。テーブル管理部152は、実行が完了したテーブルジャンプ命令のアドレスが登録された分岐先アドレステーブル140を選択する。このとき、実行が完了したテーブルジャンプ命令のアドレスが登録された分岐先アドレステーブル140が存在しない場合には、テーブル管理部152は、実行が完了したテーブルジャンプ命令のアドレスを登録した新たな分岐先アドレステーブル140を生成する。テーブル管理部152は、テーブル選択部153に対してテーブル選択信号を出力し、選択した、または新たに生成した分岐先アドレステーブル140からの出力を選択させる。
 テーブル管理部152は、選択した、または新たに生成した分岐先アドレステーブル140に対して、分岐命令実行結果に含まれる分岐先アドレスを登録する。これとともに、テーブル管理部152は、分岐先アドレステーブル140のエントリの中から、予測分岐先アドレスとする分岐先アドレスが保持されたエントリを選択し、選択したエントリから予測分岐先アドレスを出力させるように指示するエントリ選択信号を出力する。
 テーブル選択部153は、テーブル管理部152からのテーブル選択信号に基づいて、分岐先アドレステーブル140のうちの1つを選択する。テーブル選択部153は、選択した分岐先アドレステーブル140から出力された予測分岐先アドレスを、分岐予測制御部134を介して分岐予測テーブル131に出力する。
 図7は、第2の実施の形態における分岐先アドレステーブルの構成例を示す図である。なお、図7では、参考のため、テーブル管理部152およびテーブル選択部153についても図示している。
 分岐先アドレステーブル140のそれぞれには、情報を保持する領域として、インデックス部141および分岐先アドレス記憶部142が設けられている。
 インデックス部141には、テーブルバリッドとインデックスとが保持される。テーブルバリッドは、分岐先アドレステーブル140が有効であるか否か(すなわち、分岐先アドレステーブル140に、分岐命令のアドレスと少なくとも1つの分岐先アドレスとが登録されているか否か)を示すフラグである。テーブルバリッドは、値が「1」のとき、分岐先アドレステーブル140が有効であることを示し、値が「0」のとき、分岐先アドレステーブル140が有効でないことを示す。インデックスには、分岐命令のアドレスの全体または一部が登録される。インデックスに登録された値により、分岐先アドレステーブル140がどのテーブルジャンプ命令に対応するかが識別される。
 分岐先アドレス記憶部142には、バリッドフラグ(図7では「V」と表記)と分岐先アドレスとをそれぞれ含む複数のエントリが設けられている。テーブル管理部152の制御により、分岐先アドレス記憶部142では先頭のエントリから順に分岐先アドレスが登録され、分岐先アドレスが登録されたエントリではバリッドフラグが「1」とされる。
 また、分岐先アドレステーブル140のそれぞれには、エントリ選択部143が設けられている。エントリ選択部143は、テーブル管理部152からのエントリ選択信号に応じて、分岐先アドレステーブル140内の1つのエントリを選択し、選択したエントリから出力された予測分岐先アドレスを、テーブル選択部153に出力する。
 図8は、第2の実施の形態におけるテーブルジャンプ命令の分岐先予測処理手順を示すフローチャートである。
 [ステップS11]分岐命令の実行が完了すると、分岐命令実行制御部119からの分岐命令実行結果に含まれる実行完了信号がオンを示す「1」になる。このとき、分岐命令実行制御部119からの分岐命令実行結果に含まれる、実行完了信号以外の信号が有効になる。
 分岐命令識別部151は、実行完了信号が「1」になったことを検知すると、分岐命令実行制御部119から分岐命令実行結果に含まれる種別情報に基づいて、実行が完了した命令がテーブルジャンプ命令であるかを判定する。実行が完了した命令がテーブルジャンプ命令であると分岐命令識別部151が判定すると、例えば、分岐命令識別部151からテーブル管理部152に対してイネーブル信号が出力されることにより、ステップS12以降の処理が実行される。
 [ステップS12]テーブル管理部152は、テーブルジャンプ予測部133に含まれる複数の分岐先アドレステーブル140のそれぞれにおけるインデックス部141を参照する。そして、テーブル管理部152は、複数の分岐先アドレステーブル140の中から、分岐命令実行制御部119からの分岐命令実行結果に含まれる分岐命令アドレスがインデックスとして登録されたテーブルを検索する。このステップS12では、インデックス部141において、分岐命令実行結果に含まれる分岐命令アドレスがインデックスとして登録され、なおかつテーブルバリッドが「1」である分岐先アドレステーブル140が検索される。
 [ステップS13]テーブル管理部152は、ステップS12の検索により、分岐命令実行結果に含まれる分岐命令アドレスが登録された分岐先アドレステーブル140が存在した場合(S13:Yes)には、その分岐先アドレステーブル140を以後の処理対象として選択し、ステップS16の処理を実行する。一方、テーブル管理部152は、ステップS12の検索により、分岐命令実行結果に含まれる分岐命令アドレスが登録された分岐先アドレステーブル140が存在しない場合(S13:No)には、ステップS14の処理を実行する。
 [ステップS14]テーブル管理部152は、インデックス部141のテーブルバリッドが無効を示す「0」である分岐先アドレステーブル140を、以後の処理対象として新規に選択する。このとき、テーブル管理部152は、選択した分岐先アドレステーブル140におけるテーブルバリッドを「1」に更新する。
 なお、テーブル管理部152は、例えば、ラウンドロビンカウンタを用いて、分岐先アドレステーブル140を次のように管理する。分岐先アドレステーブル140の数をN個(ただし、Nは1以上の整数)とすると、ラウンドロビンカウンタのカウント初期値は「0」であり、カウント値の上限値は「N-1」である。ステップS14では、テーブル管理部152は、ラウンドロビンカウンタの現在のカウント値に対応する分岐先アドレステーブル140を処理対象として選択する。このとき、テーブル管理部152は、選択した分岐先アドレステーブル140におけるテーブルバリッドを「1」に更新するとともに、ラウンドロビンカウンタのカウント値に「1」を加算する。
 [ステップS15]テーブル管理部152は、ステップS14で選択した分岐先アドレステーブル140に対して、分岐命令実行制御部119からの分岐命令実行結果に含まれる分岐命令アドレスをインデックスとして登録する。この後、ステップS16の処理が実行される。
 [ステップS16]テーブル管理部152は、処理対象として選択した分岐先アドレステーブル140における登録情報に基づいて、予測分岐先アドレスを決定する。このステップS16では、テーブル管理部152は、エントリ選択部143に対して、分岐先アドレス記憶部142のエントリのうち1つを選択させ、選択させたエントリに登録されたアドレスを予測分岐先アドレスとしてテーブル選択部153に出力させる。なお、このステップS16の処理については、図9において詳しく説明する。
 [ステップS17]テーブル管理部152は、テーブル選択部153に対して選択信号を出力することで、処理対象として選択した分岐先アドレステーブル140におけるエントリ選択部143からの出力を選択させる。なお、選択信号の出力自体は、ステップS13で分岐命令アドレスが登録された分岐先アドレステーブル140の存在を確認してから、あるいは、ステップS14で分岐先アドレステーブル140を新規に選択してから、ステップS17の実行タイミングまでのどの段階で行われてもよい。
 エントリ選択部143から出力された予測分岐先アドレスは、テーブル選択部153を通じて分岐予測制御部134に出力される。分岐予測制御部134は、テーブル選択部153から出力された予測分岐先アドレスを、この予測分岐先アドレスに対応する分岐命令アドレス、分岐命令種別および各種フラグとともに、分岐予測テーブル131に登録する。このとき、分岐予測制御部134は、分岐予測テーブル131に登録する分岐命令アドレス、分岐命令種別および各種フラグを、分岐命令実行制御部119から出力された分岐命令実行結果から取得する。なお、分岐予測制御部134は、実行された分岐命令に対応するウェイがすでに分岐予測テーブル131に存在する場合には、分岐命令実行制御部119からの分岐命令実行結果に含まれるウェイ番号が示す、分岐予測テーブル131内のウェイに対して、予測分岐先アドレス、分岐命令種別および各種フラグを上書きする。
 図9は、第2の実施の形態における予測分岐先アドレスの決定処理の手順を示すフローチャートである。この図9の処理は、図8のステップS16に対応するものである。
 [ステップS21]テーブル管理部152は、処理対象として選択した分岐先アドレステーブル140における分岐先アドレス記憶部142から、実行が完了した分岐命令についての分岐先アドレス(すなわち、分岐命令実行制御部119からの分岐命令実行結果に含まれる分岐先アドレス)が登録されたエントリを検索する。
 [ステップS22]テーブル管理部152は、ステップS21の検索処理により、分岐命令実行結果に含まれる分岐先アドレスが登録されたエントリとしてn番目(ただし、nは0を初期値とする整数)のエントリがマッチした場合(S22:Yes)には、ステップS23の処理を実行する。一方、テーブル管理部152は、分岐命令実行結果に含まれる分岐先アドレスが登録されたエントリが存在しない場合(S22:No)には、ステップS25の処理を実行する。
 [ステップS23]テーブル管理部152は、分岐先アドレス記憶部142のエントリのうち、ステップS22でマッチしたエントリの次のエントリ((n+1)番目のエントリ)が有効であるかを判定する。ここで、(n+1)番目のエントリが有効である場合(S23:Yes)とは、(n+1)番目のエントリにおいて、バリッドフラグが「1」であり、分岐先アドレスが登録されている場合である。この場合、テーブル管理部152は、ステップS24の処理を実行する。一方、(n+1)番目のエントリが有効でない場合(S23:No)とは、(n+1)番目のエントリのバリッドフラグが「0」である場合か、あるいは、n番目のエントリが分岐先アドレス記憶部142の末端のエントリであるために(n+1)番目のエントリが存在しない場合である。このように(n+1)番目のエントリが有効でない場合、テーブル管理部152は、ステップS27の処理を実行する。
 [ステップS24]テーブル管理部152は、エントリ選択部143に対して選択信号を出力して、ステップS22でマッチしたエントリの次のエントリ((n+1)番目のエントリ)からの出力を選択させる。これにより、(n+1)番目のエントリに登録された分岐先アドレスが、予測分岐先アドレスとして、エントリ選択部143を通じてテーブル選択部153に出力される。
 [ステップS25]分岐命令実行結果に含まれる分岐先アドレスが登録されたエントリが、分岐先アドレス記憶部142に存在しない場合(S22:No)、テーブル管理部152は、分岐先アドレス記憶部142に、バリッドフラグが「0」である空きエントリがあるかを判定する。テーブル管理部152は、空きエントリが存在する場合(S25:Yes)には、ステップS26の処理を実行し、空きエントリが存在しない場合(S25:No)には、ステップS27の処理を実行する。
 [ステップS26]テーブル管理部152は、分岐先アドレス記憶部142の空きエントリのうち、最も番号が小さいエントリにおいて、バリッドフラグを「1」に更新するとともに、分岐命令実行結果に含まれる分岐先アドレスを登録する。この後、ステップS27の処理が実行される。
 [ステップS27]テーブル管理部152は、エントリ選択部143に対して選択信号を出力して、分岐先アドレス記憶部142の先頭エントリ(0番目のエントリ)からの出力を選択させる。これにより、分岐先アドレス記憶部142の先頭エントリに登録された分岐先アドレスが、予測分岐先アドレスとして、エントリ選択部143を通じてテーブル選択部153に出力される。
 以上の図9の処理では、テーブル管理部152は、分岐先アドレス記憶部142から、テーブルジャンプ命令の実行後における分岐先アドレスと一致するアドレスが登録されたエントリを検索する。テーブルジャンプ命令の実行後における分岐先アドレスが分岐先アドレス記憶部142に記憶されていない場合、テーブル管理部152は、分岐先アドレス記憶部142の最も番号が小さい空きエントリに、分岐先アドレスを登録する。この場合、テーブル管理部152は、テーブル管理部152の先頭エントリに登録された分岐先アドレスを、予測分岐先アドレスに決定する。一方、テーブルジャンプ命令の実行後における分岐先アドレスが登録されたエントリが分岐先アドレス記憶部142から検索された場合、テーブル管理部152は、分岐先アドレス記憶部142に新規に分岐先アドレスを登録しない。この場合、テーブル管理部152は、検索されたエントリの次に位置する有効なエントリに登録された分岐先アドレスを、予測分岐先アドレスに決定する。
 ここで、図5に示すようなプログラムが実行された場合を想定して、分岐先アドレステーブル140に登録された分岐先アドレスに基づく分岐先予測処理の具体例について説明する。図10は、分岐先予測処理の具体例を示す図である。
 この図10では、例として、テーブルジャンプ命令の実行により、分岐先の命令アドレスがアドレスA,B,A,B,・・・と繰り返し出現する場合を想定する。なお、アドレスAとは、図5の処理Paを実行する命令のアドレスであり、アドレスBとは、図5の処理Pbを実行する命令のアドレスであるものとする。
 また、図10において、「前回の予測」とは、分岐命令実行制御部119から出力された分岐先アドレスに対応するテーブルジャンプ命令を先読みする際に、命令フェッチ制御部111が分岐予測テーブル131から取得した予測分岐先アドレスを示す。分岐先アドレスと「前回の予測」のアドレスとが一致しない場合、予測に失敗したことを示す。また、「次回の予測」とは、その状態においてテーブルジャンプ予測部133から分岐予測テーブル131に登録される予測分岐アドレスであり、次の状態における「前回の予測」のアドレスと同じになる。
 図10において、分岐先アドレス記憶部142に分岐先アドレスが未登録の状態から、テーブルジャンプ命令が実行されて、分岐先がアドレスAと決定された状態1に遷移したものとする。このとき、分岐先アドレスにマッチするエントリが存在せず(図9のS22:No)、空きエントリが存在する状態(S25:Yes)となることから、テーブル管理部152は、分岐先アドレス記憶部142の0番目のエントリにアドレスAを登録する(S26に対応)。また、テーブル管理部152は、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAを出力させる(S27)。
 次に、同じアドレスのテーブルジャンプ命令が実行されて、分岐先がアドレスBと決定された状態2に遷移したものとする。このとき、分岐先アドレスにマッチするエントリが存在せず(S22:No)、空きエントリが存在する状態(S25:Yes)となることから、テーブル管理部152は、分岐先アドレス記憶部142の1番目のエントリにアドレスBを登録する(S26に対応)。また、テーブル管理部152は、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAを出力させる(S27)。
 次に、同じアドレスのテーブルジャンプ命令が実行されて、分岐先がアドレスAと決定された状態3に遷移したものとする。この場合、前回の予測分岐先アドレスと実際の分岐先アドレスとが一致し、予測に成功する。この状態3では、0番目のエントリが分岐先アドレスにマッチし(S22:Yes)、1番目のエントリが有効である(S23:Yes)ことから、テーブル管理部152は、分岐先アドレスの登録を行わずに、予測分岐先アドレスとして、1番目のエントリに登録されたアドレスBを出力させる(S27)。
 次に、同じアドレスのテーブルジャンプ命令が実行されて、分岐先がアドレスBと決定された状態4に遷移したものとする。この場合、前回の予測分岐先アドレスと実際の分岐先アドレスとが一致し、予測に成功する。この状態4では、1番目のエントリが分岐先アドレスにマッチするが(S22:Yes)、2番目のエントリは無効である(S23:No)ことから、テーブル管理部152は、分岐先アドレスの登録を行わずに、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAを出力させる(S27)。
 以後、分岐先アドレスとしてアドレスAとアドレスBとが繰り返し出現した場合には、常に予測に成功することになる。
 以上の図10の例のように、図9の処理では、分岐先アドレス記憶部142には、テーブルジャンプ命令の実行後における分岐先アドレスの履歴として、異なる分岐先アドレスが初めて出現するたびに分岐先アドレスが登録される。このため、分岐先アドレス記憶部142には、互いに異なる分岐先アドレスが登録され、1つの分岐先アドレスは1つのエントリにのみ登録される。また、テーブルジャンプ命令の実行後における分岐先アドレスが分岐先アドレス記憶部142におけるn番目のエントリに登録されていた場合、(n+1)番目のエントリに異なる分岐先アドレスが登録されていれば、(n+1)番目のエントリに登録された分岐先アドレスが予測分岐先アドレスとして出力される。このような図9の処理によれば、特に、分岐先アドレスの出現パターンが、異なる複数の分岐先アドレスを有するパターンになるような場合に、テーブルジャンプ命令の実行による分岐先命令を高精度に予測できる。
 また、以上説明した第2の実施の形態では、テーブルジャンプ予測部133は、実行されたテーブルジャンプ命令のアドレスごとに用意された分岐先アドレステーブル140に対して、過去に実行されたテーブルジャンプ命令についての分岐先アドレスの履歴が登録される。そして、各分岐先アドレステーブル140から1つの予測分岐先アドレスが出力されて、出力された予測分岐先アドレスがテーブルジャンプ命令のアドレスとともに分岐予測テーブル131に登録される。
 このような構成により、命令フェッチ制御部111は、テーブルジャンプ命令についての予測分岐先アドレスを、条件分岐命令についての予測分岐先アドレスと同じく、分岐予測テーブル131の検索によって取得することができる。換言すれば、命令フェッチ制御部111に対して予測分岐先アドレスを供給する手段としての分岐予測テーブル131を、条件分岐命令についての予測分岐先アドレスの供給だけでなく、テーブルジャンプ命令についての予測分岐先アドレスの供給のためにも共通に使用できる。従って、テーブルジャンプ命令の分岐先を予測できるという効果を奏しながらも、命令フェッチ制御部111が分岐予測テーブル131から予測分岐先アドレスを取得することを実現する回路構成や制御手法を大きく変更する必要がなくなり、製造/開発コストや回路面積が増大することを抑制できる。
 〔第3の実施の形態〕
 図11は、第3の実施の形態に係る演算処理装置の要部構成例を示す図である。なお、この図11では、図7に対応する構成要素については同じ符号を付して示す。
 第3の実施の形態に係る演算処理装置は、第2の実施の形態に係る演算処理装置と比較して、分岐先アドレステーブルの構成が異なるとともに、分岐先アドレステーブルを用いたテーブル管理部による分岐先予測処理の手順も異なる。すなわち、第3の実施の形態に係る演算処理装置は、図7に示した分岐先アドレステーブル140およびテーブル管理部152の代わりに、図11に示す分岐先アドレステーブル140aおよびテーブル管理部152aを備える。なお、第2の実施の形態と同様に、分岐先アドレステーブル140aは複数設けられる。
 各分岐先アドレステーブル140aは、図7に示した分岐先アドレステーブル140と同様に、分岐先アドレス記憶部142を備える。また、各分岐先アドレステーブル140aはさらに、インデックス部141aおよびエントリ選択部143aを備える。
 インデックス部141aには、図7に示したインデックス部141に含まれるテーブルバリッドおよびインデックスに加えて、Nextポインタが保持される。Nextポインタは、分岐先アドレス記憶部142のエントリのうち、予測分岐先アドレスを出力させるエントリを指し示す。例えば、Nextポインタが「0」の場合、Nextポインタは分岐先アドレス記憶部142における0番目のエントリを指し示し、Nextポインタが「1」の場合、Nextポインタは分岐先アドレス記憶部142における1番目のエントリを指し示す。Nextポインタの初期値は「0」とされ、Nextポインタの値はテーブル管理部152aによってカウントされる。
 エントリ選択部143aは、分岐先アドレス記憶部142のエントリのうち1つを選択して、選択したエントリに登録された分岐先アドレスを、予測分岐先アドレスとしてテーブル選択部153に出力する。エントリ選択部143aは、テーブル管理部152aから選択要求信号が出力されたとき、分岐先アドレス記憶部142のエントリのうち、インデックス部141aにおけるNextポインタが指し示すエントリを選択する。
 テーブル管理部152aは、実行が完了した分岐命令のアドレスに対応する分岐先アドレステーブル140aを選択し、選択した分岐先アドレステーブル140a内の情報に基づいて、予測分岐先アドレスを決定する。図7に示したテーブル管理部152と異なり、テーブル管理部152aは、分岐命令実行制御部119からの分岐命令実行結果に含まれる成否情報に基づいて、分岐予測に失敗した場合のみ分岐先アドレス記憶部142に分岐先アドレスを登録する。また、テーブル管理部152aは、分岐先アドレス記憶部142のエントリに対して空きがなくなるまで分岐先アドレスを登録する。これらの相違点により、テーブル管理部152aは、第2の実施の形態の場合と比較して、分岐先アドレスの繰り返しパターンがより複雑になる場合でも、分岐先を予測できるようになっている。
 図12は、第3の実施の形態におけるテーブルジャンプ命令の分岐先予測処理手順を示すフローチャートである。
 図12に示す処理のうち、ステップS11の処理は、図8に示したステップS11の処理と同じである。また、ステップS12~S15,S17の処理は、テーブル管理部152の代わりにテーブル管理部152aが処理を実行すること、および、処理対象が分岐先アドレステーブル140の代わりに分岐先アドレステーブル140aになること以外は、図8に示したステップS12~S15,S17の処理と同じである。これら以外に図8の処理と異なる点は、ステップS15の次にステップS31が実行される点と、ステップS16の代わりにステップS16aが実行される点である。
 図12において、テーブル管理部152aは、ステップS12の検索により、分岐命令実行結果に含まれる分岐命令アドレスが登録された分岐先アドレステーブル140aが存在しない場合(S13:No)には、テーブル管理部152aは、インデックス部141aのテーブルバリッドが無効を示す「0」である分岐先アドレステーブル140aを、以後の処理対象として新規に選択する。このとき、テーブル管理部152aは、選択した分岐先アドレステーブル140aにおけるテーブルバリッドを「1」に更新する(ステップS14)。次に、テーブル管理部152aは、ステップS14で選択した分岐先アドレステーブル140aに対して、分岐命令実行制御部119からの分岐命令実行結果に含まれる分岐命令アドレスをインデックスとして登録する(ステップS15)。
 次に、テーブル管理部152aは、ステップS14で選択した分岐先アドレステーブル140aにおいて、インデックス部141aのNextポインタを「0」とする(ステップS31)。すなわち、新規に有効化された分岐先アドレステーブル140aにおいては、インデックス部141aにおけるNextポインタが、初期値である「0」に設定される。なお、ステップS15,S31の処理順は逆であってもよい。あるいは、ステップS15,S31の各処理は同時に実行されてもよい。
 ステップS12の検索により、分岐命令実行結果に含まれる分岐命令アドレスが登録された分岐先アドレステーブル140aが存在した場合(S13:Yes)、または、ステップS12の検索により、分岐命令実行結果に含まれる分岐命令アドレスが登録された分岐先アドレステーブル140aが存在せず(S13:No)、ステップS14,S15,S31の各処理が実行された場合には、テーブル管理部152aは、処理対象として選択した分岐先アドレステーブル140aにおける登録情報と、分岐命令実行制御部119からの分岐命令実行結果に含まれる成否情報とに基づいて、予測分岐先アドレスを決定する(ステップS16a)。この後、ステップS17の処理が実行される。
 図13は、第3の実施の形態における予測分岐先アドレスの決定処理の手順を示すフローチャートである。この図13の処理は、図12のステップS16aに対応するものである。
 [ステップS41]テーブル管理部152aは、分岐命令実行制御部119からの分岐命令実行結果に含まれる成否情報に基づき、分岐先の予測に失敗したか否かを判定する。テーブル管理部152aは、分岐先の予測に失敗したと判定した場合(S41:Yes)には、ステップS42を実行し、分岐先の予測に成功したと判定した場合(S41:No)には、ステップS43の処理を実行する。
 [ステップS42]テーブル管理部152aは、処理対象として選択した分岐先アドレステーブル140aにおいて、インデックス部141aのNextポインタを「0」にする。この後、ステップS45の処理が実行される。
 [ステップS43]テーブル管理部152aは、処理対象として選択した分岐先アドレステーブル140aにおいて、インデックス部141aのNextポインタに「1」を加算する。
 [ステップS44]テーブル管理部152aは、分岐先アドレス記憶部142のエントリのうち、現在Nextポインタが指し示すエントリが有効であるか否かを判定する。ここで、エントリが有効であるとは、Nextポインタが指し示すエントリのバリッドフラグが「1」であって、そのエントリに有効な分岐先アドレスが登録されていることを指す。一方、エントリが有効でないとは、Nextポインタが指し示すエントリのバリッドフラグが「0」であるか、または、Nextポインタが指し示すエントリが存在しない(すなわち、Nextポインタの値が分岐先アドレス記憶部142のエントリ数を超えている)ことを指す。
 テーブル管理部152aは、Nextポインタが指し示すエントリが有効である場合(S44:Yes)には、ステップS45の処理を実行し、Nextポインタが指し示すエントリが有効でない場合(S44:No)、ステップS42の処理を実行する。
 [ステップS45]分岐先アドレス記憶部142に、バリッドフラグが「0」である空きエントリがあるかを判定する。テーブル管理部152aは、空きエントリが存在する場合(S45:Yes)には、ステップS46の処理を実行し、空きエントリが存在しない場合(S45:No)には、ステップS47の処理を実行する。
 [ステップS46]テーブル管理部152aは、分岐先アドレス記憶部142の空きエントリのうち、最も番号が小さいエントリにおいて、バリッドフラグを「1」に更新するとともに、分岐命令実行結果に含まれる分岐先アドレスを登録する。この後、ステップS47の処理が実行される。
 [ステップS47]テーブル管理部152aは、エントリ選択部143aに対して選択要求信号を出力する。選択要求信号を受信したエントリ選択部143aは、分岐先アドレス記憶部142のエントリのうち、Nextポインタが指し示すエントリを選択し、選択したエントリに登録された分岐先アドレスを、予測分岐先アドレスとしてテーブル選択部153に出力する。
 以上の図13の処理では、テーブル管理部152aは、分岐先アドレス記憶部142に空きエントリが存在しなくなるまで、テーブルジャンプ命令の実行が完了するたびに、分岐先アドレスを分岐先アドレス記憶部142に蓄積する。また、テーブル管理部152aは、分岐先の予測に失敗した場合には、分岐先アドレス記憶部142の先頭エントリに登録された分岐先アドレスを、予測分岐先アドレスとして出力させる。さらに、テーブル管理部152aは、分岐先の予測に成功した場合でも、その時点でNextポインタが指し示すエントリの次のエントリが有効でない場合には、分岐先アドレス記憶部142の先頭エントリに登録された分岐先アドレスを、予測分岐先アドレスとして出力させる。一方、テーブル管理部152aは、分岐先の予測に成功し、かつ、その時点でNextポインタが指し示すエントリの次のエントリが有効である場合には、次のエントリに登録された分岐先アドレスを、予測分岐先アドレスとして出力させる。
 ここで、図5に示すようなプログラムが実行された場合を想定して、分岐先アドレステーブル140aに登録された分岐先アドレスに基づく分岐先予測処理の具体例について説明する。図14~図16は、分岐先予測処理の具体例を示す図である。
 これらの図14~図16では、例として、テーブルジャンプ命令の実行により、分岐先の命令アドレスがアドレスA,B,A,B,C,Cというパターンで繰り返し出現する場合を想定する。なお、アドレスAとは、図5の処理Paを実行する命令のアドレスであり、アドレスBとは、図5の処理Pbを実行する命令のアドレスであり、アドレスCとは、図5の処理Pcを実行する命令のアドレスであるものとする。また、図14~図16では、例として、分岐先アドレス記憶部142は、0番目から7番目までの8個のエントリを備えるものとする。
 まず、図14において、分岐先アドレス記憶部142に分岐先アドレスが未登録の状態から、テーブルジャンプ命令が実行されて、分岐先がアドレスAと決定された状態11に遷移したものとする。このとき、分岐先の予測が失敗となるので(図13のS41:Yes)、Nextポインタは「0」のままになり(S42)、分岐先であるアドレスAは分岐先アドレス記憶部142における先頭の空きエントリである0番目のエントリに登録される(S46)。また、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAが出力される(S47)。なお、これ以後、分岐先アドレス記憶部142には、エントリが満杯になる状態18まで、分岐先アドレスが蓄積されていく。
 次に、同じアドレスのテーブルジャンプ命令が実行されて、分岐先がアドレスBと決定された状態12に遷移したものとする。このとき、分岐先の予測が失敗となるので(図13のS41:Yes)、Nextポインタは「0」のままになり(S42)、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAが出力される(S47)。
 次に、分岐先がアドレスAと決定された状態13では、分岐先の予測に成功する(図13のS41:No)。このとき、Nextポインタは「1」に増加され(S43)、予測分岐先アドレスとして、1番目のエントリに登録されたアドレスBが出力される(S47)。次に、分岐先がアドレスBと決定された状態14でも、分岐先の予測に成功するので(図13のS41:No)、Nextポインタは「2」に増加され(S43)、予測分岐先アドレスとして、2番目のエントリに登録されたアドレスAが出力される(S47)。
 次に、図15に示すように、分岐先がアドレスCと決定された状態15では、分岐先の予測が失敗となる(図13のS41:Yes)。このとき、Nextポインタは「0」に戻され(S42)、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAが出力される(S47)。次に、分岐先がアドレスCと決定された状態16でも、分岐先の予測が失敗となり(図13のS41:Yes)、Nextポインタは「0」のままとなり(S42)、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAが出力される(S47)。
 ここで、状態16において予測分岐先アドレスが出力された状態では、分岐先アドレス記憶部142には、分岐先アドレスの出現パターンが1パターン分蓄積された状態になる。なおかつ、Nextポインタが「0」に戻り、予測分岐先アドレスが先頭エントリから出力されるようになる。このため、この後に分岐先アドレスがアドレスA(状態17)、アドレスB(状態18)、アドレスA(状態19)、アドレスB(状態20)、アドレスC(状態21)、アドレスC(状態22)と出現する間、分岐先の予測は成功し続ける。すなわち、図13の処理によれば、アドレスA,B,A,B,C,Cという、第2の実施の形態で予測可能なパターンより複雑な命令アドレスの出現パターンに対し、分岐先を予測することが可能になる。
 なお、図16の状態22の後、分岐先がアドレスBとなる状態24(図示せず)において、予測は成功するものの、Nextポインタに「1」を加算した値に対応するエントリが有効でなくなり(S44:No)、Nextポインタが「0」に戻る。この後、分岐先がそれぞれアドレスA,Bとなる状態25,26(図示せず)では予測に成功するものの、分岐先がアドレスCとなる状態27(図示せず)において予測に失敗し、Nextポインタが「0」に戻る。次に、分岐先がアドレスCとなる状態28(図示せず)でも予測に失敗し、Nextポインタは「0」に保持されるが、次に、分岐先がアドレスAとなる状態29(図示せず)を先頭として、連続8回分だけ予測に成功する。
 すなわち、図13の処理によれば、分岐先アドレス記憶部142のエントリ数以内の数の命令アドレスからなるパターンが出現した場合には、50%以上の確率で分岐先を予測することが可能になる。
 以上説明した第3の実施の形態では、テーブルジャンプ命令の分岐先を予測できるという効果を奏し、かつ、製造/開発コストや回路面積が増大することを抑制できるという第2の実施の形態と同様の効果を得ることができる。また、第3の実施の形態によれば、第2の実施の形態と比較して、より複雑な命令アドレスの出現パターンについても分岐先を予測できるようになる。
 〔第4の実施の形態〕
 図17は、第4の実施の形態に係る演算処理装置の要部構成例を示す図である。なお、この図17では、図11に対応する構成要素については同じ符号を付して示す。
 第4の実施の形態に係る演算処理装置は、第3の実施の形態に係る演算処理装置と比較して、分岐先アドレステーブルの構成が異なるとともに、分岐先アドレステーブルを用いたテーブル管理部による分岐先予測処理の手順も異なる。すなわち、第4の実施の形態に係る演算処理装置は、図11に示した分岐先アドレステーブル140aおよびテーブル管理部152aの代わりに、図17に示す分岐先アドレステーブル140bおよびテーブル管理部152bを備える。なお、第3の実施の形態と同様に、分岐先アドレステーブル140bは複数設けられる。
 各分岐先アドレステーブル140bは、図11に示した分岐先アドレステーブル140aと同様に、分岐先アドレス記憶部142およびエントリ選択部143aを備える。また、各分岐先アドレステーブル140bはさらに、インデックス部141bおよび上限レジスタ144を備える。
 インデックス部141bには、図11に示したインデックス部141aに含まれるテーブルバリッド、インデックスおよびNextポインタに加えて、Createフラグが保持される。Createフラグは、テーブル管理部152bによって設定され、現在、分岐先アドレス記憶部142のエントリ登録期間であるか否かを示す。エントリ登録期間とは、分岐先アドレスを予測するための十分な情報が保持されていない期間を示す。あるいは、エントリ登録期間とは、分岐先アドレス記憶部142において、予測分岐先の候補となる分岐先アドレスの登録が完了していない期間と言うこともできる。本実施の形態では、分岐先アドレス記憶部142のエントリ登録期間においては、Createフラグが「1」とされ、エントリ登録期間が終了すると、Createフラグが「0」に更新されるものとする。
 上限レジスタ144は、分岐先アドレス記憶部142における有効なエントリ(すなわち、バリッドフラグが「1」であるエントリ)の数をカウントする機能を有する。ただし、上限レジスタ144の最小値は「0」とされ、有効なエントリ数が1個の場合は「0」、有効なエントリ数が2個の場合は「1」、・・・のようにカウントが行われる。上限レジスタ144は、Createフラグが「1」に変化したとき、分岐先アドレス記憶部142における有効なエントリ数をカウントして、そのカウント値を保持し、テーブル管理部152bによる参照を可能とする。
 テーブル管理部152bは、実行が完了した分岐命令のアドレスに対応する分岐先アドレステーブル140bを選択し、選択した分岐先アドレステーブル140b内の情報と、分岐命令実行制御部119からの分岐命令実行結果に含まれる成否情報とに基づいて、予測分岐先アドレスを決定する。また、テーブル管理部152bは、分岐先アドレス記憶部142のエントリ登録期間が終了する(すなわち、Createフラグが「0」になる)と、上限レジスタ144に保持された値を上限としてNextポインタのカウント動作を行うようになる。
 図18は、第4の実施の形態におけるテーブルジャンプ命令の分岐先予測処理手順を示すフローチャートである。
 図18に示す処理のうち、ステップS11の処理は、図8および図12に示したステップS11の処理と同じである。また、ステップS12~S15,S17の処理は、テーブル管理部152aの代わりにテーブル管理部152bが処理を実行すること、および、処理対象が分岐先アドレステーブル140aの代わりに分岐先アドレステーブル140bになること以外は、図12に示したステップS12~S15,S17の処理と同じである。これら以外に図12の処理と異なる点は、ステップS31の代わりにステップS32が実行される点と、ステップS16aの代わりにステップS16bが実行される点である。
 図18において、テーブル管理部152bは、ステップS12の検索により、分岐命令実行結果に含まれる分岐命令アドレスが登録された分岐先アドレステーブル140bが存在しない場合(S13:No)には、テーブル管理部152bは、インデックス部141aのテーブルバリッドが無効を示す「0」である分岐先アドレステーブル140bを、以後の処理対象として新規に選択する。このとき、テーブル管理部152bは、選択した分岐先アドレステーブル140bにおけるテーブルバリッドを「1」に更新する(ステップS14)。次に、テーブル管理部152bは、ステップS14で選択した分岐先アドレステーブル140bに対して、分岐命令実行制御部119からの分岐命令実行結果に含まれる分岐命令アドレスをインデックスとして登録する(ステップS15)。
 次に、テーブル管理部152bは、ステップS14で選択した分岐先アドレステーブル140bにおいて、インデックス部141bのNextポインタを「0」とし、Createフラグを「1」とする(ステップS32)。すなわち、新規に有効化された分岐先アドレステーブル140bにおいては、インデックス部141bにおけるNextポインタが、初期値である「0」に設定されるとともに、Createフラグが「1」に設定される。なお、ステップS15,S32の処理順は逆であってもよい。あるいは、ステップS15,S32の各処理は同時に実行されてもよい。
 ステップS12の検索により、分岐命令実行結果に含まれる分岐命令アドレスが登録された分岐先アドレステーブル140bが存在した場合(S13:Yes)、または、ステップS12の検索により、分岐命令実行結果に含まれる分岐命令アドレスが登録された分岐先アドレステーブル140bが存在せず(S13:No)、ステップS14,S15,S32の各処理が実行された場合には、テーブル管理部152bは、処理対象として選択した分岐先アドレステーブル140bにおける登録情報と、分岐命令実行制御部119からの分岐命令実行結果に含まれる成否情報とに基づいて、予測分岐先アドレスを決定する(ステップS16b)。この後、ステップS17の処理が実行される。
 図19は、第4の実施の形態における予測分岐先アドレスの決定処理の手順を示すフローチャートである。この図19の処理は、図18のステップS16bに対応するものである。
 [ステップS61]テーブル管理部152bは、分岐命令実行制御部119からの分岐命令実行結果に含まれる成否情報に基づき、分岐先の予測に失敗したか否かを判定する。テーブル管理部152bは、分岐先の予測に失敗したと判定した場合(S61:Yes)には、ステップS62を実行し、分岐先の予測に成功したと判定した場合(S61:No)には、ステップS66の処理を実行する。
 [ステップS62]テーブル管理部152bは、処理対象として選択した分岐先アドレステーブル140bにおける分岐先アドレス記憶部142に、バリッドフラグが「0」である空きエントリがあるかを判定する。テーブル管理部152bは、空きエントリが存在する場合(S62:Yes)には、ステップS63の処理を実行し、空きエントリが存在しない場合(S62:No)には、ステップS65の処理を実行する。
 [ステップS63]テーブル管理部152bは、インデックス部141bのCreateフラグを参照する。テーブル管理部152bは、Createフラグが「1」である場合(S63:Yes)には、ステップS64の処理を実行し、Createフラグが「0」である場合(S63:No)には、ステップS65の処理を実行する。
 [ステップS64]テーブル管理部152bは、分岐先アドレス記憶部142の空きエントリのうち、最も番号が小さいエントリにおいて、バリッドフラグを「1」に更新するとともに、分岐命令実行結果に含まれる分岐先アドレスを登録する。この後、ステップS65の処理が実行される。
 [ステップS65]テーブル管理部152bは、インデックス部141bのNextポインタを「0」にする。この後、ステップS71の処理が実行される。
 [ステップS66]テーブル管理部152bは、処理対象として選択した分岐先アドレステーブル140bにおいて、インデックス部141bのCreateフラグが「1」であるかを判定する。テーブル管理部152bは、Createフラグが「1」である場合(S66:Yes)には、ステップS67の処理を実行し、Createフラグが「0」である場合(S66:No)には、ステップS69の処理を実行する。
 [ステップS67]テーブル管理部152bは、Createフラグを「0」に更新する。
 [ステップS68]Createフラグが「0」に変化したことを検知した上限レジスタ144は、分岐先アドレス記憶部142における有効なエントリ数をカウントし、そのカウント値を保持する。この後、ステップS69の処理が実行される。
 [ステップS69]テーブル管理部152bは、インデックス部141bのNextポインタに「1」を加算する。
 [ステップS70]テーブル管理部152bは、分岐先アドレス記憶部142のエントリのうち、Nextポインタが指し示すエントリが有効であり、かつ、Nextポインタの値が上限レジスタ144に保持された値以下であるかを判定する。テーブル管理部152bは、これらの条件を満たす場合(S70:Yes)には、ステップS71の処理を実行し、これらの条件を満たさない場合(S70:No)には、ステップS65の処理を実行する。
 [ステップS71]テーブル管理部152bは、エントリ選択部143aに対して選択要求信号を出力する。選択要求信号を受信したエントリ選択部143aは、分岐先アドレス記憶部142のエントリのうち、Nextポインタが指し示すエントリを選択し、選択したエントリに登録された分岐先アドレスを、予測分岐先アドレスとしてテーブル選択部153に出力する。
 以上の図19の処理では、テーブル管理部152bは、初期状態では、分岐先アドレス記憶部142に対して、テーブルジャンプ命令の実行が完了するたびに、分岐先アドレス記憶部142における先頭エントリから順に分岐先アドレスを登録していく。これとともに、テーブル管理部152bは、分岐先の予測に最初に成功するまでの間(すなわち、Createフラグが「1」である間)、分岐先アドレス記憶部142の先頭エントリに登録された分岐先アドレスを、予測分岐先アドレスとして出力させる。
 テーブル管理部152bは、分岐先の予測に最初に成功したとき、分岐先アドレス記憶部142へのアドレス登録を終了する。これにより、分岐先アドレス記憶部142には、テーブルジャンプ命令の実行の結果、同じ分岐先アドレスが出現する直前までの分岐先アドレスの履歴が登録される。
 また、テーブル管理部152bは、分岐先の予測に最初に成功したとき、その時点でのNextポインタの値をNextポインタの上限として上限レジスタ144に設定し、それ以後、Nextポインタが指し示すエントリに登録された分岐先アドレスを、予測分岐先アドレスとして出力させる。テーブル管理部152bは、分岐先の予測に成功するごとにNextポインタをカウントアップし、分岐先の予測に失敗するか、あるいは、カウントアップ後のNextポインタの値が上限値を超えた場合に、Nextポインタを「0」に戻す。
 ここで、図5に示すようなプログラムが実行された場合を想定して、分岐先アドレステーブル140bに登録された分岐先アドレスに基づく分岐先予測処理の具体例について説明する。図20,図21は、分岐先予測処理の具体例を示す図である。
 これらの図20,図21では、例として、テーブルジャンプ命令の実行により、分岐先の命令アドレスがアドレスA,B,Bというパターンで繰り返し出現する場合を想定する。
 まず、図20において、分岐先アドレス記憶部142に分岐先アドレスが未登録の状態から、テーブルジャンプ命令が実行されて、分岐先がアドレスAと決定された状態31に遷移したものとする。このとき、分岐先の予測が失敗となり(図19のS61:Yes)、Createフラグは「1」である(S63:Yes)ので、分岐先であるアドレスAは分岐先アドレス記憶部142における先頭の空きエントリである0番目のエントリに登録される(S64)。また、Nextポインタは「0」のままになり(S65)、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAが出力される(S71)。
 次に、同じアドレスのテーブルジャンプ命令が実行されて、分岐先がアドレスBと決定された状態32に遷移したものとする。このとき、分岐先の予測が失敗となり(S61:Yes)、Createフラグは「1」である(S63:Yes)ので、分岐先であるアドレスBは分岐先アドレス記憶部142における1番目のエントリに登録される(S64)。また、Nextポインタは「0」のままになり(S65)、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAが出力される(S71)。
 同様に、分岐先がアドレスBと決定された状態33では、分岐先の予測が失敗となり(S61:Yes)、Createフラグは「1」である(S63:Yes)ので、分岐先であるアドレスBは分岐先アドレス記憶部142における2番目のエントリに登録される(S64)。また、Nextポインタは「0」のままになり(S65)、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAが出力される(S71)。
 次に、分岐先がアドレスAと決定された状態34では、分岐先の予測に成功し(S61:No)、Createフラグは「0」に更新される(S67)。このとき、上限レジスタ144には、分岐先アドレス記憶部142における有効なエントリ数である「2」が設定され(S68)、Nextポインタが「1」にカウントアップされる(S69)。分岐先アドレス記憶部142における1番目のエントリは有効であり、Nextポインタの値は上限レジスタ144の値以下である(S70:Yes)ことから、分岐先アドレス記憶部142における1番目のエントリに登録された分岐先アドレスが、予測分岐アドレスとして出力される(S71)。なお、状態34においてCreateフラグが「0」となることから、これ以後、分岐先アドレス記憶部142への分岐先アドレスの登録は行われなくなる。
 この後、図21に示すように、分岐先アドレスがアドレスBと決定された状態35でも、分岐先の予測は成功し、Nextポインタは「2」にカウントアップされる。さらに、分岐先アドレスがアドレスBと決定された状態36でも、分岐先の予測は成功する。このとき、Nextポインタに「1」を加算(S69)した値が上限レジスタ144の値を超える(S70:No)ことから、Nextポインタは「0」に戻される(S65)。従って、分岐先アドレス記憶部142における0番目のエントリに登録された分岐先アドレスが、予測分岐先アドレスとして出力される。
 以後、分岐先アドレスがアドレスA,B,Bというパターンで繰り返し出現する間、分岐先の予測は成功し続ける。すなわち、図19の処理によれば、アドレスA,B,Bという、第2の実施の形態で予測可能なパターンより命令アドレスの組合せの自由度が高い出現パターンに対し、分岐先を予測することが可能になる。
 以上説明した第4の実施の形態では、テーブルジャンプ命令の分岐先を予測できるという効果を奏し、かつ、製造/開発コストや回路面積が増大することを抑制できるという第2,第3の実施の形態と同様の効果を得ることができる。また、第4の実施の形態によれば、第2の実施の形態と比較して、命令アドレスの組合せの自由度が高い出現パターンについても分岐先を予測できるようになり、予測精度が向上する。
 〔第5の実施の形態〕
 図22は、第5の実施の形態に係る演算処理装置の要部構成例を示す図である。なお、この図22では、図17に対応する構成要素については同じ符号を付して示す。
 第5の実施の形態に係る演算処理装置は、第4の実施の形態に係る演算処理装置と比較して、分岐先アドレステーブルの構成が異なるとともに、分岐先アドレステーブルを用いたテーブル管理部による分岐先予測処理の手順も異なる。すなわち、第5の実施の形態に係る演算処理装置は、図17に示した分岐先アドレステーブル140bおよびテーブル管理部152bの代わりに、図22に示す分岐先アドレステーブル140cおよびテーブル管理部152cを備える。なお、第4の実施の形態と同様に、分岐先アドレステーブル140cは複数設けられる。
 各分岐先アドレステーブル140cは、図17に示した分岐先アドレステーブル140bと同様に、分岐先アドレス記憶部142、インデックス部141bおよび上限レジスタ144を備える。ただし、インデックス部141bのNextポインタは、エントリ選択部143cだけでなく分岐先アドレス記憶部142にも出力され、分岐先アドレス記憶部142に対する分岐先アドレスの決定時にも使用される。
 また、各分岐先アドレステーブル140cは、エントリ選択部143cを備える。エントリ選択部143cは、図17に示したエントリ選択部143aと同様に、分岐先アドレス記憶部142のエントリの中から1つを選択して、選択したエントリに登録された分岐先アドレスをテーブル選択部153に出力させる。ただし、エントリ選択部143cは、テーブル管理部152cからの選択要求信号を受信したとき、Createフラグが「1」であれば、分岐先アドレス記憶部142における0番目のエントリ(先頭エントリ)を選択する。また、エントリ選択部143cは、テーブル管理部152cからの選択要求信号を受信したとき、Createフラグが「0」であれば、分岐先アドレス記憶部142のエントリのうちNextポインタが指し示すエントリを選択する。
 テーブル管理部152cは、実行が完了した分岐命令のアドレスに対応する分岐先アドレステーブル140cを選択し、選択した分岐先アドレステーブル140c内の情報と、分岐命令実行制御部119からの分岐命令実行結果に含まれる成否情報とに基づいて、予測分岐先アドレスを決定する。テーブル管理部152cの処理のうち、図17に示したテーブル管理部152bの処理との主な相違点は、分岐先アドレス記憶部142に分岐先アドレスを登録する際に分岐先アドレス記憶部142に対して登録要求信号のみを出力し、分岐先アドレスの登録先エントリの指定を行わない点である。ただし、分岐先アドレスの登録先エントリを、分岐先アドレス記憶部142に対してテーブル管理部152cが指定するようにしてもよい。
 以下、第5の実施の形態に係る演算処理装置の処理について説明する。本実施の形態におけるテーブルジャンプ命令の分岐先予測処理全体の手順は、基本的に図18に示した処理と同じであるので、ここでは図示を省略する。図18の処理と異なる点は、ステップS12~S15,S17の処理が、テーブル管理部152bの代わりにテーブル管理部152cによって実行される点、処理対象が分岐先アドレステーブル140bの代わりに分岐先アドレステーブル140cになる点、および、ステップS16bの処理が次の図23に示す手順で実行される点である。
 図23は、第5の実施の形態における予測分岐先アドレスの決定処理の手順を示すフローチャートである。この図23の処理は、図18のステップS16bに対応するものである。
 [ステップS81]テーブル管理部152cは、分岐命令実行制御部119からの分岐命令実行結果に含まれる成否情報に基づき、分岐先の予測に失敗したか否かを判定する。テーブル管理部152cは、分岐先の予測に失敗したと判定した場合(S81:Yes)には、ステップS82を実行し、分岐先の予測に成功したと判定した場合(S81:No)には、ステップS88の処理を実行する。
 [ステップS82]テーブル管理部152cは、処理対象として選択した分岐先アドレステーブル140cにおける分岐先アドレス記憶部142に、バリッドフラグが「0」である空きエントリがあるかを判定する。テーブル管理部152cは、空きエントリが存在する場合(S82:Yes)には、ステップS83の処理を実行し、空きエントリが存在しない場合(S82:No)には、ステップS87の処理を実行する。
 なお、分岐先アドレス記憶部142に空きエントリがあるか否かの判定は、Nextポインタの値を基に行うこともできる。この場合、テーブル管理部152cは、Nextポインタの値が、分岐先アドレス記憶部142における最大エントリ数以下である場合には、空きエントリがあると判定し、Nextポインタの値が最大エントリ数を超える場合には、空きエントリがないと判定する。
 [ステップS83]テーブル管理部152cは、インデックス部141bのCreateフラグを参照する。テーブル管理部152cは、Createフラグが「1」である場合(S83:Yes)には、ステップS84の処理を実行し、Createフラグが「0」である場合(S83:No)には、ステップS87の処理を実行する。
 [ステップS84]テーブル管理部152cは、分岐先アドレス記憶部142に対して登録要求信号を出力する。登録要求信号を受信した分岐先アドレス記憶部142は、自身のエントリのうち、Nextポインタが指し示すエントリに対して、分岐命令実行制御部119からの分岐命令実行結果に含まれる分岐先アドレスを登録する。
 [ステップS85]テーブル管理部152cは、インデックス部141bのNextポインタに「1」を加算する。
 [ステップS86]テーブル管理部152cは、エントリ選択部143cに対して選択要求信号を出力する。選択要求信号を受信したエントリ選択部143cは、Createフラグを参照する。このとき、Createフラグは「1」であることから、エントリ選択部143cは、分岐先アドレス記憶部142における先頭エントリ(0番目のエントリ)を選択し、選択したエントリに登録された分岐先アドレスを、予測分岐先アドレスとしてテーブル選択部153に出力する。
 [ステップS87]テーブル管理部152cは、Nextポインタを「0」に更新する。この後、ステップS93の処理が実行される。
 [ステップS88]分岐先の予測に成功した場合(S81:No)、テーブル管理部152cは、処理対象として選択した分岐先アドレステーブル140cにおいて、インデックス部141bのCreateフラグが「1」であるかを判定する。テーブル管理部152cは、Createフラグが「1」である場合(S88:Yes)には、ステップS89の処理を実行し、Createフラグが「0」である場合(S88:No)には、ステップS91の処理を実行する。
 [ステップS89]テーブル管理部152cは、Createフラグを「0」に更新する。
 [ステップS90]Createフラグが「0」に変化したことを検知した上限レジスタ144は、分岐先アドレス記憶部142における有効なエントリ数をカウントし、そのカウント値を保持する。この後、ステップS91の処理が実行される。
 [ステップS91]テーブル管理部152cは、インデックス部141bのNextポインタに「1」を加算する。
 [ステップS92]テーブル管理部152cは、分岐先アドレス記憶部142のエントリのうち、Nextポインタが指し示すエントリが有効であり、かつ、Nextポインタの値が上限レジスタ144に保持された値以下であるかを判定する。テーブル管理部152cは、これらの条件を満たす場合(S92:Yes)には、ステップS93の処理を実行し、これらの条件を満たさない場合(S92:No)には、ステップS87の処理を実行する。
 [ステップS93]テーブル管理部152cは、エントリ選択部143cに対して選択要求信号を出力する。選択要求信号を受信したエントリ選択部143cは、Createフラグを参照する。このとき、Createフラグは「0」であることから、エントリ選択部143cは、分岐先アドレス記憶部142のエントリのうち、Nextポインタが指し示すエントリを選択し、選択したエントリに登録された分岐先アドレスを、予測分岐先アドレスとしてテーブル選択部153に出力する。
 以上の図23の処理では、初期状態では、分岐先アドレス記憶部142に対して、テーブルジャンプ命令の実行が完了するたびに、分岐先アドレス記憶部142における先頭エントリから順に分岐先アドレスが登録されていく。これとともに、分岐先の予測に最初に成功するまでの間(すなわち、Createフラグが「1」である間)、分岐先アドレス記憶部142の先頭エントリに登録された分岐先アドレスが、予測分岐先アドレスとして出力される。そして、分岐先の予測に最初に成功したとき、分岐先アドレス記憶部142へのアドレス登録が終了する。これにより、分岐先アドレス記憶部142には、テーブルジャンプ命令の実行の結果、同じ分岐先アドレスが出現する直前までの分岐先アドレスの履歴が登録される。
 また、テーブル管理部152cは、分岐先の予測に最初に成功したとき、その時点でのNextポインタの値をNextポインタの上限として上限レジスタ144に設定するとともに、Createフラグを「0」に更新する。これにより、以後、Nextポインタが指し示すエントリに登録された分岐先アドレスが、予測分岐先アドレスとして出力されるようになる。テーブル管理部152cは、分岐先の予測に成功するごとにNextポインタをカウントアップし、分岐先の予測に失敗するか、あるいは、カウントアップ後のNextポインタの値が上限値を超えた場合に、Nextポインタを「0」に戻す。
 ここで、図5に示すようなプログラムが実行された場合を想定して、分岐先アドレステーブル140cに登録された分岐先アドレスに基づく分岐先予測処理の具体例について説明する。図24,図25は、分岐先予測処理の具体例を示す図である。
 これらの図24,図25では、例として、図20,図21と同様に、テーブルジャンプ命令の実行により、分岐先の命令アドレスがアドレスA,B,Bというパターンで繰り返し出現する場合を想定する。
 まず、図24において、分岐先アドレス記憶部142に分岐先アドレスが未登録の状態から、テーブルジャンプ命令が実行されて、分岐先がアドレスAと決定された状態41に遷移したものとする。このとき、分岐先の予測が失敗となり(図23のS81:Yes)、Createフラグは「1」である(S83:Yes)ので、分岐先であるアドレスAは、分岐先アドレス記憶部142のエントリのうち、Nextポインタが指し示す先頭エントリ(0番目のエントリ)に登録される(S84)。また、Nextポインタは「1」にカウントアップされ(S85)、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAが出力される(S86)。
 次に、同じアドレスのテーブルジャンプ命令が実行されて、分岐先がアドレスBと決定された状態42に遷移したものとする。このとき、分岐先の予測が失敗となり(S81:Yes)、Createフラグは「1」である(S83:Yes)ので、分岐先であるアドレスBはNextポインタが指し示す1番目のエントリに登録される(S84)。また、Nextポインタは「2」にカウントアップされ(S85)、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAが出力される(S86)。
 同様に、分岐先がアドレスBと決定された状態43では、分岐先の予測が失敗となり(S81:Yes)、Createフラグは「1」である(S83:Yes)ので、分岐先であるアドレスBはNextポインタが指し示す2番目のエントリに登録される(S84)。また、Nextポインタは「3」にカウントアップされ(S85)、予測分岐先アドレスとして、0番目のエントリに登録されたアドレスAが出力される(S86)。
 次に、分岐先がアドレスAと決定された状態44では、分岐先の予測に成功し(S81:No)、Createフラグは「0」に更新される(S89)。このとき、上限レジスタ144には、分岐先アドレス記憶部142における有効なエントリ数である「2」が設定され(S90)、Nextポインタが「4」にカウントアップされる(S91)。ところが、Nextポインタの値は上限レジスタ144に設定された上限値を超えている(S92:No)ので、Nextポインタは「0」に戻される(S87)。また、Createフラグは「0」であるので、Nextポインタが指し示す0番目のエントリに登録された分岐先アドレス(アドレスA)が、予測分岐先アドレスとして出力される(S93)。なお、状態44においてCreateフラグが「0」となることから、これ以後、分岐先アドレス記憶部142への分岐先アドレスの登録は行われなくなる。
 次に、分岐先がアドレスBと決定された状態45では、分岐先の予測が失敗となる(S81:Yes)。このとき、Createフラグは「0」である(S83:No)ので、Nextポインタは「0」のままになり(S87)、Nextポインタが指し示す0番目のエントリに登録された分岐先アドレス(アドレスA)が、予測分岐先アドレスとして出力される(S93)。また、図25に示すように、分岐先アドレスがアドレスBと決定された状態46でも、状態45の場合と同様の動作が行われる。
 次に、分岐先アドレスがアドレスAと決定された状態47では、分岐先の予測に成功する(S81:No)。このとき、Createフラグは「0」である(S88:No)ので、Nextポインタが「1」にカウントアップされ(S91)、Nextポインタが指し示す1番目のエントリに登録された分岐先アドレス(アドレスB)が、予測分岐先アドレスとして出力される(S93)。
 次に、分岐先アドレスがアドレスBと決定された状態48でも、分岐先の予測は成功し、Nextポインタは「2」にカウントアップされる。さらに、分岐先アドレスがアドレスBと決定された状態49でも、分岐先の予測は成功する。このとき、Nextポインタに「1」を加算(S91)した値が上限レジスタ144の値を超える(S92)ことから、Nextポインタは「0」に戻される(S87)。従って、分岐先アドレス記憶部142における0番目のエントリに登録された分岐先アドレスが、予測分岐先アドレスとして出力される。
 以後、分岐先アドレスがアドレスA,B,Bというパターンで繰り返し出現する間、分岐先の予測は成功し続ける。すなわち、図23の処理によれば、第4の実施の形態と同様に、アドレスA,B,Bという、第2の実施の形態で予測可能なパターンより命令アドレスの組合せの自由度が高い出現パターンに対し、分岐先を予測することが可能になる。
 また、第5の実施の形態では、第4の実施の形態と比較した場合、分岐先の予測に連続して成功するようになるまでの期間が長くなる。その反面、第5の実施の形態では、分岐先アドレス記憶部142に対する分岐先アドレスの登録処理や、予測分岐先アドレスの出力元のエントリを選択する処理におけるテーブル管理部152cの処理手順が簡略化される。
 以上説明した第5の実施の形態では、テーブルジャンプ命令の分岐先を予測できるという効果を奏し、かつ、製造/開発コストや回路面積が増大することを抑制できるという第2~第4の実施の形態と同様の効果を得ることができる。また、第5の実施の形態によれば、第2の実施の形態と比較して、命令アドレスの組合せの自由度が高い出現パターンについても分岐先を予測できるようになり、予測精度が向上する。
 なお、上記の第2~第5の実施の形態では、分岐予測テーブル131と、分岐命令アドレスごとの分岐先アドレステーブルとが分離して配置されていたが、例えば、分岐予測テーブル131と分岐先アドレステーブルとが一体に構成されていてもよい。例えば、複数の分岐先アドレステーブルと、各分岐先アドレステーブルに対応する、分岐予測テーブル131内のウェイとが、テーブル選択部153や分岐予測制御部134を介さずに直接的に接続されていてもよい。
 上記については単に本発明の原理を示すものである。さらに、多数の変形、変更が当業者にとって可能であり、本発明は上記に示し、説明した正確な構成および応用例に限定されるものではなく、対応するすべての変形例および均等物は、添付の請求項およびその均等物による本発明の範囲とみなされる。
 1 演算処理装置
 11 分岐先アドレステーブル
 12 分岐先予測部
 13 予測分岐先アドレス記憶部
 14 命令フェッチ制御部

Claims (15)

  1.  複数の分岐先をとり得る分岐命令ごとに設けられ、自身に対応する分岐命令による過去の複数回の分岐先アドレスを履歴としてそれぞれ記憶する複数の分岐先アドレステーブルと、
     分岐命令についての予測分岐先アドレスを、当該分岐命令に対応する分岐先アドレステーブルに記憶された分岐先アドレスの履歴に基づいて予測する分岐先予測部と、
     を有することを特徴とする演算処理装置。
  2.  分岐命令ごとに予測分岐先アドレスを記憶する予測分岐先アドレス記憶部と、
     前記分岐先予測部によって予測された予測分岐先アドレスを、前記予測された予測分岐先アドレスに対応する分岐命令のアドレスに対応付けて前記予測分岐先アドレス記憶部に登録するアドレス登録部と、
     をさらに有することを特徴とする請求の範囲第1項記載の演算処理装置。
  3.  分岐命令をメモリからフェッチする際に、フェッチする分岐命令に対応付けて記憶された予測分岐先アドレスを、次にフェッチする命令のアドレスとして前記予測分岐先アドレス記憶部から取得する命令フェッチ制御部をさらに有することを特徴とする請求の範囲第2項記載の演算処理装置。
  4.  分岐命令の実行が完了したとき、実行が完了した分岐命令についての予測分岐先アドレスが前記分岐先予測部によって予測され、前記予測された予測分岐先アドレスが前記予測分岐先アドレス記憶部に登録されることを特徴とする請求の範囲第2項または第3項記載の演算処理装置。
  5.  前記分岐先予測部は、分岐命令の実行が完了したとき、当該分岐命令による予測分岐先アドレスを予測することを特徴とする請求の範囲第1項~第3項のいずれか1項に記載の演算処理装置。
  6.  前記分岐先予測部は、前記各分岐先アドレステーブルに登録された分岐先アドレスを登録順に出力させることで、予測分岐先アドレスを出力することを特徴とする請求の範囲第1項~第5項のいずれか1項に記載の演算処理装置。
  7.  前記分岐先予測部は、分岐命令の実行が完了したとき、実行が完了した分岐命令に対応する分岐先アドレステーブルから、当該分岐命令による分岐先と同一のアドレスが記憶されたエントリを探索し、前記同一のアドレスが記憶されたエントリを探索できなかった場合には、前記実行が完了した分岐命令による分岐先アドレスを当該分岐命令に対応する分岐先アドレステーブルにおける空きエントリのうちの先頭のエントリに登録するとともに、当該分岐先アドレステーブルにおける先頭エントリに記憶された分岐先アドレスを予測分岐先アドレスとして出力し、前記同一のアドレスが記憶されたエントリを探索できた場合には、探索されたエントリの次のエントリに記憶された分岐先アドレスを予測分岐先アドレスとして出力することを特徴とする請求の範囲第1項~第3項いずれか1項に記載の演算処理装置。
  8.  前記分岐先予測部は、分岐命令の実行が完了したとき、実行が完了した分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に成功した場合には、当該分岐命令に対応する分岐先アドレステーブルから、前回の分岐命令の実行完了時に選択したエントリの次のエントリを選択して、選択したエントリに記憶された分岐先アドレスを予測分岐先アドレスとして出力し、前記実行が完了した分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に失敗した場合には、当該分岐命令に対応する分岐先アドレステーブルにおける先頭エントリに記憶された分岐先アドレスを予測分岐先アドレスとして出力することを特徴とする請求の範囲第1項~第3項のいずれか1項に記載の演算処理装置。
  9.  前記分岐先予測部は、
     実行が完了した分岐命令による分岐先アドレスを、当該分岐命令に対応する分岐先アドレステーブルに対して空きエントリがなくなるまで先頭エントリから順に登録し、かつ、
     分岐命令の実行が完了したとき、実行が完了した分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に失敗した場合には、当該分岐命令に対応する分岐先アドレステーブルにおける先頭エントリを選択して、選択したエントリに登録された分岐先アドレスを予測分岐先アドレスとして出力し、前記実行が完了した分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に成功した場合には、当該分岐命令に対応する分岐先アドレステーブルから前回選択したエントリの次のエントリを選択して、選択したエントリに登録された分岐先アドレスを予測分岐先アドレスとして出力する、
     ことを特徴とする請求の範囲第1項~第3項のいずれか1項に記載の演算処理装置。
  10.  前記分岐先予測部は、
     実行が完了した分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に初めて成功するより前の第1の期間では、当該分岐命令の実行が完了するごとに、当該分岐命令による分岐先アドレスを当該分岐命令に対応する分岐先アドレステーブルの先頭エントリから順に登録するとともに、当該分岐命令に対応する分岐先アドレステーブルにおける先頭エントリに登録された分岐先アドレスを予測分岐先アドレスとして出力し、
     実行が完了した分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に初めて成功した後の第2の期間では、当該分岐命令の実行が完了するごとに、当該分岐命令に対応する分岐先アドレステーブルにおけるエントリのうち分岐先アドレスが登録されたエントリを先頭から順に選択し、選択したエントリに登録された分岐先アドレスを予測分岐先アドレスとして出力する、
     ことを特徴とする請求の範囲第1項~第3項のいずれか1項に記載の演算処理装置。
  11.  前記分岐先予測部は、前記第2の期間において、当該分岐命令の実行が完了したとき、実行が完了した分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に失敗した場合には、当該分岐命令に対応する分岐先アドレステーブルにおける先頭エントリに登録された分岐先アドレスを予測分岐先アドレスとして出力することを特徴とする請求の範囲第10項記載の演算処理装置。
  12.  分岐命令ごとに設けられ、各分岐命令に対応する分岐先アドレステーブルのエントリをそれぞれ指し示す複数のポインタをさらに有し、
     前記分岐先予測部は、
     前記第1の期間では、分岐命令の実行が完了したとき、当該分岐命令に対応するポインタを当該分岐命令に対応する分岐先アドレステーブルの先頭エントリを指し示すように設定して、当該ポインタが指し示すエントリに登録された分岐先アドレスの予測分岐先アドレスとして出力させ、
     前記第2の期間では、分岐命令の実行が完了したとき、当該分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に成功した場合には、当該分岐命令に対応するポインタを当該分岐命令に対応する分岐先アドレステーブルにおける次のエントリを指し示すように設定して、当該ポインタが指し示すエントリに登録された分岐先アドレスを予測分岐先アドレスとして出力させ、当該分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に失敗した場合には、当該分岐命令に対応するポインタを当該分岐命令に対応する分岐先アドレステーブルの先頭エントリを指し示すように設定して、当該ポインタが指し示すエントリに登録された分岐先アドレスを予測分岐先アドレスとして出力させる、
     ことを特徴とする請求の範囲第10項記載の演算処理装置。
  13.  分岐命令ごとに設けられ、各分岐命令に対応する分岐先アドレステーブルのエントリをそれぞれ指し示す複数のポインタをさらに有し、
     前記分岐先予測部は、
     前記第1の期間では、分岐命令の実行が完了したとき、当該分岐命令に対応するポインタが指し示す分岐先アドレステーブルのエントリに対して分岐先アドレスを登録するとともに、当該分岐命令に対応するポインタを当該分岐命令に対応する分岐先アドレステーブルにおける次のエントリを指し示すように設定し、
     前記第2の期間では、分岐命令の実行が完了したとき、当該分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に成功した場合には、当該分岐命令に対応するポインタを当該分岐命令に対応する分岐先アドレステーブルにおける次のエントリを指し示すように設定して、当該ポインタが指し示すエントリに登録された分岐先アドレスを予測分岐先アドレスとして出力させ、当該分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に失敗した場合には、当該分岐命令に対応するポインタを当該分岐命令に対応する分岐先アドレステーブルの先頭エントリを指し示すように設定して、当該ポインタが指し示すエントリに登録された分岐先アドレスを予測分岐先アドレスとして出力させる、
     ことを特徴とする請求の範囲第10項記載の演算処理装置。
  14.  前記分岐先予測部は、前記第2の期間において、分岐命令の実行が完了し、当該分岐命令についての前記分岐先予測部からの予測分岐先アドレスに基づく分岐先の予測に成功したとき、当該分岐命令に対応するポインタを当該分岐命令に対応する分岐先アドレステーブルにおける次のエントリを指し示すように更新し、更新後のポインタが指し示すエントリに分岐先アドレスが登録されている場合には、当該ポインタが指し示すエントリに登録された分岐先アドレスを予測分岐先アドレスとして出力させ、前記更新後のポインタが指し示すエントリに分岐先のアドレスが登録されていない場合には、当該分岐命令に対応するポインタを当該分岐命令に対応する分岐先アドレステーブルの先頭エントリを指し示すように設定して、当該ポインタが指し示すエントリに登録された分岐先アドレスを予測分岐先アドレスとして出力させることを特徴とする請求の範囲第13項記載の演算処理装置。
  15.  演算処理装置が、複数の分岐先をとり得る分岐命令ごとに設けられ、自身に対応する分岐命令による過去の複数回の分岐先アドレスを履歴としてそれぞれ記憶する複数の分岐先アドレステーブルを参照し、分岐命令についての予測分岐先アドレスを、当該分岐命令に対応する分岐先アドレステーブルに記憶された分岐先アドレスの履歴に基づいて予測することを特徴とする分岐予測方法。
PCT/JP2011/050189 2011-01-07 2011-01-07 演算処理装置および分岐予測方法 WO2012093489A1 (ja)

Priority Applications (4)

Application Number Priority Date Filing Date Title
PCT/JP2011/050189 WO2012093489A1 (ja) 2011-01-07 2011-01-07 演算処理装置および分岐予測方法
JP2012551781A JP5494832B2 (ja) 2011-01-07 2011-01-07 演算処理装置および分岐予測方法
EP11855093.8A EP2662767A1 (en) 2011-01-07 2011-01-07 Computation processing device and branch prediction method
US13/914,002 US8751776B2 (en) 2011-01-07 2013-06-10 Method for predicting branch target address based on previous prediction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/JP2011/050189 WO2012093489A1 (ja) 2011-01-07 2011-01-07 演算処理装置および分岐予測方法

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US13/914,002 Continuation US8751776B2 (en) 2011-01-07 2013-06-10 Method for predicting branch target address based on previous prediction

Publications (1)

Publication Number Publication Date
WO2012093489A1 true WO2012093489A1 (ja) 2012-07-12

Family

ID=46457354

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/JP2011/050189 WO2012093489A1 (ja) 2011-01-07 2011-01-07 演算処理装置および分岐予測方法

Country Status (4)

Country Link
US (1) US8751776B2 (ja)
EP (1) EP2662767A1 (ja)
JP (1) JP5494832B2 (ja)
WO (1) WO2012093489A1 (ja)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015036888A (ja) * 2013-08-13 2015-02-23 富士通株式会社 演算処理装置及び演算処理装置の制御方法

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10185731B2 (en) 2016-03-31 2019-01-22 Arm Limited Indexing entries of a storage structure shared between multiple threads
US11126714B2 (en) * 2017-11-29 2021-09-21 Arm Limited Encoding of input to storage circuitry
US10819736B2 (en) * 2017-11-29 2020-10-27 Arm Limited Encoding of input to branch prediction circuitry
WO2020199058A1 (zh) * 2019-03-30 2020-10-08 华为技术有限公司 分支指令的处理方法、分支预测器及处理器
US11960893B2 (en) 2021-12-29 2024-04-16 International Business Machines Corporation Multi-table instruction prefetch unit for microprocessor

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63211462A (ja) * 1987-02-27 1988-09-02 Fujitsu Ltd 自動取引システム
JPH03127125A (ja) * 1989-10-13 1991-05-30 Hitachi Ltd 学習による多重分岐処理の自動変更方式
JPH04225429A (ja) 1990-12-26 1992-08-14 Nec Corp データ処理装置
JP2001184231A (ja) 1999-12-27 2001-07-06 Nec Ic Microcomput Syst Ltd プログラム開発支援装置とその制御方法
JP2006155374A (ja) 2004-11-30 2006-06-15 Fujitsu Ltd 分岐予測装置および分岐予測方法

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63191231A (ja) 1987-02-03 1988-08-08 Nec Corp 命令の先取りを行なう情報処理装置
AU6701794A (en) 1993-05-14 1994-12-12 Intel Corporation Speculative history mechanism in a branch target buffer
KR100310581B1 (ko) * 1993-05-14 2001-12-17 피터 엔. 데트킨 분기목표버퍼의추측기록메카니즘
US6895498B2 (en) * 2001-05-04 2005-05-17 Ip-First, Llc Apparatus and method for target address replacement in speculative branch target address cache
JP3804941B2 (ja) 2002-06-28 2006-08-02 富士通株式会社 命令フェッチ制御装置
JP3798998B2 (ja) 2002-06-28 2006-07-19 富士通株式会社 分岐予測装置および分岐予測方法
JP4009248B2 (ja) 2003-12-05 2007-11-14 富士通株式会社 分岐予測装置および分岐予測方法
US7409535B2 (en) * 2005-04-20 2008-08-05 International Business Machines Corporation Branch target prediction for multi-target branches by identifying a repeated pattern

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63211462A (ja) * 1987-02-27 1988-09-02 Fujitsu Ltd 自動取引システム
JPH03127125A (ja) * 1989-10-13 1991-05-30 Hitachi Ltd 学習による多重分岐処理の自動変更方式
JPH04225429A (ja) 1990-12-26 1992-08-14 Nec Corp データ処理装置
JP2001184231A (ja) 1999-12-27 2001-07-06 Nec Ic Microcomput Syst Ltd プログラム開発支援装置とその制御方法
JP2006155374A (ja) 2004-11-30 2006-06-15 Fujitsu Ltd 分岐予測装置および分岐予測方法

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
PO-YUNG CHANG ET AL.: "Target Prediction For Indirect Jumps", CONFERENCE PROCEEDINGS. THE 24TH ANNUAL INTERNATIONAL SYMPOSIUM ON COMPUTER ARCHITECTURE, 1997., vol. 25, no. 2, 4 June 1997 (1997-06-04), pages 274 - 283, XP000656585 *
RAVI NAIR: "Dynamic path-based branch correlation", PROCEEDINGS OF THE 28TH ANNUAL INTERNATIONAL SYMPOSIUM ON MICROARCHITECTURE, 1995., 1 December 1995 (1995-12-01), pages 15 - 23, XP000585343 *
TETSURO HIRASHIMA ET AL.: "Branch Target Predictor Utilizing Context Base Value Predictor", IPSJ SIG NOTES, 2008-ARC-178, vol. 2008, no. 39, 6 May 2008 (2008-05-06), pages 1 - 6, XP008171033 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2015036888A (ja) * 2013-08-13 2015-02-23 富士通株式会社 演算処理装置及び演算処理装置の制御方法

Also Published As

Publication number Publication date
EP2662767A1 (en) 2013-11-13
US20130275726A1 (en) 2013-10-17
JPWO2012093489A1 (ja) 2014-06-09
JP5494832B2 (ja) 2014-05-21
US8751776B2 (en) 2014-06-10

Similar Documents

Publication Publication Date Title
JP5917616B2 (ja) 事前通知技術を用いる、プログラムのシーケンシャルフローを変更するための方法および装置
JP5494832B2 (ja) 演算処理装置および分岐予測方法
US20140075156A1 (en) Fetch width predictor
KR20070118135A (ko) 인덱스당 2개 이상의 분기 타겟 어드레스를 저장하는 분기타겟 어드레스 캐시
JP2003005956A (ja) 分岐予測装置、プロセッサ、及び分岐予測方法
US10664280B2 (en) Fetch ahead branch target buffer
US10241810B2 (en) Instruction-optimizing processor with branch-count table in hardware
JP2009048633A (ja) 分岐先アドレス・キャッシュを備えたプロセッサおよびデータを処理する方法
JP2015036934A (ja) 演算処理装置及び演算処理装置の制御方法
US10048969B2 (en) Dynamic branch predictor indexing a plurality of weight tables by instruction address fetch history and making a prediction based on a product sum calculation of global history register values and outputted weight table value
JP2011530104A (ja) 分岐先バッファの割り当て
EP1974254B1 (en) Early conditional selection of an operand
EP2690549A1 (en) Arithmetic processing device, information processing device, and arithmetic processing method
JPH08320788A (ja) パイプライン方式プロセッサ
JP2009524167A5 (ja)
US7865705B2 (en) Branch target address cache including address type tag bit
JP2001060152A (ja) 分岐予測を抑止する情報処理装置および方法
JP2020077333A (ja) 演算処理装置および演算処理装置の制御方法
US20090070569A1 (en) Branch prediction device,branch prediction method, and microprocessor
GB2392266A (en) Using a flag in a branch target address cache to reduce latency when a branch occurs that references a call-return stack
JP2006053830A (ja) 分岐予測装置および分岐予測方法
CN111124494B (zh) 一种cpu中加速无条件跳转的方法及电路
JPWO2012132214A1 (ja) プロセッサ及びその命令処理方法
CN117130666A (zh) 配置方法、分支预测器、指令识别器和电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11855093

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2012551781

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 2011855093

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE