Re: Delayed jumps and branches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2002-09-17 at 11:19, Gareth wrote:
> Hi,
>     jal <my_function>
>     li  $s2, 3
>     li  $v0, 2
> 
> If the jump is not taken, it requires 3 cycles to execute these 3 instructions.
> If the jump is taken, it requires 3 cycles to execute the first instruction of
> my_function, and li $s2, 3 is executed.
> 
> Is my reasoning correct?
> 

Aside from the corrections Thiemo sent, you should probably also
disabuse yourself of the notion that one instruction == one cycle. 

For most processors, there's no simple answer to the question "how many
cycles will this code segment take to run".   Even in the embedded
world, most newer processors are superscalar.  In addition, if you want
to be precise, you have to take into account cache behaviour, branch
prediction, issue restrictions, etc.

-Justin

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux