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


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 :)


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