Liste des Groupes | Revenir à c arch |
On 6/19/2024 11:11 AM, MitchAlsup1 wrote:BGB wrote:
>
For example::
>
for( i = 0; i < max, i++ )
a[i] = b[i];
>
In this case, it would often be something more like:That is what VVM does, without you having to lift a finger.
maxn4=max&(~3);
for(i=0; i<maxn4; i+=4)
{
ap=a+i; bp=b+i;
t0=ap[0]; t1=ap[1];
t2=ap[2]; t3=ap[3];
bp[0]=t0; bp[1]=t1;
bp[2]=t2; bp[3]=t3;
}
if(max!=maxn4)
{
for(; i < max; i++ )
a[i] = b[i];
}
If things are partially or fully unrolled, they often go faster.>
And ALWAYS eat more code space.
Granted, but it is faster in this case, though mostly due to being ableThe loop does not have any dependencies, except on the loop index
to sidestep some of the interlock penalties and reducing the amount of cycles spent on the loop itself.
Say, since branching isn't free, more so if one does an increment directly before checking the condition and branching, as is typically the case in a "for()" loop.Note: the ADD, CMP, BC of the LOOP instruction runs in a single cycle.
Les messages affichés proviennent d'usenet.