[Info-vax] SOBGEQ vs SOBGTR
Arne Vajhøj
arne at vajhoej.dk
Fri Feb 23 22:29:08 EST 2024
On 2/23/2024 10:14 PM, Lawrence D'Oliveiro wrote:
> ... set up loop count in Rn ...
> BR 9000$
> 1000$:
> ... body of loop ...
> 9000$: SOBGEQ Rn, 1000$
>
> Why branch and use SOBGEQ instead of SOBGTR? So that, if the loop
> count is initially zero, the branch falls right through without
> executing the body of the loop.
With the details provided then it will be pure
speculation.
n = whatever
loop:
if n <= 0 goto endloop
...
n = n - 1
goto loop
endloop:
has more instructions than:
n = whatever
loop:
...
n = n - 1
if n > 0 goto loop
but the second has the problem of not handling the n = 0
case properly.
n = whatever
goto checkfirst
loop:
...
n = n - 1
checkfirst:
if n > 0 goto loop
looks like a hack to fix that problem.
Arne
More information about the Info-vax
mailing list