On 1/16/19 9:35 PM, Joseph Myers wrote: > On Wed, 16 Jan 2019, Jakub Jelinek wrote: > >> Perhaps easier would be to add optional if clause to the !GCC$ builtin >> with constant expression argument which if present and evaluates to .false. >> would tell us to ignore the attribute. Or, add !GCC$ if/else/end if which >> would act like preprocessing conditionals or something similar. >> Not really sure one can query in Fortran what the multilib is some way (say >> look at size of a pointer etc.). > > If something like that is done, I'd suggest doing it in a form which > allows each multilib's information about glibc functions to go in a > separate generated header (so having !GCC$ include or similar to include a > per-multilib file, under appropriate conditionals). Otherwise you need to > bring back logic in glibc to make a compiler building glibc for one > multilib use appropriate -D and -U options to get its C headers to define > things appropriately for another multilib, so that the all-multilib > Fortran header can be generated in a single glibc build. (Like the old > logic for generating bits/syscall.h that was removed in commits > 2dba5ce7b8115d6a2789bf279892263621088e74 and > ee17d4e99af9e49378217209d3708053ef148032.) >
Hi. What about something as simple as this: diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 3314e176881..2f2b965f97d 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -11361,6 +11361,11 @@ gfc_match_gcc_builtin (void) else if (gfc_match (" ( inbranch ) ") == MATCH_YES) clause = SIMD_INBRANCH; + /* Filter builtins defined only for 64-bit compilation mode. */ + if (gfc_match (" ( 64bit ) ") == MATCH_YES + && tree_to_uhwi (TYPE_SIZE_UNIT (long_integer_type_node)) != 64) + return MATCH_YES; + if (gfc_vectorized_builtins == NULL) gfc_vectorized_builtins = new hash_map<nofree_string_hash, int> (); That would allow to write: !GCC$ builtin (cos) attributes simd (notinbranch) (64bit) Thoughts? Thanks, Martin