4 ms·
Most DSPs have zero overhead loops (still branches) which don't incur a branch penalty. So something like below may take 1-2 cycles atmost, per iteration.
by sifar 7y ago
Most DSPs have zero overhead loops (still branches) which don't incur a branch penalty. So something like below may take 1-2 cycles atmost, per iteration.
for(i=0;i<howmany;i++) {
out[index] = random();
}
Ofcourse variable length loops would still have the branches.
- ncmncm 7y agoHaswell and later can run loops with 4 instructions, including 2 ALU ops and two conditional branches -- provided only one is taken -- in one cycle. Compilers prefer to order the instructions so they take two or more cycles.