On Mon, Mar 5, 2012 at 7:47 PM, Andi Kleen <a...@firstfloor.org> wrote:

> The problem I have with the flag is that the typical use model is to
> have multiple code paths, like:
>
> if (cpuid_has_rtm())
>    ... do rtm ...
> else
>    ... do something else ...
>
> So you have a basic block which needs RTM and another one which doesn't
> want it.  If the flag would affect the code generation of the else block
> that would be bad.  So essentially the flag has to be a nop anyways
> except for the intrinsic itself.

As I said, you have target pragmas exactly for this problem:

if (cpuid_has_rtm())
#pragma GCC push_options
#pragma GCC target ("rtm")
    ... do rtm ...
#pragma GCC pop_options
 else
    ... do something else ...

Removing -mrtm option would remove one point of control.

Uros.

Reply via email to