Re: libmvec in gcc to have vector math in fortran

2018-06-18 Thread Richard Biener
On June 18, 2018 5:06:08 PM GMT+02:00, Joseph Myers wrote: >On Mon, 18 Jun 2018, Richard Biener wrote: > >> I'm thinking of sth like the C stdc-predef.h header which is always >included >> by the compiler. So it needs to be sth parseable by gfortran which >means >> it needs to be a module or sth

Re: libmvec in gcc to have vector math in fortran

2018-06-18 Thread Joseph Myers
On Mon, 18 Jun 2018, Richard Biener wrote: > I'm thinking of sth like the C stdc-predef.h header which is always included > by the compiler. So it needs to be sth parseable by gfortran which means > it needs to be a module or sth equivalent to a fortran include file. To me that suggests somethin

Re: libmvec in gcc to have vector math in fortran

2018-06-18 Thread Richard Biener
On Fri, Jun 15, 2018 at 10:59 PM Joseph Myers wrote: > > On Fri, 15 Jun 2018, Thomas Koenig wrote: > > > Hi Richard, > > > > > First and foremost we need a syntax that actually works for the > > > Fortran frontend and a way to automatically include this special > > > header / module. > > > > I can

Re: libmvec in gcc to have vector math in fortran

2018-06-15 Thread Joseph Myers
On Fri, 15 Jun 2018, Thomas Koenig wrote: > Hi Richard, > > > First and foremost we need a syntax that actually works for the > > Fortran frontend and a way to automatically include this special > > header / module. > > I can imagine parsing the relevant headers while compiling gfortran > and ge

Re: libmvec in gcc to have vector math in fortran

2018-06-15 Thread Thomas Koenig
Hi Richard, First and foremost we need a syntax that actually works for the Fortran frontend and a way to automatically include this special header / module. I can imagine parsing the relevant headers while compiling gfortran and generating C code from it, which could then be #included in the

Re: libmvec in gcc to have vector math in fortran

2018-06-15 Thread Richard Biener
On Fri, Jun 15, 2018 at 11:08 AM Florian Weimer wrote: > > * Richard Biener: > > > That said, good to see some glibc folks jump in on this thread. > > I'd like to see glibc provide a fortran intrinsic header advertising > > the libmvec routines it has. We probably do need some gfortran > > adjust

Re: libmvec in gcc to have vector math in fortran

2018-06-15 Thread Florian Weimer
* Richard Biener: > That said, good to see some glibc folks jump in on this thread. > I'd like to see glibc provide a fortran intrinsic header advertising > the libmvec routines it has. We probably do need some gfortran > adjustments here but I think that glibc advertising is better than > hard-c

Re: libmvec in gcc to have vector math in fortran

2018-06-15 Thread Richard Biener
On Fri, Jun 15, 2018 at 10:39 AM Szabolcs Nagy wrote: > > On 15/06/18 08:59, Florian Weimer wrote: > > * Richard Biener: > > > >> 'pure' makes it pure but there doesn't seem to be a way to make it const? > > > > Does Fortran support setting the rounding mode? > > > > yes, but vec math is only enab

Re: libmvec in gcc to have vector math in fortran

2018-06-15 Thread Szabolcs Nagy
On 15/06/18 08:59, Florian Weimer wrote: * Richard Biener: 'pure' makes it pure but there doesn't seem to be a way to make it const? Does Fortran support setting the rounding mode? yes, but vec math is only enabled with -ffast-math (so it can assume -fno-rounding-math) In C, sin is not c

Re: libmvec in gcc to have vector math in fortran

2018-06-15 Thread Richard Biener
On Fri, Jun 15, 2018 at 9:59 AM Florian Weimer wrote: > > * Richard Biener: > > > 'pure' makes it pure but there doesn't seem to be a way to make it const? > > Does Fortran support setting the rounding mode? > > In C, sin is not const because it depends on the current rounding > mode. It is (well

Re: libmvec in gcc to have vector math in fortran

2018-06-15 Thread Florian Weimer
* Richard Biener: > 'pure' makes it pure but there doesn't seem to be a way to make it const? Does Fortran support setting the rounding mode? In C, sin is not const because it depends on the current rounding mode.

Re: libmvec in gcc to have vector math in fortran

2018-06-14 Thread Richard Biener
On Tue, Apr 10, 2018 at 3:07 PM Jakub Jelinek wrote: > > On Tue, Apr 10, 2018 at 02:55:43PM +0200, Richard Biener wrote: > > > And the easiest solution is in the Fortran FE based on some flag > > > (e.g. -mveclibabi=glibc) through a target hook add > > > __attribute__((__simd__ ("notinbranch"))) >

Re: libmvec in gcc to have vector math in fortran

2018-04-18 Thread Richard Biener
On Tue, Apr 17, 2018 at 3:54 PM, Szabolcs Nagy wrote: > On 10/04/18 14:27, Richard Biener wrote: >> >> On April 10, 2018 3:06:55 PM GMT+02:00, Jakub Jelinek >> wrote: >>> >>> On Tue, Apr 10, 2018 at 02:55:43PM +0200, Richard Biener wrote: I wonder if it is possible for glibc to ship a "

Re: libmvec in gcc to have vector math in fortran

2018-04-17 Thread Szabolcs Nagy
On 10/04/18 14:27, Richard Biener wrote: On April 10, 2018 3:06:55 PM GMT+02:00, Jakub Jelinek wrote: On Tue, Apr 10, 2018 at 02:55:43PM +0200, Richard Biener wrote: I wonder if it is possible for glibc to ship a "module" for fortran instead containing the appropriate declarations and gfortr

Re: libmvec in gcc to have vector math in fortran

2018-04-10 Thread Jakub Jelinek
On Tue, Apr 10, 2018 at 02:55:43PM +0200, Richard Biener wrote: > > And the easiest solution is in the Fortran FE based on some flag > > (e.g. -mveclibabi=glibc) through a target hook add > > __attribute__((__simd__ ("notinbranch"))) > > to the builtins like __builtin_sin etc. that have them in the

Re: libmvec in gcc to have vector math in fortran

2018-04-10 Thread Richard Biener
On April 10, 2018 3:06:55 PM GMT+02:00, Jakub Jelinek wrote: >On Tue, Apr 10, 2018 at 02:55:43PM +0200, Richard Biener wrote: >> > And the easiest solution is in the Fortran FE based on some flag >> > (e.g. -mveclibabi=glibc) through a target hook add >> > __attribute__((__simd__ ("notinbranch")))

Re: libmvec in gcc to have vector math in fortran

2018-04-10 Thread Richard Biener
On April 10, 2018 3:06:55 PM GMT+02:00, Jakub Jelinek wrote: >On Tue, Apr 10, 2018 at 02:55:43PM +0200, Richard Biener wrote: >> > And the easiest solution is in the Fortran FE based on some flag >> > (e.g. -mveclibabi=glibc) through a target hook add >> > __attribute__((__simd__ ("notinbranch")))

Re: libmvec in gcc to have vector math in fortran

2018-04-10 Thread Richard Biener
On Tue, Apr 10, 2018 at 12:29 PM, Jakub Jelinek wrote: > On Tue, Apr 10, 2018 at 11:22:03AM +0100, Szabolcs Nagy wrote: >> On 10/04/18 11:14, Janne Blomqvist wrote: >> > As I mentioned previously in that thread you linked to, the fortran >> > frontend never generates a direct call to libm sin(), o

Re: libmvec in gcc to have vector math in fortran

2018-04-10 Thread Jakub Jelinek
On Tue, Apr 10, 2018 at 11:22:03AM +0100, Szabolcs Nagy wrote: > On 10/04/18 11:14, Janne Blomqvist wrote: > > As I mentioned previously in that thread you linked to, the fortran > > frontend never generates a direct call to libm sin(), or for that matter > > ZGVbN2v_sin(). Instead it generates a "

Re: libmvec in gcc to have vector math in fortran

2018-04-10 Thread Szabolcs Nagy
On 10/04/18 11:14, Janne Blomqvist wrote: As I mentioned previously in that thread you linked to, the fortran frontend never generates a direct call to libm sin(), or for that matter ZGVbN2v_sin(). Instead it generates a "call" to __builtin_sin(). And similarly for other libm functions that have

Re: libmvec in gcc to have vector math in fortran

2018-04-10 Thread Janne Blomqvist
On Tue, Apr 10, 2018 at 12:45 PM, Szabolcs Nagy wrote: > i had a query earlier about libmvec vector functions in fortran: > https://gcc.gnu.org/ml/gcc/2017-11/msg7.html > > but there were no simple solutions to make math functions vectorizable > in fortran, because it's hard to make libc head

libmvec in gcc to have vector math in fortran

2018-04-10 Thread Szabolcs Nagy
i had a query earlier about libmvec vector functions in fortran: https://gcc.gnu.org/ml/gcc/2017-11/msg7.html but there were no simple solutions to make math functions vectorizable in fortran, because it's hard to make libc headers with simd attributes visible to the fortran front end. i thi