Are these branch commands dependent?

I have a sequence of instructions for a function followed by two commands

Loop: .
      .
      .
      .
SUB R20, R4, Rx
BNZ R20, Loop

Is BNZ branch nonzero dependent on SUB instruction? or is it anti-addiction?

+4
source share
2 answers

In theory, there is a data dependency between a branch instruction and an earlier instruction (in this case SUB) that changes the register that the branch will check for transition, but on many modern architectures this dependence does not extend to the following instructions, unlike other data dependencies, from due to branch prediction.

, , SUB - , (.. ) SUB, , SUB, , , , .

, , . , ( ), . , xor r1, r1, r1 foo32bits >> 32 : , , (0), .

+3

, . . ALU, . , .

+2

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


All Articles