JPH04264923A - Information processor - Google Patents

Information processor

Info

Publication number
JPH04264923A
JPH04264923A JP2590791A JP2590791A JPH04264923A JP H04264923 A JPH04264923 A JP H04264923A JP 2590791 A JP2590791 A JP 2590791A JP 2590791 A JP2590791 A JP 2590791A JP H04264923 A JPH04264923 A JP H04264923A
Authority
JP
Japan
Prior art keywords
instruction
branch
loop
address
branching
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2590791A
Other languages
Japanese (ja)
Inventor
Mariko Sano
真理子 佐野
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
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 NEC Corp filed Critical NEC Corp
Priority to JP2590791A priority Critical patent/JPH04264923A/en
Publication of JPH04264923A publication Critical patent/JPH04264923A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To prevent prefetching failure by providing a loop counter circuit which counts the number of times of loop when the loop instruction of the number of times of loop preset in a branch predicting function as a branching instruction is generated. CONSTITUTION:In the case that the branching instruction prefetched first is executed by an instruction executing means 6, and branching is executed, a branch prediction circuit 7 is informed of branching condition affirmation BCA. At that time, if a number of times of loop setting instruction LCS is added previously, the loop counter circuit 101 of a loop count table 10 is informed of this. Next, the branch prediction circuit 7 executes the prefetching of the instruction succeeding the branching instruction prefetched first, and stores a branching destination address in a prefetch pointer 8. This stored branching destination address is prefetched by an instruction prefetching means 1 as a prefetching address PFA.

Description

【発明の詳細な説明】[Detailed description of the invention]

【0001】0001

【産業上の利用分野】本発明は情報処理装置に関し、特
に分岐予測機能を有する情報処理装置に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an information processing apparatus, and more particularly to an information processing apparatus having a branch prediction function.

【0002】0002

【従来の技術】情報処理装置の分岐予測機能は、分岐命
令が発生したとき分岐命令の次の実行命令である分岐先
命令を予測するものである。
2. Description of the Related Art A branch prediction function of an information processing device predicts a branch destination instruction, which is an instruction to be executed next to a branch instruction, when a branch instruction occurs.

【0003】従来のこの種の情報処理装置の一例を示す
フローチャートを図2に示す。
FIG. 2 is a flowchart showing an example of a conventional information processing apparatus of this type.

【0004】図2に示すように、従来のこの種の情報処
理装置の分岐予測機能は、分岐予測テーブル20として
キャッシュメモリを用いていた。
As shown in FIG. 2, the conventional branch prediction function of this type of information processing apparatus uses a cache memory as a branch prediction table 20.

【0005】分岐が発生した場合、分岐が起った命令で
ある分岐命令S4の分岐アドレス22と、その分岐先の
命令である分岐先命令S2の分岐先アドレス21とをそ
のキャッシュメモリに記憶する。さらに、バリッドビッ
ト23を設定する。次に、分岐命令をフエッチしたとき
に、その分岐命令S4を分岐アドレス22が分岐予測テ
ーブル20に記憶されているかどうかを検索する。その
とき、分岐予測テーブル20内で、バリッドビットが設
定されている分岐先アドレス21についてのみ検索対象
とする。
When a branch occurs, the branch address 22 of the branch instruction S4, which is the instruction where the branch occurred, and the branch destination address 21 of the branch destination instruction S2, which is the instruction to which the branch occurs, are stored in the cache memory. . Furthermore, a valid bit 23 is set. Next, when a branch instruction is fetched, a search is made to see if the branch address 22 of the branch instruction S4 is stored in the branch prediction table 20. At this time, only branch destination addresses 21 for which valid bits are set in the branch prediction table 20 are searched.

【0006】分岐命令アドレス22が記憶されていれば
、その分岐命令S4の分岐先として記憶されている分岐
先アドレス21の命令S2をフエッチする。分岐命令ア
ドレス22が記憶されていなければ、その分岐命令S4
のの分岐アドレス22とその分岐先S2の分岐先アドレ
ス21を分岐予測テーブル20に記憶し、バリッドビッ
ト23を設定するというものであった。
If the branch instruction address 22 is stored, the instruction S2 at the branch destination address 21 stored as the branch destination of the branch instruction S4 is fetched. If the branch instruction address 22 is not stored, the branch instruction S4
The branch address 22 and the branch destination address 21 of the branch destination S2 are stored in the branch prediction table 20, and a valid bit 23 is set.

【0007】[0007]

【発明が解決しようとする課題】上述した従来の情報処
理装置は、分岐予測機能において、分岐が発生した場合
の分岐命令の分岐アドレスとその分岐先のアドレスとを
記憶しておき、この分岐命令をプリフエッチしたときに
引続く命令でなく予測した分岐先の命令をプリフエッチ
するため、ループ命令の実行中においてもループ命令か
ら抜けるときの最後の分岐命令をプリフエッチしたとき
にも引続く命令のプリフエッチが行なわれず失敗すると
いう欠点があった。その結果、パイプライン処理等にお
けるタイムロスを発生し、処理装置の性能を低下させる
という欠点があった。
[Problems to be Solved by the Invention] In the above-mentioned conventional information processing device, the branch prediction function stores the branch address of a branch instruction and the address of the branch destination when a branch occurs, and When prefetching, the instruction at the predicted branch destination is prefetched, not the instruction that follows, so even if the last branch instruction when exiting from the loop instruction is prefetched, the subsequent instruction will not be prefetched. The disadvantage was that it was not carried out and failed. As a result, there is a drawback that time loss occurs in pipeline processing, etc., and the performance of the processing device is degraded.

【0008】[0008]

【課題を解決するための手段】本発明の情報処理装置は
、分岐命令が発生したとき前記分岐命令の次の実行命令
である分岐先命令を予測する分岐予測機能を有する情報
処理装置において、前記分岐予測機能は前記分岐命令と
して予め定められたループ回数のループ命令が発生する
とき前記ループ回数を計数するループカウンタ回路を備
えて構成されている。
Means for Solving the Problems The information processing apparatus of the present invention has a branch prediction function that predicts a branch destination instruction that is the next execution instruction of the branch instruction when a branch instruction occurs. The branch prediction function includes a loop counter circuit that counts the number of loops when a loop instruction of a predetermined number of loops is generated as the branch instruction.

【0009】[0009]

【実施例】次に、本発明の実施例について図面を参照し
て説明する。
Embodiments Next, embodiments of the present invention will be described with reference to the drawings.

【0010】図1は本発明の情報処理装置の一実施例を
示すブロック図である。
FIG. 1 is a block diagram showing an embodiment of an information processing apparatus according to the present invention.

【0011】本実施例の情報処理装置は、図1に示すよ
うに、命令プリフエッチ手段1と、命令プリデコード手
段2と、命令デコード実効アドレス生成手段3と、アド
レス変換手段4と、オペランドアクセス手段5と、命令
実行手段6と、分岐予測回路7と、プリフエッチポイン
タ8と、分岐予測テーブル9と、ループカウントテーブ
ル10とを備えて構成される。
As shown in FIG. 1, the information processing apparatus of this embodiment includes an instruction prefetch means 1, an instruction predecode means 2, an instruction decode effective address generation means 3, an address conversion means 4, and an operand access means. 5, an instruction execution means 6, a branch prediction circuit 7, a prefetch pointer 8, a branch prediction table 9, and a loop count table 10.

【0012】ここで構成要素の1〜6は、ソフトウェア
によるものを含む。
[0012] Here, the components 1 to 6 include those based on software.

【0013】分岐予測テーブル9は、分岐先アドレス9
1と、分岐アドレス92と、コンパレータ93とを有し
ている。
[0013] The branch prediction table 9 contains the branch destination address 9
1, a branch address 92, and a comparator 93.

【0014】ループカウントテーブル10は、ループカ
ウンタ回路101と、ループカウンタ102と、バリッ
ドビット103とを有している。
The loop count table 10 has a loop counter circuit 101, a loop counter 102, and a valid bit 103.

【0015】次に、本実施例の動作について説明する。Next, the operation of this embodiment will be explained.

【0016】まず、プログラム実行中に分岐命令をフエ
ッチすると、アドレス変換手段4によりこの分岐命令が
検出され、分岐命令検出IBDとして分岐予測回路7に
知らされる。
First, when a branch instruction is fetched during program execution, this branch instruction is detected by the address conversion means 4 and is notified to the branch prediction circuit 7 as a branch instruction detection IBD.

【0017】次に、分岐予測回路7は、プリフエッチポ
インタ8にアドレス変換手段4からのアドレスを分岐予
測アドレスBPAとして格納する。
Next, the branch prediction circuit 7 stores the address from the address conversion means 4 in the prefetch pointer 8 as a predicted branch address BPA.

【0018】次に、分岐予測テーブル9のコンパレータ
93により、格納された分岐予測アドレスBPAと分岐
予測テーブル9の分岐アドレス92とを比較し、一致す
るものを検索する。このとき、ループカウントテーブル
10のバリッドビット103が予め設定されているもの
についてのみ検索を行なう。検索結果、一致するアドレ
スがない場合には、プリフエッチポインタ8に格納され
ている分岐予測アドレスBPAを、そのまま、プリフエ
ッチアドレスPFAとして命令プリフエッチ手段1によ
りプリフエッチする。さらに、この分岐命令に引続く命
令をプリフエッチする。
Next, the comparator 93 of the branch prediction table 9 compares the stored branch prediction address BPA with the branch address 92 of the branch prediction table 9 to search for a match. At this time, only the loop count table 10 whose valid bit 103 is set in advance is searched. As a result of the search, if there is no matching address, the branch predicted address BPA stored in the prefetch pointer 8 is prefetched as is by the instruction prefetch means 1 as the prefetch address PFA. Furthermore, the instruction following this branch instruction is prefetched.

【0019】先にプリフエッチされた分岐命令が命令実
行手段6により実行され分岐した場合は、分岐条件確定
BCAを分岐予測回路7に知らせる。そのとき、ループ
回数設定命令LCSが追加されていれば、ループカウン
トテーブル10のループカウンタ回路101にこれを知
らせる。
When the previously prefetched branch instruction is executed by the instruction execution means 6 and a branch is taken, the branch prediction circuit 7 is notified of the branch condition determination BCA. At that time, if the loop count setting command LCS is added, this is notified to the loop counter circuit 101 of the loop count table 10.

【0020】次に、分岐条件確定BCAを知らされた分
岐予測回路7は、先にプリフエッチした分岐命令に引続
く命令のプリフエッチを行ない、分岐先アドレスをプリ
フエッチポインタ8に格納する。この格納された分岐先
アドレスをプリフエッチアドレスPFAとして命令プリ
フエッチ手段1によりプリフエッチする。同時に、分岐
予測テーブル9に分岐先アドレス91と分岐アドレス9
2を登録する。そのとき、ループ回数設定命令LCSが
追加されていれば、ループ回数をループカウントテーブ
ル10のループカウンタ102に設定し、バリッドビッ
ト103を設定する。
Next, the branch prediction circuit 7, which has been informed of the branch condition determination BCA, prefetches the instruction following the previously prefetched branch instruction, and stores the branch destination address in the prefetch pointer 8. This stored branch destination address is prefetched by the instruction prefetch means 1 using it as a prefetch address PFA. At the same time, branch destination address 91 and branch address 9 are added to branch prediction table 9.
Register 2. At that time, if the loop count setting command LCS has been added, the loop count is set in the loop counter 102 of the loop count table 10, and the valid bit 103 is set.

【0021】次に、分岐予測テーブル9のコンパレータ
93により、格納された分岐予測アドレスBPAと分岐
予測テーブル9の分岐アドレス92とを比較し、一致す
るものを検索する。検索結果、一致するアドレスが検索
された場合は、ヒット検出信号HDを出力し、分岐予測
テーブル9に登録されている分岐先アドレス91を分岐
予測回路7に知らせる。分岐予測回路7は、この分岐先
アドレス91をプリフエッチポインタ8に格納し、この
アドレス91をプリフエッチアドレスPFAとして命令
プリフエッチ手段1によりプリフエッチする。
Next, the comparator 93 of the branch prediction table 9 compares the stored branch prediction address BPA with the branch address 92 of the branch prediction table 9 to search for a match. If a matching address is found as a result of the search, a hit detection signal HD is output to inform the branch prediction circuit 7 of the branch destination address 91 registered in the branch prediction table 9. The branch prediction circuit 7 stores this branch destination address 91 in the prefetch pointer 8, and prefetches this address 91 using the instruction prefetch means 1 as the prefetch address PFA.

【0022】また、ヒット検出信号HDはループカウン
トテーブル10のループカウンタ回路101にも出力さ
れる。ループカウンタ回路101は、その分岐アドレス
92に対応したループカウンタ102を1デクリメント
する。もし、ループカウンタ102が0であれば、その
まま、何の設定も行なわれない。また、デクリメントの
結果、ループカウンタ102が0になった場合は、バリ
ッドビット103の設定を解除し、分岐予測テーブル9
に登録されていない状態にしておき、次の分岐命令にお
いては、引続く命令をプリフエッチするようにする。
The hit detection signal HD is also output to the loop counter circuit 101 of the loop count table 10. The loop counter circuit 101 decrements the loop counter 102 corresponding to the branch address 92 by one. If the loop counter 102 is 0, no settings are made. Furthermore, if the loop counter 102 becomes 0 as a result of decrementing, the setting of the valid bit 103 is canceled and the branch prediction table 9
, and in the next branch instruction, the subsequent instruction is prefetched.

【0023】[0023]

【発明の効果】以上説明したように、本発明の情報処理
装置は、分岐予測機能に分岐命令として予め設定された
ループ回数のループ命令が発生するとき、このループ回
数を計数するループカウンタ回路を備えることにより、
ループ命令の実行中におけるループ命令から抜けるとき
の最後の分岐命令をプリフエッチするときには予測した
分岐先の命令ではなく引続く命令のプリフエッチが行な
われ、したがって、プリフエッチの失敗が防止できると
いう効果がある。その結果、パイプライン処理等におけ
るタイムロスは発生せず、処理装置の性能を向上できる
という効果がある。
As described above, the information processing device of the present invention includes a loop counter circuit that counts the number of loops when a loop instruction with a preset number of loops is generated as a branch instruction in the branch prediction function. By preparing,
When prefetching the last branch instruction when exiting from a loop instruction during the execution of a loop instruction, prefetching is performed not for the instruction at the predicted branch destination but for the subsequent instruction, which has the effect of preventing prefetch failures. As a result, no time loss occurs in pipeline processing, etc., and the performance of the processing device can be improved.

【図面の簡単な説明】[Brief explanation of the drawing]

【図1】本発明の情報処理装置の一実施例を示すブロッ
ク図である。
FIG. 1 is a block diagram showing an embodiment of an information processing device of the present invention.

【図2】従来の情報処理装置の一例を示すフローチャー
トである。
FIG. 2 is a flowchart showing an example of a conventional information processing device.

【符号の説明】[Explanation of symbols]

1    命令プリフエッチ手段 2    命令プリデコード手段 3    命令デコード実効アドレス生成手段4   
 アドレス変換手段 5    オペランドアクセス手段 6    命令実行手段 7    分岐予測回路 8    プリフエッチポインタ 9,20    分岐予測テーブル 10    ループカウントテーブル 21,91    分岐先アドレス 22,92    分岐アドレス 23,103    バリッドビット 93    コンパレータ 101    ループカウンタ回路 102    ループカウンタ
1 Instruction prefetch means 2 Instruction predecode means 3 Instruction decode effective address generation means 4
Address conversion means 5 Operand access means 6 Instruction execution means 7 Branch prediction circuit 8 Prefetch pointers 9, 20 Branch prediction table 10 Loop count table 21, 91 Branch destination address 22, 92 Branch address 23, 103 Valid bit 93 Comparator 101 Loop Counter circuit 102 loop counter

Claims (2)

【特許請求の範囲】[Claims] 【請求項1】  分岐命令が発生したとき前記分岐命令
の次の実行命令である分岐先命令を予測する分岐予測機
能を有する情報処理装置において、前記分岐予測機能は
前記分岐命令として予め定められたループ回数のループ
命令が発生するとき前記ループ回数を計数するループカ
ウンタ回路を備えることを特徴とする情報処理装置。
1. An information processing device having a branch prediction function that predicts a branch destination instruction that is an instruction to be executed next to the branch instruction when a branch instruction occurs, wherein the branch prediction function predicts a branch destination instruction that is an instruction to be executed next to the branch instruction. An information processing device comprising: a loop counter circuit that counts the number of loops when a loop instruction for the number of loops is generated.
【請求項2】  前記分岐予測機能は命令を先取りする
プリフエッチポインタと、分岐先アドレスとコンパレー
タとを有する分岐予測テーブルと、前記ループカウンタ
回路とバリッドビットを有するループカウントテーブル
と、前記分岐命令を検出したとき前記分岐先命令を取出
す処理を行なう分岐予測回路とを備え、前記分岐命令を
検出したとき前記分岐予測回路は前記プリフエッチポイ
ンタに格納されているアドレスと前記バリッドビットが
設定されている前記分岐先アドレスとを前記コンパレー
タにより比較して前記次の実行命令として取出し、前記
ループカウンタ回路は前記ループ回数の設定値を検出し
、前記ループ命令の各実行ごとに1ずつ減算し、前記設
定値が1に達したとき前記バリッドビットの設定を解除
することを特徴とする請求項1記載の情報処理装置。
2. The branch prediction function includes a prefetch pointer for prefetching an instruction, a branch prediction table having a branch destination address and a comparator, a loop count table having the loop counter circuit and a valid bit, and the branch instruction. and a branch prediction circuit that performs a process of extracting the branch destination instruction when the branch instruction is detected, and when the branch instruction is detected, the branch prediction circuit sets the address stored in the prefetch pointer and the valid bit. The comparator compares the branch destination address with the branch destination address and extracts it as the next execution instruction, the loop counter circuit detects the set value of the number of loops, and subtracts by 1 for each execution of the loop instruction, 2. The information processing apparatus according to claim 1, wherein the setting of the valid bit is canceled when the set value reaches 1.
JP2590791A 1991-02-20 1991-02-20 Information processor Pending JPH04264923A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2590791A JPH04264923A (en) 1991-02-20 1991-02-20 Information processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2590791A JPH04264923A (en) 1991-02-20 1991-02-20 Information processor

Publications (1)

Publication Number Publication Date
JPH04264923A true JPH04264923A (en) 1992-09-21

Family

ID=12178855

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2590791A Pending JPH04264923A (en) 1991-02-20 1991-02-20 Information processor

Country Status (1)

Country Link
JP (1) JPH04264923A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007058875A (en) * 1996-08-02 2007-03-08 Jackie A Freeman Programmable branch prediction system and method for computer system
JP2007527050A (en) * 2003-07-09 2007-09-20 コーニンクレッカ フィリップス エレクトロニクス エヌ ヴィ Branch prediction method and system
JP2009053861A (en) * 2007-08-24 2009-03-12 Panasonic Corp Program execution control device
JP2009140137A (en) * 2007-12-05 2009-06-25 Texas Instr Japan Ltd Processor and signal processing method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007058875A (en) * 1996-08-02 2007-03-08 Jackie A Freeman Programmable branch prediction system and method for computer system
JP2007527050A (en) * 2003-07-09 2007-09-20 コーニンクレッカ フィリップス エレクトロニクス エヌ ヴィ Branch prediction method and system
JP2009053861A (en) * 2007-08-24 2009-03-12 Panasonic Corp Program execution control device
JP2009140137A (en) * 2007-12-05 2009-06-25 Texas Instr Japan Ltd Processor and signal processing method
JP4526560B2 (en) * 2007-12-05 2010-08-18 日本テキサス・インスツルメンツ株式会社 Processor and signal processing method

Similar Documents

Publication Publication Date Title
JP5917616B2 (en) Method and apparatus for changing the sequential flow of a program using prior notification technology
KR100395763B1 (en) A branch predictor for microprocessor having multiple processes
EP1889152B1 (en) A method and apparatus for predicting branch instructions
JP3805339B2 (en) Method for predicting branch target, processor, and compiler
US6247122B1 (en) Method and apparatus for performing branch prediction combining static and dynamic branch predictors
US6081887A (en) System for passing an index value with each prediction in forward direction to enable truth predictor to associate truth value with particular branch instruction
US8943298B2 (en) Meta predictor restoration upon detecting misprediction
US10042776B2 (en) Prefetching based upon return addresses
US20080072024A1 (en) Predicting instruction branches with bimodal, little global, big global, and loop (BgGL) branch predictors
JP2006520964A (en) Method and apparatus for branch prediction based on branch target
JP2006520964A5 (en)
JP3486690B2 (en) Pipeline processor
JP2002342114A (en) Processor capable of collecting trace data
US6918033B1 (en) Multi-level pattern history branch predictor using branch prediction accuracy history to mediate the predicted outcome
US6108776A (en) Globally or selectively disabling branch history table operations during sensitive portion of millicode routine in millimode supporting computer
US20040225866A1 (en) Branch prediction in a data processing system
JPH04264923A (en) Information processor
US11397685B1 (en) Storing prediction entries and stream entries where each stream entry includes a stream identifier and a plurality of sequential way predictions
US6289441B1 (en) Method and apparatus for performing multiple branch predictions per cycle
JP2002014868A (en) Microprocessor having memory referring operation detecting mechanism and compile method
JPH10124312A (en) Central processor
US7343481B2 (en) Branch prediction in a data processing system utilizing a cache of previous static predictions
JPH05113931A (en) Address conversion processing system
KR960003052B1 (en) Microprocessor having cashe memory unit
JPH10124313A (en) Parallel processing computer