This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libmvec simd math functions in fortran


On Thu, Nov 2, 2017 at 7:42 PM, Toon Moene <toon@moene.org> wrote:
> On 11/01/2017 05:26 PM, Jakub Jelinek wrote:
>
>> On Wed, Nov 01, 2017 at 04:23:11PM +0000, Szabolcs Nagy wrote:
>>>
>>> is there a way to get vectorized math functions in fortran?
>>>
>>> in c code there is attribute simd declarations or openmp
>>> declare simd pragma to tell the compiler which functions
>>> have simd variant, but i see no such thing in fortran.
>>
>>
>> !$omp declare simd should work fine in fortran (with -fopenmp
>> or -fopenmp-simd).
>
>
> Note that - if you don't want to change the Fortran code, this - almost two
> years old - proposal would work:
>
> https://gcc.gnu.org/ml/gcc/2016-01/msg00025.html
>
> Obviously, I'll only be able to implement this once retirement comes around
> (i.e., after 2023).

I think a better user-interface would be

gfortran ... -include mathvec

which pulls in a pre-def for the vectorized math functions as available.
Somewhere that mathvec "module" needs to reside, ideally it came
from the local glibc install (but module files are GCC version dependent?).

Not sure if gfortran supports -include for module files, OTOH a
-include of fortran source should also work in all contexts(?).

The implementation challenge is

1) actually being able to declare the relevant math functions appropriately
(say, for -ffixed-form f77 style source)
2) make gfortran pick the FUNCTION_DECLs from those declarations
instead of those generated from the mathbuiltins.def.

Solving 2) would be nice to make this work "manually" anyway.
I'm not quite sure we properly override / merge (for other attributes)
with the builtins.

Richard.

> Kind regards,
>
> --
> Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
> Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
> At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
> Progress of GNU Fortran: http://gcc.gnu.org/wiki/GFortran#news


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]