This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fortran vector math header
On Mon, Jan 21, 2019 at 08:47:42AM +0100, Martin Liška wrote:
> diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
> index 3314e176881..5c7c062574b 100644
> --- a/gcc/fortran/decl.c
> +++ b/gcc/fortran/decl.c
> @@ -11351,6 +11351,7 @@ 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 +11362,24 @@ gfc_match_gcc_builtin (void)
> else if (gfc_match (" ( inbranch ) ") == MATCH_YES)
> clause = SIMD_INBRANCH;
>
> + if (gfc_match (" if ( %n ) ", target) == MATCH_YES)
> + {
> + unsigned HOST_WIDE_INT size_of_long
> + = tree_to_uhwi (TYPE_SIZE_UNIT (long_integer_type_node));
> + if (strcmp (target, "lp64") == 0)
> + {
> + if (size_of_long != 8)
> + return MATCH_YES;
__LP64__ macro is defined if:
if (TYPE_PRECISION (long_integer_type_node) == 64
&& POINTER_SIZE == 64
&& TYPE_PRECISION (integer_type_node) == 32)
All of these are middle-end types or target macros, so you should be able to
test that in the Fortran FE too.
> + }
> + else if (strcmp (target, "ilp32") == 0)
> + {
> + if (size_of_long != 4)
> + return MATCH_YES;
For this obviously as well.
> + }
> + else
> + return MATCH_ERROR;
> + }
> +
> if (gfc_vectorized_builtins == NULL)
> gfc_vectorized_builtins = new hash_map<nofree_string_hash, int> ();
Jakub