This is the mail archive of the 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: [PATCH] Fix x86 #pragma GCC target and target attribute handling (PR target/61925)

On Wed, Jan 28, 2015 at 9:05 PM, Jakub Jelinek <> wrote:
> Hi!
> This patch rewrites the target pragma and target attribute handling in the
> i386 backend, so that outside of functions global_options and target globals
> reflect the currently active #pragma GCC target (if none active, obviously
> the default options) and inside of functions (in between set_cfun to that
> function and set_cfun to another function or NULL) the target state of the
> function.
> Without this patch, that state often was wherever last set_cfun left it
> (consider e.g. function with target attribute inside of #pragma GCC target
> region), and furthermore #pragma GCC target without any function definition
> before #pragma GCC pop_options confused it altogether, plus there has been
> confusion between when should be the default options active and when should
> be the currently active #pragma GCC target activated.
> The last hunk in i386.c also attempts to save some compile time cycles, I
> think it is pointless to add currently active #pragma GCC target as
> attributes to all the target builtins that are activated in the call,
> we certainly don't do that e.g. for target attribute.
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 2015-01-28  Jakub Jelinek  <>
>         PR target/61925
>         * config/i386/i386.c (ix86_reset_to_default_globals): Removed.
>         (ix86_reset_previous_fndecl): Restore it here, unconditionally.
>         (ix86_set_current_function): Rewritten.
>         (ix86_add_new_builtins): Temporarily clear current_target_pragma
>         when creating builtin fndecls.
>         * New test.
>         * New test.
>         * New test.

LGTM as far as I can review this, so if there are no objections from
Honza, the patch is OK.


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