[Icc-mot] Interesting Optimizations

Edward Karpicz ekarpicz at freemail.lt
Fri Apr 4 09:53:15 PST 2008


Gene,

> Yes, I didn't want to muddy the waters though.


Acctually I muddied waters, sorry. You are rigth, you found the bug. 
Richard, please fix it. Reconstructing minimal code:


void main(void)
{
short i, j;

   i = (i << 8) + 1;
   j = (j << 8) | 2;
}

listing:

                        .area text
                ;              j -> 0,SP
                ;              i -> 2,SP
 0000           _main::
 0000 1B9C              leas -4,S
 0002           ; void main(void)
 0002           ; {
 0002           ; short i, j;
 0002           ;
 0002           ;    i = (i << 8) + 1;
 0002 A682              ldaa 2,S    <<<#### - should be   ldaa 2+1,S
 0004 C601              ldab #1
 0006 B746              tfr D,Y
 0008 6D82              sty 2,S
 000A           ;    j = (j << 8) | 2;
 000A A680              ldaa 0,S    <<<#### - should be   ldaa 0+1,S
 000C C602              ldab #2
 000E B746              tfr D,Y
 0010 6C80              std 0,S
 0012           L1:
 0012                   .dbline 0 ; func end
 0012 1B84              leas 4,S
 0014 3D                rts

Edward 



More information about the Icc-mot mailing list