You are right.

My compiler also produces this absolutely decent code when not specifying the variables as "volatile".

With "volatile" the code is a lot worse, I don't understand this, as the "normal" code not only fulfills what is necessary to volatile but even is "thread-atomic", as a thread switch does not do an interrupt within a single instruction, not even with the Fido that provides _hardware_ threads.

Thanks a lot for discussing this with me.

-Michael




On 08/03/2012 03:34 PM, Luis Alves wrote:
Hi Michael,

Here is the result (gcc version is 4.2.4):

C test code used:
int xx, xy;
int yy, yx;
int zz;

int main(void)
{
        xx |= 0x80;
        xy |= 0x80000000;

        if (zz & 0x4000)
                yy=yx;

        return 0;
}


[...]
main:
        link.w %fp,#0
        or.w #128,xx+2
        bset #7,xy
        btst #6,zz+2
        jbeq .L2
        move.l yx,yy
.L2:
        clr.l %d0
        unlk %fp
        rts
[...]




_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to