This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: libmvec simd math functions in fortran
- From: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: nd at arm dot com, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 02 Nov 2017 12:49:18 +0000
- Subject: Re: libmvec simd math functions in fortran
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Szabolcs dot Nagy at arm dot com;
- Nodisclaimer: True
- References: <59F9F4EF.8020305@arm.com> <20171101162641.GC14653@tucnak> <59F9FA84.5070207@arm.com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On 01/11/17 16:47, Szabolcs Nagy wrote:
> On 01/11/17 16:26, 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).
>>
>
> 1) i don't want to change the fortran.
>
> 2) it does not work for me.
>
> i want this to call vector powf in libmvec:
>
> subroutine foo(a,b,c)
> real(4) a(8000),b(8000),c(8000)
> do j=1,8000
> a(j)=b(j)**c(j)
> end do
> end
>
> where do i put
>
> !$omp declare simd (powf)
>
> ?
to answer my question..
it seems fortran cannot express the type signature
of mathematical functions because arguments are
passed by reference.
so there is no way to declare math interfaces
and then add omp declare simd to them to get
simd versions.
(it's not clear to me how omp declare simd is
supposed to work in fortran, but it is not useful
for vectorizing loops with math functions.)
so gfortran will need a different mechanism to
do the vectorization, e.g. an option like
-mveclibabi=glibc, but the list of available
vector functions need to be specified somewhere.