This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
volatile and R/M/W operations
- From: Samuel Tardieu <sam at rfc1149 dot net>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 30 Nov 2007 23:19:02 +0100
- Subject: volatile and R/M/W operations
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)
Sam
--
Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/