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: Jakub Jelinek <jakub at redhat dot com>
- To: Szabolcs Nagy <szabolcs dot nagy at arm dot com>
- Cc: nd at arm dot com, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 2 Nov 2017 14:07:22 +0100
- Subject: Re: libmvec simd math functions in fortran
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jakub at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BEA93356D5
- References: <59F9F4EF.8020305@arm.com> <20171101162641.GC14653@tucnak> <59F9FA84.5070207@arm.com> <59FB144E.7070003@arm.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Nov 02, 2017 at 12:49:18PM +0000, Szabolcs Nagy wrote:
> to answer my question..
>
> it seems fortran cannot express the type signature
> of mathematical functions because arguments are
> passed by reference.
Fortran indeed normally does pass by reference, and you can vectorize it
that way (you can use various declare simd clauses to express in detail
how the arguments should be handled), or pass by reference:
interface
double precision function foo (x, y)
double precision, value :: x, y
!$omp declare simd (foo)
end function
end interface
and/or using bind(c):
interface
function bar (x, y) bind(C)
use, intrinsic :: iso_c_binding
real(c_double), value :: x, y
real(c_double) :: bar
!$omp declare simd (bar)
end function
end interface
etc.
Jakub