Re: [PATCH] x86: do not allow to optimize flag_is_changeable_p()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jeremy Fitzhardinge
Date: Tuesday, September 30, 2008 - 8:23 am

krzysztof.h1@poczta.fm wrote:

Yes, you're right.  The pertinent part of the manual is:

    The `volatile' keyword indicates that the instruction has important
    side-effects.  GCC will not delete a volatile `asm' if it is reachable.
    (The instruction can still be deleted if GCC can prove that
    control-flow will never reach the location of the instruction.)  Note
    that even a volatile `asm' instruction can be moved relative to other
    code, including across jump instructions.
      

I normally do my "asm volatile" rant when people try to use it to
enforce ordering, but in this case we just want gcc to not elide the
second use.

So, yes, I think your patch is fine as-is, but it would be worth adding
a comment on the asm (its not necessarily obvious that the
cpuid-capability of a cpu can change).

    J
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH] x86: do not allow to optimize flag_is_changeab ..., Jeremy Fitzhardinge, (Tue Sep 30, 8:23 am)