This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: volatile and R/M/W operations
- From: Samuel Tardieu <sam at rfc1149 dot net>
- To: Robert Dewar <dewar at adacore dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 2 Dec 2007 09:59:09 +0100
- Subject: Re: volatile and R/M/W operations
- References: <2007-11-30-23-19-02+trackit+sam@rfc1149.net> <4751EEDB.6070008@adacore.com>
On 1/12, Robert Dewar wrote:
>> 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?
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 :)