public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* [fortran, RFC] Getting rid of unneeded functions in libgfortran
@ 2017-07-10 18:44 Thomas Koenig
  2017-07-10 21:28 ` Mikael Morin
  2017-07-10 21:30 ` Ulrich Drepper
  0 siblings, 2 replies; 4+ messages in thread
From: Thomas Koenig @ 2017-07-10 18:44 UTC (permalink / raw)
  To: fortran, gcc-patches

Hello world,

with the bump in the libfortran version that is needed with
Paul's patch, I think we can get rid of a few functions
that we do not actually need any more.

I think we now always inline SUM and PRODUCT. We don't do so with all
occurrences of ANY and ALL, but we probably could (and should).

So, is it a worthy goal to eliminate all occurences of these
functions from libgfortran before 8.1 comes out?

Regards

	Thomas

BTW, here are test cases for SUM and PRODUCT:

ig25@linux-d6cw:~/Krempel/Sum> cat pr.f90
program main
   real, dimension(10,10,10) :: a
   real, dimension(10,10) :: b
   real :: s
   call random_number(a)
   s = product(a)
   print *,s
   s = product(a,a>0.3)
   print *,s
   b = product(a,dim=2,mask=a>0.3)
   print *,b
   print *,product(a)
   print *,product(a,a>3)
   print *,product(a,dim=2,mask=a>0.3)
end program main
ig25@linux-d6cw:~/Krempel/Sum> gfortran -fdump-tree-original pr.f90 && 
grep -i product pr.f90.003t.original
ig25@linux-d6cw:~/Krempel/Sum> cat su.f90
program main
   real, dimension(10,10,10) :: a
   real, dimension(10,10) :: b
   real :: s
   call random_number(a)
   s = sum(a)
   print *,s
   s = sum(a,a>0.3)
   print *,s
   b = sum(a,dim=2,mask=a>0.3)
   print *,b
   print *,sum(a)
   print *,sum(a,a>3)
   print *,sum(a,dim=2,mask=a>0.3)
end program main
ig25@linux-d6cw:~/Krempel/Sum> gfortran -fdump-tree-original su.f90 && 
grep -i sum su.f90.003t.original
ig25@linux-d6cw:~/Krempel/Sum>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [fortran, RFC] Getting rid of unneeded functions in libgfortran
  2017-07-10 18:44 [fortran, RFC] Getting rid of unneeded functions in libgfortran Thomas Koenig
@ 2017-07-10 21:28 ` Mikael Morin
  2017-07-10 22:15   ` Thomas Koenig
  2017-07-10 21:30 ` Ulrich Drepper
  1 sibling, 1 reply; 4+ messages in thread
From: Mikael Morin @ 2017-07-10 21:28 UTC (permalink / raw)
  To: Thomas Koenig, fortran, gcc-patches

Hello,

Le 10/07/2017 à 20:43, Thomas Koenig a écrit :
> Hello world,
>
> with the bump in the libfortran version that is needed with
> Paul's patch, I think we can get rid of a few functions
> that we do not actually need any more.
>
> I think we now always inline SUM and PRODUCT. We don't do so with all
> occurrences of ANY and ALL, but we probably could (and should).
>
We don’t inline when the dim argument isn’t constant.  As far as I know, 
this is a valid albeit rare use case for the library functions.

> So, is it a worthy goal to eliminate all occurences of these
> functions from libgfortran before 8.1 comes out?
>
Yes, let’s remove what we can.  But the list of candidates is probably 
shorter than you hoped.  TRANSPOSE seems to have been removed already.
SUM, PRODUCT, ANY and ALL must stay (see above).  What else?

Mikael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [fortran, RFC] Getting rid of unneeded functions in libgfortran
  2017-07-10 18:44 [fortran, RFC] Getting rid of unneeded functions in libgfortran Thomas Koenig
  2017-07-10 21:28 ` Mikael Morin
@ 2017-07-10 21:30 ` Ulrich Drepper
  1 sibling, 0 replies; 4+ messages in thread
From: Ulrich Drepper @ 2017-07-10 21:30 UTC (permalink / raw)
  To: Thomas Koenig; +Cc: fortran, gcc-patches

On Mon, Jul 10, 2017 at 8:43 PM, Thomas Koenig <tkoenig@netcologne.de> wrote:
> with the bump in the libfortran version that is needed with
> Paul's patch,

Isn't it time to start thinking about ABI compatibility just as for
the other libraries?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [fortran, RFC] Getting rid of unneeded functions in libgfortran
  2017-07-10 21:28 ` Mikael Morin
@ 2017-07-10 22:15   ` Thomas Koenig
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Koenig @ 2017-07-10 22:15 UTC (permalink / raw)
  To: Mikael Morin, fortran, gcc-patches

Am 10.07.2017 um 23:27 schrieb Mikael Morin:
> We don’t inline when the dim argument isn’t constant.  As far as I know, 
> this is a valid albeit rare use case for the library functions.

You're right.  We can only remove, for example, sum_i4, but have
to keep ssum_i4 and msum_i4, which both take a dim argument.

Same for ANY and ALL, plus COUNT, we have to leaev them in.

Looking through the files, it is not clear why we have an array
version specific to the Bessel functions. Is it because of a
speed gain?

So, this will be less dramatic than I had hoped.  Oh well...

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-10 22:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-10 18:44 [fortran, RFC] Getting rid of unneeded functions in libgfortran Thomas Koenig
2017-07-10 21:28 ` Mikael Morin
2017-07-10 22:15   ` Thomas Koenig
2017-07-10 21:30 ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).