diff options
author | Martin Liska <mliska@suse.cz> | 2019-02-18 09:19:47 +0100 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2019-02-18 08:19:47 +0000 |
commit | e8cecccc2e5abb5d753291892968bf72533a7045 (patch) | |
tree | 29fdf5a07178e7c279d7b62f846b33075258733b /gcc/fortran | |
parent | d3cbcb233854574e23793c72a2af72d4d3bf94fe (diff) | |
download | gcc-e8cecccc2e5abb5d753291892968bf72533a7045.zip gcc-e8cecccc2e5abb5d753291892968bf72533a7045.tar.gz gcc-e8cecccc2e5abb5d753291892968bf72533a7045.tar.bz2 |
Support if statement in !GCC$ builtin directive.
2019-02-18 Martin Liska <mliska@suse.cz>
* config/i386/i386.c (ix86_get_multilib_abi_name): New function.
(TARGET_GET_MULTILIB_ABI_NAME): New macro defined.
* doc/tm.texi: Document new target hook.
* doc/tm.texi.in: Likewise.
* target.def: Add new target macro.
* gcc.c (find_fortran_preinclude_file): Do not search multilib
suffixes.
2019-02-18 Martin Liska <mliska@suse.cz>
* decl.c (gfc_match_gcc_builtin): Add support for filtering
of builtin directive based on multilib ABI name.
2019-02-18 Martin Liska <mliska@suse.cz>
* gfortran.dg/simd-builtins-7.f90: New test.
* gfortran.dg/simd-builtins-7.h: New test.
From-SVN: r268978
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/decl.c | 21 |
2 files changed, 21 insertions, 5 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 4f150e2..a03cfd2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2019-02-18 Martin Liska <mliska@suse.cz> + + * decl.c (gfc_match_gcc_builtin): Add support for filtering + of builtin directive based on multilib ABI name. + 2019-02-17 Harald Anlauf <anlauf@gmx.de> PR fortran/88299 diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 3658e43..9d6aa7d 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -28,6 +28,7 @@ along with GCC; see the file COPYING3. If not see #include "match.h" #include "parse.h" #include "constructor.h" +#include "target.h" /* Macros to access allocate memory for gfc_data_variable, gfc_data_value and gfc_data. */ @@ -11360,19 +11361,22 @@ gfc_match_gcc_unroll (void) return MATCH_ERROR; } -/* 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) - - inbranch - - notinbranch + FLAGS is optional and must be one of: + - (inbranch) + - (notinbranch) + + IF('target') is optional and TARGET is a name of a multilib ABI. When we come here, we have already matched the !GCC$ builtin string. */ + 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; @@ -11383,6 +11387,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; + } + if (gfc_vectorized_builtins == NULL) gfc_vectorized_builtins = new hash_map<nofree_string_hash, int> (); |