How is a revoked branch different from a regular branch?

In particular, to build SPARC, how do branches that are different from regular branches get canceled?

I always thought that canceling branch instructions is required when I need to fill in the nop delay slot for branch commands. However, I do not think that I am right in this part, because you can fill in nop without canceling the branch.

+3
source share
2 answers

A canceled branch instruction causes the instruction in the delay slot — the instruction after the branch — to be ignored if the branch is not accepted.

? , . , , NPC. , , NPC, + 4, NPC . - . , , , . .

loop:   someOp                
        someOtherOp
        branch      loop      ;
        delayslotOp           ; will actually be executed, before someOp, after branch

, nop .

, ? , . , , op . ", a" .

.

+6

SPARC (v9):

3.2.3

[...]

; , .

[...]

, a . ( ) ( ), .

6.3.4. (CTI)

[...]

: , , , . , , , . , "else" "then" "ifthen-else" , . , (, ), "else" "then" .

, , - , :

cmp   %i3, %i0
ble   %icc, -0x5c
ld    [%l0 - 0x4], %i5  ; executed whether the branch is taken or not

...

cmp   %l1, 0x80
bl,a  %icc, +0x40
ld    [%fp + 0x7c7], %g2    ; annulled if the branch is not taken, executed otherwise
+2

Source: https://habr.com/ru/post/1704095/


All Articles