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 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


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