CN101160561A - 通过循环结束分支来抑制分支历史寄存器的更新 - Google Patents
通过循环结束分支来抑制分支历史寄存器的更新 Download PDFInfo
- Publication number
- CN101160561A CN101160561A CNA2006800126198A CN200680012619A CN101160561A CN 101160561 A CN101160561 A CN 101160561A CN A2006800126198 A CNA2006800126198 A CN A2006800126198A CN 200680012619 A CN200680012619 A CN 200680012619A CN 101160561 A CN101160561 A CN 101160561A
- Authority
- CN
- China
- Prior art keywords
- branch
- instruction
- loop
- bhr
- branch instruction
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 claims description 24
- 230000004044 response Effects 0.000 claims description 8
- 230000008878 coupling Effects 0.000 claims description 4
- 238000010168 coupling process Methods 0.000 claims description 4
- 238000005859 coupling reaction Methods 0.000 claims description 4
- 238000001514 detection method Methods 0.000 claims 1
- 230000005764 inhibitory process Effects 0.000 claims 1
- 238000011156 evaluation Methods 0.000 abstract description 8
- 238000012549 training Methods 0.000 abstract description 3
- 230000006399 behavior Effects 0.000 description 8
- 229920006395 saturated elastomer Polymers 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 230000015654 memory Effects 0.000 description 6
- 230000000694 effects Effects 0.000 description 4
- 238000013519 translation Methods 0.000 description 4
- 230000002902 bimodal effect Effects 0.000 description 3
- 230000002596 correlated effect Effects 0.000 description 3
- 230000000875 corresponding effect Effects 0.000 description 3
- 238000013461 design Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 230000003068 static effect Effects 0.000 description 3
- 230000002411 adverse Effects 0.000 description 2
- 239000003990 capacitor Substances 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 241001269238 Data Species 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 230000002939 deleterious effect Effects 0.000 description 1
- 238000011010 flushing procedure Methods 0.000 description 1
- 230000009931 harmful effect Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/32—Address formation of the next instruction, e.g. by incrementing the instruction counter
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3802—Instruction prefetching
- G06F9/3804—Instruction prefetching for branches, e.g. hedging, branch folding
- G06F9/3806—Instruction prefetching for branches, e.g. hedging, branch folding using address prediction, e.g. return stack, branch history buffer
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/32—Address formation of the next instruction, e.g. by incrementing the instruction counter
- G06F9/322—Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address
- G06F9/325—Address formation of the next instruction, e.g. by incrementing the instruction counter for non-sequential address for loops, e.g. loop detection or loop counter
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/38—Concurrent instruction execution, e.g. pipeline or look ahead
- G06F9/3836—Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
- G06F9/3842—Speculative instruction execution
- G06F9/3844—Speculative instruction execution using dynamic branch prediction, e.g. using branch history tables
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)
- Executing Machine-Instructions (AREA)
- Devices For Executing Special Programs (AREA)
- Debugging And Monitoring (AREA)
- Memory System Of A Hierarchy Structure (AREA)
- Radar Systems Or Details Thereof (AREA)
- Molds, Cores, And Manufacturing Methods Thereof (AREA)
- Transition And Organic Metals Composition Catalysts For Addition Polymerization (AREA)
Abstract
检测终止代码循环的条件分支指令,且防止分支历史寄存器(BHR)更新以存储循环结束分支评估。这防止实施循环迭代的分支从所述BHR中取代其它分支评估历史。可通过编译器使用特定类型分支指令或在循环结束分支指令的操作码中插入指示位来静态地检测所述循环结束分支。循环结束分支指令可被动态地检测为任何后向分支,或者通过在更新所述BHR时存储最后一个或若干个分支指令的PC并对照最后分支PC(LBPC)寄存器检验分支指令的所述PC而动态地检测。如果所述分支PC匹配,那么抑制对所述BHR的更新。将循环迭代分支保持在所述BHR之外会改进分支预测训练时间和准确性。
Description
技术领域
本发明大体上涉及处理器领域,且更确切地说涉及一种通过用循环结束分支指令抑制对分支历史寄存器的更新而改进分支预测的方法。
背景技术
微处理器在广泛的应用中执行计算任务。几乎始终需要改进的处理器性能以允许通过软件变化来实现较快的操作和/或增加的功能性。在许多嵌入式应用(例如,便携式电子装置)中,节省功率也是处理器设计和实施的一个目标。
许多现代处理器使用管线结构,其中连续的指令(各具有多个执行步骤)在执行时重叠。为了实现改进的性能,指令应当连续流动穿过管线。任何导致指令在管线中停滞的情形均可对性能造成不利影响。如果从管线中冲洗(flush)指令并随后重新取得指令,那么性能和功率消耗均会受到损害。
大多数程序包含条件分支指令,直到在管线深处评估指令时才会知道其实际分支行为。为了避免因等待对分支指令的实际评估而产生的停滞,现代处理器可采用某种形式的分支预测,借此在管线中早期预测条件分支指令的分支行为。基于预测出的分支评估,处理器以推测方式从预测出的地址取得(预取)并执行指令,所述预测出的地址是分支目标地址(如果预测会采用分支)或分支指令之后的下一顺序地址(如果预测不会采用分支)。当确定了实际分支行为时,如果分支被错误预测,那么必须从管线中冲洗以推测方式取得的指令,并从下一正确地址取得新的指令。响应于错误的分支预测而预取指令可对处理器性能和功率消耗造成不利影响。因此,改进分支预测的准确性是一个重要的设计目标。
已知的分支预测技术包含静态和动态两种预测。可通过编程器和/或编译器来静态地预测一些分支指令的可能行为。分支预测的一个实例是错误检验例行程序。代码通常会正确执行,且错误是罕见的。因此,实施“遇错误分支(branch on error)”的分支指令将在非常高的百分比的时间中评估“不采用”。此种指令可在操作码中包含静态分支预测位,所述预测位是由编程器或编译器在知道分支条件的最可能结果的情况下设定的。
动态预测一般基于正被预测的分支指令和/或同一代码中的其它分支指令的分支评估历史(且在一些情况下是分支预测准确性历史)。对实际代码的广泛分析指示,最近过去的分支评估模式可能是对未来分支指令的评估的良好指示。
图1中描绘的一种已知形式的动态分支预测利用分支历史寄存器(BHR)100来存储过去n个分支评估。在简单的实施方案中,BHR 30包括移位寄存器。将最近的分支评估结果移入(例如,1指示采用分支且0指示不采用分支),而寄存器中的最早过去的评估被取代。处理器可针对每个分支指令维持局部BHR 100。或者(或另外),BHR 100可含有对所有条件分支指令的最近过去的评估,其有时在此项技术中称为全局BHR或GHR。如本文所使用,BHR指代局部和全局分支历史寄存器两者。
如图1中所描绘,BHR 100可将分支预测器表(BPT)102编索引,所述BPT 102同样可以是局部的或全局的。BHR 100可直接将BPT 102编索引,或者可在BPT索引逻辑104中与例如分支指令的程序计数器(PC)的其它信息组合。另外可利用对BPT索引逻辑104的其它输入。BPT索引逻辑104可将输入链接在一起(此项技术中通常称为gselect),对输入进行异或运算(gshare),执行散列函数,或以多种方式组合或转换输入。
在一个实例中,BPT 102可包括多个饱和计数器,其MSB充当双模态分支预测器。举例来说,每个表条目可包括2位计数器,所述计数器采用四种状态中的一种,所述四种状态中的每一者被指派有加权预测值,例如:
11-强力预测采用
10-弱预测采用
01-弱预测不采用
00-强力预测不采用
每当相应的分支指令评估“采用”时,所述计数器递增,且每当指令评估“不采用”时,所述计数器递减。计数器的MSB是双模态分支预测器,其将预测一个分支是采用还是不采用,而不管基础预测的强度或权重如何。饱和计数器减少不频繁的分支评估的预测错误。始终单向评估的分支将使计数器饱和。相反地不频繁评估将改变计数器值(以及预测的强度),但不是双模态预测值。因此,不频繁的评估将只错误预测一次而不是两次。饱和计数器的表只是说明性实例,一般来说,BHT可将含有多种分支预测机制的表编索引。
不论在BPT 102中采用哪种分支预测机制,BHR 100(单独的或与例如分支指令PC的其它信息组合)将BPT 102编索引以获得分支预测。通过在BHR 100中存储先前分支评估并在分支预测中使用所述评估,使正被预测的分支指令与过去的分支行为相关--在局部BHR 100的情况下为其自身的过去行为而在全局BHR 100的情况下为其它分支指令的行为。这种相关至少在高度重复的代码的情况下可能是准确的分支预测的关键。
请注意,图1描绘存储在BHR 100中的分支评估,即对条件分支指令的实际评估,其可能只有在管线深处(例如在执行管级中)才被了解。虽然这是最终结果,但在实践中,许多高性能处理器将来自BPT 102的预测出的分支评估存储在BHR 100中,并之后在证实预测错误时作为错误预测恢复操作的一部分而对BHR 100进行校正。为了清晰起见,附图未反映这种实施特征。
可能会降低采用BHR 100的分支预测器的功效的一种常用代码结构是循环。循环以测试循环结束条件的条件分支指令结束,所述循环结束条件例如为每次通过循环时递增的索引变量是否已达到循环结束值。如果没有,那么执行形成分支回到循环的开始处以进行另一次迭代和另一次循环结束条件分支评估。相对于n位BHR 100,存在关于循环的三种相关情况:循环不执行;循环通过m次迭代执行(其中m<n);和循环执行m次(其中m>=n)。
如果循环不执行,那么循环开始处的前向分支在循环主体上形成分支,从而产生一个采用的分支评估。这对BHR 100具有最小影响,因为BHR 100中的过去分支评估历史只由一个分支评估取代(实际上,预测准确性可通过与这个分支评估的相关来改进)。
如果循环通过m次迭代来执行(其中m>=n),那么循环结束分支指令的“采用”后向分支使BHR 100饱和。也就是说,在循环结束时,n位BHR将始终含有恰好n-1个一且后面跟着单个零,这对应于由循环迭代产生的较长系列的采用的评估,且在循环终止时以单个未采用评估结束。这实际上损害BHR 100的功效,因为与先前分支评估(对于局部或全局BHR 100)的所有相关全部丢失。在此情况下,BHR 100将很可能映射到相同的BPT 102条目以获取给定的分支指令(视对BPT索引逻辑104的其它输入而定),而不是映射到含有反映分支指令与先前分支评估的相关的分支预测的条目。
此外,饱和的BHR 100可增加BPT 102中的混淆。也就是说,如果BHR 100直接将BPT 102编索引,那么具有许多迭代的循环之后的所有分支指令将映射到相同的BPT 102条目。即使在BHR 100与其它信息组合的情况下,混淆的可能性也会增加。这不但对于循环之后的分支指令而且对于混淆到其在BPT 102中的条目的所有分支指令,均会不利地影响预测准确性。
如果循环通过m次迭代执行(其中m<n),那么BHR 100不饱和且保持某一先前分支评估历史。然而,代表先前分支评估历史的位被m个位位置取代。特别在m变化的情况下,这对分支预测具有两个有害影响。首先,分支指令将映射到BPT 102中的更大数目的条目,以俘获与先前分支评估的相同相关,从而与没有循环结束分支影响BHR 30的情况下将需要的BPT 102相比,对于相同数目的分支指令需要更大的BPT 102来支持相同的准确性。第二,BPT 102中的分支预测器将花费较长时间来“训练”,从而增加了在BPT 102开始提供准确的分支预测之前必须执行的代码量。
举例来说,考虑8位BHR 100和一代码段,其具有分支指令A-H,接着是循环,且接下来是分支指令X。分支X与分支G和H的评估历史强力相关。插入的循环的各种迭代将在预测X时产生下表1中呈现的BHR结果。
BHR | 注释 | |||||||
A | B | C | D | E | F | G | H | 循环执行一次(未采用初始前向或循环结束后向分支) |
B | C | D | E | F | G | H | 1 | 跳过循环(采用一个初始前向分支) |
C | D | E | F | G | H | 1 | 0 | 2次迭代(循环结束后向分支采用一次,然后不采用) |
D | E | F | G | H | 1 | 1 | 0 | 3次迭代 |
E | F | G | H | 1 | 1 | 1 | 0 | 4次迭代 |
F | G | H | 1 | 1 | 1 | 1 | 0 | 5次迭代 |
G | H | 1 | 1 | 1 | 1 | 1 | 0 | 6次迭代 |
表1:各种数目的循环迭代之后的BHR 100内容
在此实例中,每种情况下BHR 100中均存在正被预测的分支指令X与对分支G和H的先前评估之间的所需相关。然而,其位于BHR 100中的不同位置,且因此每种情况将映射到不同的BPT 102条目。这会浪费BPT 102空间,增加分支预测训练时间,并增加BPT 102中的混淆的可能性,所有这些都会降低预测准确性。
发明内容
在一个或一个以上实施例中,通过识别循环结束分支指令并响应于循环结束指令而抑制对BHR的更新来改善在BHR中存储循环结束的分支指令评估的不良影响。以多种方式识别循环结束指令。
在一个实施例中,分支预测方法包含响应于分支指令的性质而在分支指令执行时视情况抑制对BHR的更新。
在另一实施例中,处理器包含:分支预测器,其可操作以预测对条件分支指令的评估;以及指令执行管线,其可操作以基于来自分支预测器的预测以推测方式取得和执行指令。所述处理器还包含:BHR,其可操作以存储对条件分支指令的评估;以及控制电路,其可操作以响应于分支指令的性质而抑制存储对条件分支指令的评估。
在又一实施例中,可操作以响应于程序代码而产生指令的编译器或汇编器包含可操作以指示终止代码循环的条件分支指令的循环结束分支指令标记功能。
附图说明
图1是现有技术分支预测器电路的功能方框图。
图2是处理器的功能方框图。
图3是执行分支指令的方法的流程图。
图4是包含一个或一个以上最后分支PC寄存器的分支预测器电路的功能方框图。
具体实施方式
图1描绘处理器10的功能方框图。处理器10根据控制逻辑14在指令执行管线12中执行指令。在一些实施例中,管线12可为超标量设计,其具有多个并行管线。管线12包含组织成管级的各种寄存器或锁存器16,以及一个或一个以上算术逻辑单元(ALU)18。通用寄存器(GPR)文件20提供包括存储器层级的顶部的寄存器。
管线12从指令高速缓冲存储器(I-cache)22取得指令,其中由指令侧转译后备缓冲器(ITLB)24来管理存储器地址转译和许可。当在管线12中早期解码条件分支指令时,分支预测器26预测分支行为,并向指令预取单元28提供预测。指令预取单元28对于“采用的”分支预测在管线12中计算出的分支目标地址处或对于预测为“不采用”的分支在下一顺序地址处以推测方式从指令高速缓冲存储器22取得指令。在任一情况下,均将预取的指令加载到管线12中以用于推测性执行。
分支预测器26包含分支历史寄存器(BHR)30、分支预测器表(BPT)32、BPT索引逻辑34以及BHR更新逻辑36。分支预测器26可额外包含一个或一个以上最后分支PC寄存器38,本文下文中对其进行更充分描述。
从数据高速缓冲存储器(D-cache)40存取数据,其中由主转译后备缓冲器(TLB)42管理存储器地址转译和许可。在各种实施例中,ITLB 24可包括TLB 42的一部分的副本。或者,ITLB 24与TLB 42可集成。类似地,在处理器10的各种实施例中,I-cache 22与D-cache 40可集成或合并。I-cache 22和/或D-cache 40中的未中导致在存储器接口46的控制下存取主(芯片外)存储器44。
处理器10可包含输入/输出(I/O)接口46,其控制对各种外围装置50的存取。所属领域的技术人员将认识到,处理器10的许多变化形式是可能的。举例来说,处理器10可包含用于I-cache 22和D-cache 40中的任一者或两者的第二层(L2)高速缓冲存储器。此外,特定实施例中可省略处理器10中描绘的功能块中的一者或一者以上。
根据一个或一个以上实施例,通过防止循环结束分支破坏分支预测器26中的一个或一个以上BHR 30来改进分支预测准确性。图3中将这个过程描绘成流程图。将条件分支指令解码(方框52)。确定分支是否为循环结束分支(方框54)。如果不是,那么更新BHR 30以记录分支评估(方框56),即,分支指令评估为“采用”还是“不采用”。执行接着分别在分支目标地址或下一顺序地址处继续(方框58)。如果分支不是循环结束分支,那么抑制更新BHR 30以记录对循环结束分支指令的分支评估(如从方框54到方框58的路径所指示)。以此方式,循环迭代分支不会通过取代相关分支评估历史而破坏BHR 30的内容。查询(方框54)将分支指令识别为循环结束分支指令,所述步骤可通过多种方式来实现。
循环通过从循环结束处向后向循环开始处形成分支来迭代。根据一个实施例,假设每个分支目标地址小于分支指令地址或PC的条件分支指令(即后向分支)是循环结束分支指令,且防止其更新BHR 30。这个实施例提供简化的优点。在BHR 30更新时间,当分支指令实际上在管线中评估时将分支指令PC与分支目标地址(BTA)进行比较。如果BTA<PC,那么不更新BHR 30。这个实施例具有以下缺点:当确定分支目标地址时需要进行地址比较,且一些不是循环结束分支的后向分支将不使其评估记录在BHR 30中。
另一种检测循环结束分支的方式是辨别对同一分支指令的重复执行。在图4中描绘的一个实施例中,最后分支PC(LBPC)寄存器38存储其评估被存储在BHR 30中的最后分支指令的PC。在简单循环的情况下,如果分支指令的PC与LBPC 38匹配(也就是说,分支指令是所评估的最后分支指令),那么假设分支指令是循环结束分支指令,且抑制对BHR 30的进一步更新。如上文参看图1所论述,虽然图4描绘在任何给定实施方案中将LBPC 38的内容与BHR更新逻辑36中的实际分支评估进行比较,但可将LBPC 38与预测的分支评估进行比较,其中在错误预测的情况下对BHR 30进行校正。这个实施例只存储循环的第一次迭代,只从BHR 30中取代一个先前分支评估。这个实施例不需要编译器支持,且不需要在BHR 30更新时间确定分支的方向。
循环可含有一个或一个以上嵌套循环,或者可在循环内包含其它分支。在此情况下,可通过LBPC方法抑制内部循环使BHR 30饱和;然而,外部循环结束分支仍然将被存储在BHR 30中。在一个实施例中,可提供两个或两个以上LBPC寄存器38,其中将连续评估的分支指令的PC存储在相应的LBPC寄存器(LBPC0,LBPC1…LBPCM)38中。如果分支指令的PC与LBPCN寄存器38中的任一者匹配,那么可抑制对BHR 30的更新。
也可由编译器或汇编器静态地标记循环结束分支指令。在一个实施例中,编译器产生只用于循环结束分支的特定类型的分支指令,例如“BRLP”。辨别BRLP指令,且当BRPE指令在执行管级中评估时决不更新BHR 30。在另一实施例中,编译器或汇编器可例如通过在操作码中设定一个或一个以上预界定的位而在分支指令中嵌入循环结束分支指示。检测循环结束分支位,且当所述分支指令在执行管级中评估时抑制对BHR 30的更新。对循环结束分支的静态识别通过将循环结束识别功能移动到编译器或汇编器中而减小硬件和计算复杂性。
条件分支指令可具有许多性质,其中包含(例如)分支指令地址或PC、指令类型和操作码中是否存在指示位。如本文所使用,将分支操作的性质和/或与分支有关的程序的性质视为分支指令的性质。举例来说,分支指令PC是否与一个或一个以上LBPC寄存器38的内容匹配以及分支目标地址相对于分支指令PC是正向还是后向的,这些是分支指令的性质。
虽然本文中已就本发明的特定特征、方面和实施例描述了本发明,但将了解,在本发明的广泛范围内可能有许多变化、修改和其它实施例,且因此,应认为所有变化、修改和实施例均在本发明的范围内。因此,应在所有方面均将当前实施例理解为说明性的而非限制性的,且希望属于所附权利要求书的意义和等效范围内的所有变化均包含在其中。
Claims (22)
1.一种分支预测方法,其包括:
响应于分支指令的性质,在执行所述分支指令时视情况抑制对分支历史寄存器(BHR)的更新。
2.根据权利要求1所述的方法,其中所述分支指令的性质为所述分支是后向的。
3.根据权利要求1所述的方法,其中所述分支指令的性质为所述分支是循环结束分支。
4.根据权利要求3所述的方法,其中所述分支指令的PC与存储最后分支指令的PC的最后分支PC(LBPC)寄存器的内容匹配以更新所述BHR。
5.根据权利要求4所述的方法,其中所述分支指令的PC与存储最后多个分支指令的PC的多个LBPC寄存器中的任一者的内容匹配以更新所述BHR。
6.根据权利要求3所述的方法,其中所述分支指令的性质为所述分支指令是由编译器针产生以用于结束分支的唯一分支指令。
7.根据权利要求3所述的方法,其中所述分支指令的性质为所述分支指令包含指示其为循环结束分支指令的一个或一个以上位。
8.一种处理器,其包括:
分支预测器,其可操作以预测对条件分支指令的评估;
指令执行管线,其可操作以基于来自所述分支预测器的预测以推测方式取得并执行指令;
分支历史寄存器(BHR),其可操作以存储所述对条件分支指令的评估;以及控制电路,其可操作以响应于所述分支指令的性质而抑制存储所述对条件分支指令的评估。
9.根据权利要求8所述的处理器,其进一步包括最后分支PC(LBPC)寄存器,所述LBPC寄存器可操作以存储更新所述BHR的分支指令的PC,且其中所述控制电路可操作以在所述分支指令的PC与所述LBPC寄存器的内容匹配时抑制存储所述对条件分支指令的评估。
10.根据权利要求9所述的方法,其进一步包括多个LBPC寄存器,所述多个LBPC寄存器可操作以存储更新所述BHR的多个分支指令的PC,且其中所述控制电路可操作以在所述分支指令的PC与任何LBPC寄存器的内容匹配时抑制存储所述对条件分支指令的评估。
11.根据权利要求8所述的方法,其中所述控制电路可操作以在所述分支指令包含其为循环结束指令的指示时抑制存储所述对条件分支指令的评估。
12.根据权利要求11所述的方法,其中所述分支指令为循环结束指令的所述指示为指令类型。
13.根据权利要求8所述的方法,其中所述控制电路可操作以在分支指令目标地址小于所述分支指令PC时抑制存储所述对条件分支指令的评估。
14.一种编译器或汇编器,其包括:
编译器或汇编器,其可操作以响应于程序代码而产生指令;以及
循环结束分支指令标记功能,其可操作以指示终止代码循环的条件分支指令。
15.根据权利要求14所述的编译器或汇编器,其中所述循环结束分支指令标记功能可操作以产生唯一类型的分支指令来结束每一循环。
16.根据权利要求14所述的编译器或汇编器,其中所述循环结束分支指令标记功能可操作以在结束循环的每一条件分支指令中插入循环结束指示符。
17.根据权利要求16所述的编译器或汇编器,其中所述循环结束指示符包括插入在所述条件分支指令操作码中的预定字段中的一个或一个以上位。
18.一种使用存储对先前条件分支指令的评估的分支历史寄存器(BHR)的分支预测方法,其包括:
检测循环结束分支;以及
抑制对将存储对相关联分支指令的评估的BHR的更新。
19.根据权利要求18所述的方法,其中检测循环结束分支包括检测所述相关联分支指令的PC与存储最后分支指令的PC的最后分支PC(LBPC)寄存器的内容之间的匹配以更新所述BHR。
20.根据权利要求18所述的方法,其中检测循环结束分支包括检测所述相关联分支指令的PC与存储最后多个分支指令的PC的多个LBPC寄存器中的任一者的内容之间的匹配以更新所述BHR。
21.根据权利要求18所述的方法,其中检测循环结束分支包括解码由编译器产生以用于结束分支的唯一分支指令。
22.根据权利要求18所述的方法,其中检测循环结束分支包括检测所述相关联分支指令操作码中指示其为循环结束分支指令的一个或一个以上位。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310409847.0A CN103488463B (zh) | 2005-02-24 | 2006-02-24 | 通过循环结束分支来抑制分支历史寄存器的更新 |
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US11/066,508 US20060190710A1 (en) | 2005-02-24 | 2005-02-24 | Suppressing update of a branch history register by loop-ending branches |
US11/066,508 | 2005-02-24 | ||
PCT/US2006/006531 WO2006091778A2 (en) | 2005-02-24 | 2006-02-24 | Suppressing update of a branch history register by loop-ending branches |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310409847.0A Division CN103488463B (zh) | 2005-02-24 | 2006-02-24 | 通过循环结束分支来抑制分支历史寄存器的更新 |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101160561A true CN101160561A (zh) | 2008-04-09 |
CN101160561B CN101160561B (zh) | 2013-10-16 |
Family
ID=36577533
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310409847.0A Expired - Fee Related CN103488463B (zh) | 2005-02-24 | 2006-02-24 | 通过循环结束分支来抑制分支历史寄存器的更新 |
CN2006800126198A Expired - Fee Related CN101160561B (zh) | 2005-02-24 | 2006-02-24 | 通过循环结束分支来抑制分支历史寄存器的更新 |
Family Applications Before (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310409847.0A Expired - Fee Related CN103488463B (zh) | 2005-02-24 | 2006-02-24 | 通过循环结束分支来抑制分支历史寄存器的更新 |
Country Status (11)
Country | Link |
---|---|
US (1) | US20060190710A1 (zh) |
EP (2) | EP2270651A1 (zh) |
JP (3) | JP5198879B2 (zh) |
KR (1) | KR100930199B1 (zh) |
CN (2) | CN103488463B (zh) |
AT (1) | ATE483198T1 (zh) |
DE (1) | DE602006017174D1 (zh) |
ES (1) | ES2351163T3 (zh) |
IL (1) | IL185362A0 (zh) |
MX (1) | MX2007010386A (zh) |
WO (1) | WO2006091778A2 (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103353834A (zh) * | 2012-02-24 | 2013-10-16 | 苹果公司 | 对零谓词分支误预测的分支误预测行为抑制 |
CN104335167A (zh) * | 2012-06-05 | 2015-02-04 | 高通股份有限公司 | 基于寄存器相关联偏好向执行管线发布指令以及相关指令处理电路、处理器系统、方法及计算机可读媒体 |
Families Citing this family (37)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8607209B2 (en) | 2004-02-04 | 2013-12-10 | Bluerisc Inc. | Energy-focused compiler-assisted branch prediction |
JP4393317B2 (ja) * | 2004-09-06 | 2010-01-06 | 富士通マイクロエレクトロニクス株式会社 | メモリ制御回路 |
US20060190710A1 (en) * | 2005-02-24 | 2006-08-24 | Bohuslav Rychlik | Suppressing update of a branch history register by loop-ending branches |
US8904155B2 (en) * | 2006-03-17 | 2014-12-02 | Qualcomm Incorporated | Representing loop branches in a branch history register with multiple bits |
US7962724B1 (en) * | 2007-09-28 | 2011-06-14 | Oracle America, Inc. | Branch loop performance enhancement |
US7956552B2 (en) * | 2008-03-18 | 2011-06-07 | International Business Machiness Corporation | Apparatus, system, and method for device group identification |
US20090327674A1 (en) * | 2008-06-27 | 2009-12-31 | Qualcomm Incorporated | Loop Control System and Method |
JP5423156B2 (ja) * | 2009-06-01 | 2014-02-19 | 富士通株式会社 | 情報処理装置及び分岐予測方法 |
US20110047357A1 (en) * | 2009-08-19 | 2011-02-24 | Qualcomm Incorporated | Methods and Apparatus to Predict Non-Execution of Conditional Non-branching Instructions |
CN101807145B (zh) * | 2010-04-16 | 2012-12-26 | 浙江大学 | 栈式分支预测器的硬件实现方法 |
US8756591B2 (en) | 2011-10-03 | 2014-06-17 | International Business Machines Corporation | Generating compiled code that indicates register liveness |
US8615745B2 (en) | 2011-10-03 | 2013-12-24 | International Business Machines Corporation | Compiling code for an enhanced application binary interface (ABI) with decode time instruction optimization |
US10078515B2 (en) | 2011-10-03 | 2018-09-18 | International Business Machines Corporation | Tracking operand liveness information in a computer system and performing function based on the liveness information |
US9329869B2 (en) | 2011-10-03 | 2016-05-03 | International Business Machines Corporation | Prefix computer instruction for compatibily extending instruction functionality |
US9690583B2 (en) | 2011-10-03 | 2017-06-27 | International Business Machines Corporation | Exploiting an architected list-use operand indication in a computer system operand resource pool |
US9286072B2 (en) | 2011-10-03 | 2016-03-15 | International Business Machines Corporation | Using register last use infomation to perform decode-time computer instruction optimization |
US8612959B2 (en) | 2011-10-03 | 2013-12-17 | International Business Machines Corporation | Linking code for an enhanced application binary interface (ABI) with decode time instruction optimization |
US9354874B2 (en) | 2011-10-03 | 2016-05-31 | International Business Machines Corporation | Scalable decode-time instruction sequence optimization of dependent instructions |
US9697002B2 (en) | 2011-10-03 | 2017-07-04 | International Business Machines Corporation | Computer instructions for activating and deactivating operands |
US8959320B2 (en) | 2011-12-07 | 2015-02-17 | Apple Inc. | Preventing update training of first predictor with mismatching second predictor for branch instructions with alternating pattern hysteresis |
US9304776B2 (en) * | 2012-01-31 | 2016-04-05 | Oracle International Corporation | System and method for mitigating the impact of branch misprediction when exiting spin loops |
US20140156978A1 (en) * | 2012-11-30 | 2014-06-05 | Muawya M. Al-Otoom | Detecting and Filtering Biased Branches in Global Branch History |
US10289414B2 (en) | 2014-06-02 | 2019-05-14 | International Business Machines Corporation | Suppressing branch prediction on a repeated execution of an aborted transaction |
US10503538B2 (en) * | 2014-06-02 | 2019-12-10 | International Business Machines Corporation | Delaying branch prediction updates specified by a suspend branch prediction instruction until after a transaction is completed |
US10261826B2 (en) | 2014-06-02 | 2019-04-16 | International Business Machines Corporation | Suppressing branch prediction updates upon repeated execution of an aborted transaction until forward progress is made |
US10235172B2 (en) | 2014-06-02 | 2019-03-19 | International Business Machines Corporation | Branch predictor performing distinct non-transaction branch prediction functions and transaction branch prediction functions |
US10635446B2 (en) * | 2015-09-24 | 2020-04-28 | Qualcomm Incorporated | Reconfiguring execution pipelines of out-of-order (OOO) computer processors based on phase training and prediction |
US9639370B1 (en) * | 2015-12-15 | 2017-05-02 | International Business Machines Corporation | Software instructed dynamic branch history pattern adjustment |
GB2548603B (en) * | 2016-03-23 | 2018-09-26 | Advanced Risc Mach Ltd | Program loop control |
US20180349144A1 (en) * | 2017-06-06 | 2018-12-06 | Intel Corporation | Method and apparatus for branch prediction utilizing primary and secondary branch predictors |
US10613867B1 (en) | 2017-07-19 | 2020-04-07 | Apple Inc. | Suppressing pipeline redirection indications |
CN111177663B (zh) * | 2019-12-20 | 2023-03-14 | 青岛海尔科技有限公司 | 编译器的代码混淆改进方法及装置、存储介质、电子装置 |
US11941403B2 (en) * | 2020-06-19 | 2024-03-26 | Arm Limited | Selective prediction based on correlation between a given instruction and a subset of a set of monitored instructions ordinarily used to generate predictions for that given instruction |
US11113067B1 (en) * | 2020-11-17 | 2021-09-07 | Centaur Technology, Inc. | Speculative branch pattern update |
CN112988234A (zh) * | 2021-02-06 | 2021-06-18 | 江南大学 | 一种面向不稳定控制流循环体的分支指令辅助预测器 |
US11868779B2 (en) * | 2021-09-09 | 2024-01-09 | International Business Machines Corporation | Updating metadata prediction tables using a reprediction pipeline |
US11928474B2 (en) * | 2022-06-03 | 2024-03-12 | Microsoft Technology Licensing, Llc | Selectively updating branch predictors for loops executed from loop buffers in a processor |
Family Cites Families (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS635442A (ja) * | 1986-06-26 | 1988-01-11 | Matsushita Electric Ind Co Ltd | プログラムル−プ検出記憶装置 |
US5175827A (en) * | 1987-01-22 | 1992-12-29 | Nec Corporation | Branch history table write control system to prevent looping branch instructions from writing more than once into a branch history table |
JP2555664B2 (ja) * | 1987-01-22 | 1996-11-20 | 日本電気株式会社 | 分岐ヒストリテーブル書込制御方式 |
JPH0715662B2 (ja) * | 1987-07-14 | 1995-02-22 | 日本電気株式会社 | 命令の先取りを行なう情報処理装置 |
JPH06243036A (ja) * | 1993-02-12 | 1994-09-02 | Hitachi Ltd | キャッシュ制御システム |
EP0623874A1 (en) * | 1993-05-03 | 1994-11-09 | International Business Machines Corporation | Method for improving the performance of processors executing instructions in a loop |
US5404473A (en) * | 1994-03-01 | 1995-04-04 | Intel Corporation | Apparatus and method for handling string operations in a pipelined processor |
JP3494484B2 (ja) * | 1994-10-12 | 2004-02-09 | 株式会社ルネサステクノロジ | 命令処理装置 |
US5752014A (en) * | 1996-04-29 | 1998-05-12 | International Business Machines Corporation | Automatic selection of branch prediction methodology for subsequent branch instruction based on outcome of previous branch prediction |
US5893142A (en) * | 1996-11-14 | 1999-04-06 | Motorola Inc. | Data processing system having a cache and method therefor |
US6253373B1 (en) * | 1997-10-07 | 2001-06-26 | Hewlett-Packard Company | Tracking loop entry and exit points in a compiler |
US6427206B1 (en) * | 1999-05-03 | 2002-07-30 | Intel Corporation | Optimized branch predictions for strongly predicted compiler branches |
JP2001166948A (ja) * | 1999-12-07 | 2001-06-22 | Nec Corp | プログラム変換方法、プログラム変換装置及びプログラム変換プログラムを記憶した記憶媒体 |
US7017030B2 (en) * | 2002-02-20 | 2006-03-21 | Arm Limited | Prediction of instructions in a data processing apparatus |
JP3798998B2 (ja) * | 2002-06-28 | 2006-07-19 | 富士通株式会社 | 分岐予測装置および分岐予測方法 |
JP4243463B2 (ja) * | 2002-08-19 | 2009-03-25 | 株式会社半導体理工学研究センター | 命令スケジューリングのシミュレーション方法とシミュレーションシステム |
US7290089B2 (en) * | 2002-10-15 | 2007-10-30 | Stmicroelectronics, Inc. | Executing cache instructions in an increased latency mode |
JP3893463B2 (ja) * | 2003-04-23 | 2007-03-14 | 国立大学法人九州工業大学 | キャッシュメモリ、及びキャッシュメモリの電力削減方法 |
US20050102659A1 (en) * | 2003-11-06 | 2005-05-12 | Singh Ravi P. | Methods and apparatus for setting up hardware loops in a deeply pipelined processor |
US20060190710A1 (en) * | 2005-02-24 | 2006-08-24 | Bohuslav Rychlik | Suppressing update of a branch history register by loop-ending branches |
-
2005
- 2005-02-24 US US11/066,508 patent/US20060190710A1/en not_active Abandoned
-
2006
- 2006-02-24 KR KR1020077021427A patent/KR100930199B1/ko not_active IP Right Cessation
- 2006-02-24 ES ES06735979T patent/ES2351163T3/es active Active
- 2006-02-24 WO PCT/US2006/006531 patent/WO2006091778A2/en active Application Filing
- 2006-02-24 JP JP2007557182A patent/JP5198879B2/ja not_active Expired - Fee Related
- 2006-02-24 EP EP10181327A patent/EP2270651A1/en not_active Withdrawn
- 2006-02-24 MX MX2007010386A patent/MX2007010386A/es active IP Right Grant
- 2006-02-24 EP EP06735979A patent/EP1851620B1/en not_active Not-in-force
- 2006-02-24 AT AT06735979T patent/ATE483198T1/de not_active IP Right Cessation
- 2006-02-24 DE DE602006017174T patent/DE602006017174D1/de active Active
- 2006-02-24 CN CN201310409847.0A patent/CN103488463B/zh not_active Expired - Fee Related
- 2006-02-24 CN CN2006800126198A patent/CN101160561B/zh not_active Expired - Fee Related
-
2007
- 2007-08-19 IL IL185362A patent/IL185362A0/en unknown
-
2010
- 2010-11-30 JP JP2010266368A patent/JP2011100466A/ja not_active Withdrawn
-
2014
- 2014-08-08 JP JP2014162801A patent/JP2015007995A/ja active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103353834A (zh) * | 2012-02-24 | 2013-10-16 | 苹果公司 | 对零谓词分支误预测的分支误预测行为抑制 |
US9268569B2 (en) | 2012-02-24 | 2016-02-23 | Apple Inc. | Branch misprediction behavior suppression on zero predicate branch mispredict |
CN103353834B (zh) * | 2012-02-24 | 2016-09-28 | 苹果公司 | 对零谓词分支误预测的分支误预测行为抑制 |
CN104335167A (zh) * | 2012-06-05 | 2015-02-04 | 高通股份有限公司 | 基于寄存器相关联偏好向执行管线发布指令以及相关指令处理电路、处理器系统、方法及计算机可读媒体 |
CN104335167B (zh) * | 2012-06-05 | 2018-04-27 | 高通股份有限公司 | 用于处理计算机指令的方法和处理器 |
Also Published As
Publication number | Publication date |
---|---|
IL185362A0 (en) | 2008-02-09 |
ATE483198T1 (de) | 2010-10-15 |
US20060190710A1 (en) | 2006-08-24 |
EP1851620A2 (en) | 2007-11-07 |
CN101160561B (zh) | 2013-10-16 |
WO2006091778A3 (en) | 2007-07-05 |
CN103488463A (zh) | 2014-01-01 |
EP1851620B1 (en) | 2010-09-29 |
JP5198879B2 (ja) | 2013-05-15 |
KR100930199B1 (ko) | 2009-12-07 |
JP2011100466A (ja) | 2011-05-19 |
CN103488463B (zh) | 2016-11-09 |
DE602006017174D1 (de) | 2010-11-11 |
JP2008532142A (ja) | 2008-08-14 |
WO2006091778A2 (en) | 2006-08-31 |
ES2351163T3 (es) | 2011-02-01 |
EP2270651A1 (en) | 2011-01-05 |
JP2015007995A (ja) | 2015-01-15 |
MX2007010386A (es) | 2007-10-18 |
KR20070105365A (ko) | 2007-10-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN101160561B (zh) | 通过循环结束分支来抑制分支历史寄存器的更新 | |
CN100547542C (zh) | 指令预取机构 | |
CN101401065B (zh) | 用于分支预测的方法和装置 | |
JP4763727B2 (ja) | 分岐予測ミスを訂正するシステムおよび方法 | |
CN103353833B (zh) | 错误的推测性更新的链接栈修复 | |
CN101460922B (zh) | 滑动窗口、基于区块的分支目标地址高速缓冲存储器 | |
JP2008532142A5 (zh) | ||
JP2011100466A5 (zh) | ||
CN101438237A (zh) | 基于区块的分支目标地址高速缓冲存储器 | |
JP7046087B2 (ja) | キャッシュ・ミス・スレッド・バランシング | |
Milenkovic et al. | Microbenchmarks for determining branch predictor organization | |
US6871275B1 (en) | Microprocessor having a branch predictor using speculative branch registers | |
Uzelac | Microbenchmarks and mechanisms for reverse engineering of modern branch predictor units | |
Prémillieu | Microarchitecture exploration of control flow reconvergence |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 1112984 Country of ref document: HK |
|
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: WD Ref document number: 1112984 Country of ref document: HK |
|
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20131016 Termination date: 20190224 |
|
CF01 | Termination of patent right due to non-payment of annual fee |