Samuel Tardieu wrote:
When looking at an Ada PR, I stumbled upon the equivalent of the
following C code:
unsigned char x;
volatile unsigned char y;
void f ()
{
x |= 16;
y |= 32;
}
With trunk/i686, the following code is generated (-O3 -fomit-frame-pointer):
f:
movzbl y, %eax
orb $16, x
orl $32, %eax
movb %al, y
ret
I cannot see a reason not to use "orb $32,y" here instead of a three
steps read/modify/write operation. Is this only a missed optimization?
(in which case I will open a PR)
Are you sure it is an optimization, the timing on these things is
very subtle. What evidence do you have that there is a missed
optimization here?