hi Mike,

> I'm trying to understand how to interpret SPARC branching instructions
> presented by mdb and am having some troubles.
>
> At fclose+8, the instruction is saying to "branch to fclose+0x18" if
> thingA is not equal to thingB.  Presumably thingA is %icc (which
> itself is still a mystery to me) but I have no idea what thingB is.

The branch relates to the result of the *preceding* instruction, i.e. 
the orcc.

icc is the 32-bit part of the condition code register; the bits in icc 
note whether the preceding integer operation resulted in zero, caused an 
overflow or carry, etc. These can be used by following conditionals, 
e.g. branch.

The bne instruction branches if the icc indicates non-zero, in this case 
whether the result of the orcc was nonzero. Since the orcc is operating 
on %g0 and %i0, it's really noting whether %i0 is non-zero.

The point about the missing ",pn" is important: this is the prediction 
hint, noting that the compiler (or coder) predicts the branch will not 
('n') be taken.

The older SPARCv8, non-predictive, form of bne uses only %icc, and so 
its use is implied.

The v9 bne is the predictive form, and can use either the 32-bit icc or 
the 64-bit xcc condition codes, and so it's necessary to specify which 
is being used.


hope this helps.

cheers,
calum.

Reply via email to