Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:multiasm:paarm:chapter_5_12 [2026/02/27 02:27] jtokarzen:multiasm:paarm:chapter_5_12 [2026/02/27 16:55] (current) – [Conditional instructions] jtokarz
Line 19: Line 19:
 ''<fc #800000>ADD  </fc> <fc #008000>X1</fc>, <fc #008000>X1</fc>, <fc #ffa500>#1</fc>     <fc #6495ed>@ This executes speculatively while B.EQ remains unresolved</fc>''\\ ''<fc #800000>ADD  </fc> <fc #008000>X1</fc>, <fc #008000>X1</fc>, <fc #ffa500>#1</fc>     <fc #6495ed>@ This executes speculatively while B.EQ remains unresolved</fc>''\\
 The possible outcomes are shown in the picture below. The possible outcomes are shown in the picture below.
-{{ :en:multiasm:paarm:spec_cmp.jpg?600 |}}+<figure cmp> 
 +{{ :en:multiasm:paarm:spec_cmp.jpg?600 |CMP instruction outcomes}} 
 +<caption>CMP instruction outcomes</caption> 
 +</figure>
  
 In the example above, the comparison is made on the ''<fc #008000>X0</fc>'' register. The next instruction creates a branch to the label. In the pipeline, while ''<fc #800000>B</fc>.<fc #9400d3>EQ </fc>'' instruction is being executed; the next instruction is already prepared to be executed, if not already (by speculation). When the branch outcome becomes known, the pipeline either commits the results (if the prediction was correct) or flushes the pipeline and re-fetches from the correct address (if the prediction was wrong). In such a way, if the register is not equal to zero, processor speculation wins in performance; otherwise, the third instruction result is discarded, and any microoperation for this instruction is cancelled—the processor branches to a new location.  In the example above, the comparison is made on the ''<fc #008000>X0</fc>'' register. The next instruction creates a branch to the label. In the pipeline, while ''<fc #800000>B</fc>.<fc #9400d3>EQ </fc>'' instruction is being executed; the next instruction is already prepared to be executed, if not already (by speculation). When the branch outcome becomes known, the pipeline either commits the results (if the prediction was correct) or flushes the pipeline and re-fetches from the correct address (if the prediction was wrong). In such a way, if the register is not equal to zero, processor speculation wins in performance; otherwise, the third instruction result is discarded, and any microoperation for this instruction is cancelled—the processor branches to a new location. 
Line 96: Line 99:
 Other conditional instructions can be used similarly: Other conditional instructions can be used similarly:
  
-{{ :en:multiasm:paarm:conditionainst.jpg?600 |}}+<figure conditionainst> 
 +{{ :en:multiasm:paarm:conditionainst.jpg?600 |Examples of other conditional instructions' use}} 
 +<caption>Examples of other conditional instructions' use</caption> 
 +</figure>
  
 These conditional instructions are helpful in branchless conditional checks. Taking into account that these instructions can also be executed speculatively, this execution won't waste power compared to branching if branch prediction fails. These conditional instructions are helpful in branchless conditional checks. Taking into account that these instructions can also be executed speculatively, this execution won't waste power compared to branching if branch prediction fails.
  
en/multiasm/paarm/chapter_5_12.1772152021.txt.gz · Last modified: by jtokarz
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0