For faster navigation, this Iframe is preloading the Wikiwand page for 分岐命令.

分岐命令

この記事は検証可能参考文献や出典が全く示されていないか、不十分です。 出典を追加して記事の信頼性向上にご協力ください。(このテンプレートの使い方)出典検索?"分岐命令" – ニュース · 書籍 · スカラー · CiNii · J-STAGE · NDL · dlib.jp · ジャパンサーチ · TWL (2020年11月)

分岐命令(ぶんきめいれい、: branch instruction)は、プロセッサ命令のうちプログラム制御命令(Program control instruction)[1]の一種である。ジャンプ命令ともいう。条件ジャンプ命令と無条件ジャンプ命令があり、厳密には「分岐」するのは条件ジャンプであって無条件ジャンプは「分岐」と言えないかもしれないが、特に区別しないことが多い。サブルーチン呼出や戻りの命令も分岐命令の一種とすることもある。

一般的なプロセッサでは、機械語の命令列はアドレスの昇順に逐次実行されるが、分岐命令が実行されると次に実行される命令が切り替わる。高水準言語コンパイラは、条件文Goto文サブルーチンなどの制御構造から分岐命令を生成する。

分岐命令は引数として少なくともターゲットアドレスを持つ。ターゲットアドレスは、分岐命令の実行によりプログラムカウンタに代入される。

命令パイプラインが深い一方で、先読みが浅いプロセッサでは、ジャンプによりパイプラインにバブルが発生しペナルティとなる設計にならざるをえないことがある。そのペナルティを軽減するため、分岐命令の直後を「遅延スロット」と称し、そこにある命令は分岐処理の直前に実行されるものとする、遅延分岐という方式がある。MIPSSHSPARCなど、初期のいわゆるRISCに採用例が多いが、1986年にNECから発表されたμPD77230、1988年にTIから発表されたTMS320C30、デジタルシグナルプロセッサにも(その前から)多い。ディレイスロット(にある命令)の数は、μPD77230の場合で 1 、TMS320C30の場合で 3 であった。大多数のRISCのディレイスロットは 1 である。

パイプライン処理では命令のフェッチが重要であり、分岐予測が用いられることがある。分岐予測は失敗時のコストが大きいので、これを減らすために投機的実行などの技術が用いられる。

ARMIA-64では、汎用レジスタの内1つをプログラムカウンタにすることで、全ての命令を条件実行命令とし分岐命令の必要性を低減しパイプラインストールの可能性を低くする工夫をしている。しかし、この工夫も2011年に発表されたISAのRISC-Vでは命令の復号を複雑化させ、性能を低下させるとして削除されている。さらに、ARM-32の後継であるARM v8でもこの仕様は廃止されている。

脚注・出典

[編集]
  1. ^ P.HAYES, JOHN (1978,1979). Computer Architecture and Organization. pp. 169. ISBN 0-07-027363-4 

関連項目

[編集]
{{bottomLinkPreText}} {{bottomLinkText}}
分岐命令
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?