Page 1 of 1

beqz vs beqzl in mips

Posted: Thu Jul 12, 2012 2:53 pm
by thecobra
Hi,

I know in mips assembly, Beqz = Branch to address/location if the variable = 0 but what is the diffrence from this one vs the Beqzl ?

Online i found it to mean Branch on Equal to Zero Likely but no reall programming mean of what this mean. Can anyone inlight me please because i saw this several time in prx i been looking at and there a part that doesn make sense if they do the same.


it something like this:

Code: Select all

location_0001:
....
beqz $t0, location_0002
lw $a0, 0($s1)
....

location_0002:
beqzl $t0, location_0001
lw $s0, 0($s1)
....
I get what it doing( to best of my understanding) but i still find it redolent.

Thanks

Re: beqz vs beqzl in mips

Posted: Thu Jul 12, 2012 3:26 pm
by some1
It means that the delay slot is only executed if the branch is true.

Re: beqz vs beqzl in mips

Posted: Thu Jul 12, 2012 3:37 pm
by thecobra
some1 wrote:It means that the delay slot is only executed if the branch is true.

oh so that means that if branch is false then the next instruction is skip over and it execute the third instruction?

so in other word:

Code: Select all

beqzl $t0, local_random
sw $t1, 0($t1)
lw  $a0, 0($t1)
So in this example. If $t0 == 0 then it execute the sw instruction and then branch else it go straight to lw?

while in if beqzl was beqz, it will execute the next instruction even without the branch being true?

Re: beqz vs beqzl in mips

Posted: Thu Jul 12, 2012 4:41 pm
by FrEdDy
Exactly.
Non-likely branch instructions execute the instruction in the delay slot no matter what.

Re: beqz vs beqzl in mips

Posted: Thu Jul 12, 2012 11:16 pm
by thecobra
OK thanks guys