Hi Michael, Here is the result (gcc version is 4.2.4):
C test code used: volatile int xx, xy; volatile int yy, yx; volatile int zz; int main(void) { xx |= 0x80; xy |= 0x80000000; if (zz & 0x4000) yy=yx; return 0; } ------------------------------------- Resulting assembled code (using optimization flag -O2): [...] main: link.w %fp,#0 move.l xx,%d0 moveq #127,%d1 not.b %d1 or.l %d1,%d0 move.l %d0,xx move.l xy,%d0 bset #31,%d0 move.l %d0,xy move.l zz,%d0 btst #14,%d0 jbeq .L2 move.l yx,%d0 move.l %d0,yy .L2: clr.l %d0 unlk %fp rts [...] Since the volatile tells exactly that you want to use registers during the manipulation of those variables, so I'm not surprised that it doesn't change memory contents directly. If I remove the volatile from the variable declaration, I have the following assembly: [...] 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 [...] Which is what you were expecting (although it is using an OR instead of a BSET in the first one). Regards, Luis On Fri, Aug 3, 2012 at 12:07 PM, Michael Schnell <mschn...@lumino.de> wrote: > On 08/03/2012 11:48 AM, Luis Alves wrote: >> >> At the moment I'm still using gcc 4.2.x > > > I would be thankful If you could check whether in your projects, gcc creates > code that sets ad checks bits in memory and does memory/memory operations > when appropriate. > > I feel > volatile int xx, xy; xx |= 0x80; yx |= 0x0x80000000; > > should create > BSET 7, xx+3 and BSET 7, xy > > > > and > if (xy & 0x4000) > > should create BTST 6, xy+2 > > > > > and xy=xx > > should create MOVE.L xx, xy > > > > -Michael > > _______________________________________________ > 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 _______________________________________________ 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