This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: volatile and R/M/W operations


> volatile unsigned char y;
> void f ()
> {
>         y |= 32;
> }
> 
> 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?

No, it's purposeful.  The idea was that this is completely equivalent to
	y = y | 32;
That does two memory operations and it's volatile, so we want to as well.
Now in some sense, so does "orb $32,y", but we want to play it safe.

For almost all purposes, saying "volatile" means to turn off all optimizations
involving that object and I don't think we want to change that at this point
because of the possible damage to legacy code.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]