Compare instruction and breaking from loop issue

Discussion created by macdonc on Jul 29, 2008
Latest reply on Jul 29, 2008 by macdonc

I have this simple add loop which transforms a list using a +1 array index.

For a input list of 1,2,3,4,5,6,7,....

The output should be 2,3,4,5,6,7,1,....

If I use ilt op it works correctly, however if I use the ieq op it does not.

I get 2,3,4,5,6,7,7,......

What am I doing wrong?





" dcl_literal l0, 0,0,0,0\n"
" dcl_literal l1, 1,0,0,0\n"
" dcl_literal l2, 6,0,0,0\n"

"mov r1, l0\n"

"ilt r3, r1, l2\n"
"if_logicalz r3\n"
" mov r2, l0\n"
" mov r2, l1\n"

"ieq r3, r2, l1\n"
//"ilt r3, r1, l2\n"
" break_logicalz r3\n"

" mov r4, g[r1.x]\n"
" iadd r5, r1, l1\n"
" mov g[r1.x], g[r5.x]\n"
" mov g[r5.x], r4\n"

" iadd r1, r1, l1\n"