On Thu, Jan 24, 2019 at 03:57:56PM +0100, Martin Liška wrote:
> --- a/gcc/config/i386/i386.c
> +++ b/gcc/config/i386/i386.c
> @@ -29577,6 +29577,17 @@ ix86_warn_parameter_passing_abi (cumulative_args_t
> cum_v, tree type)
> cum->warn_empty = false;
> }
>
> +static const char *
Missing function comment. Usually a copy of the target hook description,
perhaps with arch details.
> +ix86_get_multilib_abi_name (void)
> +{
> + if (!(TARGET_64BIT_P (ix86_isa_flags)))
> + return "i386";
> + else if (TARGET_X32_P (ix86_isa_flags))
> + return "x32";
> + else
> + return "x86_64";
> +}
> +
> /* Compute the alignment for a variable for Intel MCU psABI. TYPE is
> the data type, and ALIGN is the alignment that the object would
> ordinarily have. */
> @@ -51804,6 +51815,10 @@ ix86_run_selftests (void)
> #undef TARGET_WARN_PARAMETER_PASSING_ABI
> #define TARGET_WARN_PARAMETER_PASSING_ABI ix86_warn_parameter_passing_abi
>
> +#undef TARGET_GET_MULTILIB_ABI_NAME
> +#define TARGET_GET_MULTILIB_ABI_NAME \
> +ix86_get_multilib_abi_name
All other #define TARGET_* that need to wrap line indent the next line
by two spaces, please do that too.
> -/* Match a !GCC$ builtin (b) attributes simd flags form:
> +/* Match a !GCC$ builtin (b) attributes simd flags if(target) form:
>
> The parameter b is name of a middle-end built-in.
> - Flags are one of:
> - - (empty)
> + FLAGS is optional and must be one of:
> - inbranch
> - notinbranch
FLAGS must be one of (inbranch) or (notinbranch) actually.
> match
> gfc_match_gcc_builtin (void)
> {
> char builtin[GFC_MAX_SYMBOL_LEN + 1];
> + char target[GFC_MAX_SYMBOL_LEN + 1];
>
> if (gfc_match (" ( %n ) attributes simd", builtin) != MATCH_YES)
> return MATCH_ERROR;
> @@ -11361,6 +11365,13 @@ gfc_match_gcc_builtin (void)
> else if (gfc_match (" ( inbranch ) ") == MATCH_YES)
> clause = SIMD_INBRANCH;
>
> + if (gfc_match (" if ( %n ) ", target) == MATCH_YES)
> + {
> + const char *abi = targetm.get_multilib_abi_name ();
> + if (abi == NULL || strcmp (abi, target) != 0)
> + return MATCH_YES;
> + }
Wonder whether we want if (x86_64) or if ('x86_64'), I'd lean for the
latter.
> +
> if (gfc_vectorized_builtins == NULL)
> gfc_vectorized_builtins = new hash_map<nofree_string_hash, int> ();
>
> diff --git a/gcc/target.def b/gcc/target.def
> index 05c9cc1da28..4ba6b167e26 100644
> --- a/gcc/target.def
> +++ b/gcc/target.def
> @@ -5791,6 +5791,12 @@ call_2 may be NULL or a call insn.",
> rtx_insn *, (rtx_insn *call_1, rtx_insn *call_2),
> NULL)
>
> +DEFHOOK
> +(get_multilib_abi_name,
> + "This hook returns name of multilib ABI name.",
> + const char *, (void),
> + NULL)
> +
> DEFHOOK
> (remove_extra_call_preserved_regs,
> "This hook removes registers from the set of call-clobbered registers\n\
> diff --git a/gcc/targhooks.c b/gcc/targhooks.c
> index 529590b55df..a03b967b913 100644
> --- a/gcc/targhooks.c
> +++ b/gcc/targhooks.c
> @@ -2379,4 +2379,10 @@ default_remove_extra_call_preserved_regs (rtx_insn *,
> HARD_REG_SET *)
> {
> }
>
> +const char *
> +default_get_multilib_abi_name (void)
> +{
> + return NULL;
> +}
Just use hook_constcharptr_void_null instead of adding yet another hook that
does the same thing?
Jakub