This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Speed-up def_builtin_const (ix86_valid_target_attribute)
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Martin Liška <mliska at suse dot cz>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Fri, 13 Mar 2015 05:42:57 +0100
- Subject: Re: [PATCH] Speed-up def_builtin_const (ix86_valid_target_attribute)
- Authentication-results: sourceware.org; auth=none
- References: <54FE1B94 dot 9080208 at suse dot cz>
> 2015-03-09 Martin Liska <marxin.liska@gmail.com>
>
> * config/i386/i386.c (def_builtin): Collect union of all
> possible masks.
> (ix86_add_new_builtins): Do not iterate over all builtins
> in cases that isa value has no intersection with possible masks
> and(or) last passed value is equal to the provided.
> ---
> gcc/config/i386/i386.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
> index ab8f03a..5f180b6 100644
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -30592,6 +30592,8 @@ struct builtin_isa {
>
> static struct builtin_isa ix86_builtins_isa[(int) IX86_BUILTIN_MAX];
>
> +/* Union of all masks that are part of builtin_isa structures. */
> +static HOST_WIDE_INT defined_isa_values = 0;
>
> /* Add an ix86 target builtin function with CODE, NAME and TYPE. Save the MASK
> of which isa_flags to use in the ix86_builtins_isa array. Stores the
> @@ -30619,6 +30621,7 @@ def_builtin (HOST_WIDE_INT mask, const char *name,
> if (!(mask & OPTION_MASK_ISA_64BIT) || TARGET_64BIT)
> {
> ix86_builtins_isa[(int) code].isa = mask;
> + defined_isa_values |= mask;
I think you can move this down to set_and_not_build_p set. Please add also
comment explaining the caching mehanism.
>
> mask &= ~OPTION_MASK_ISA_64BIT;
> if (mask == 0
> @@ -30670,6 +30673,14 @@ def_builtin_const (HOST_WIDE_INT mask, const char *name,
> static void
> ix86_add_new_builtins (HOST_WIDE_INT isa)
> {
> + /* Last cached isa value. */
> + static HOST_WIDE_INT last_tested_isa_value = 0;
> +
> + if ((isa & defined_isa_values) == 0 || isa == last_tested_isa_value)
Heer you need to compare (isa & defined_isa_values) == (isa &
last_tested_isa_value) right, because we have isa flags that enable no
builtins.
Honza