Samuel Tardieu wrote:
For this pattern (isolated setting of one bit in the middle of a byte at
a random memory location), this is the best code on this platform AFAIK.
As an evidence, if you mark neither variable as volatile GCC generates
with -O3 -fomit-frame-pointer:
f:
orb $16, x
orb $32, y
ret
And I sure expect that GCC didn't choose to generate worst code when
I *removed* the volatile constraint :)
OK, sounds reasonable, but then I don't understand the logic behind
avoiding this instruction sequence for the volatile case, this is
two accesses at the bus level so what's the difference? I think
on earlier pentiums these instructions were supposed to be avoided
but of course this may have changed.