public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module
@ 2020-06-11 16:55 longb at cray dot com
  2020-06-11 17:50 ` [Bug fortran/95644] " dominiq at lps dot ens.fr
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: longb at cray dot com @ 2020-06-11 16:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

            Bug ID: 95644
           Summary: IEEE_FMA is missing from the IEEE_ARITHMETIC module
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: longb at cray dot com
  Target Milestone: ---

> cat test2.f90

program test

  use, intrinsic :: ieee_arithmetic, only : ieee_fma

  implicit none

end program test


Intel:

> ifort test2.f90

Cray:

> module swap PrgEnv-intel PrgEnv-cray
> ftn test2.f90
> ./a.out

gfortran:

> module swap PrgEnv-cray PrgEnv-gnu
> gfortran test2.f90
test2.f90:2:43:

2 | use, intrinsic :: ieee_arithmetic, only : ieee_fma
1
Error: Symbol 'ieee_fma' referenced at (1) not found in module
'ieee_arithmetic'
>

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

* [Bug fortran/95644] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
@ 2020-06-11 17:50 ` dominiq at lps dot ens.fr
  2020-10-02 21:46 ` longb at cray dot com
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-06-11 17:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-06-11
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed.

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

* [Bug fortran/95644] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
  2020-06-11 17:50 ` [Bug fortran/95644] " dominiq at lps dot ens.fr
@ 2020-10-02 21:46 ` longb at cray dot com
  2020-10-05 19:45 ` [Bug fortran/95644] [F2018] " anlauf at gcc dot gnu.org
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: longb at cray dot com @ 2020-10-02 21:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

--- Comment #2 from Bill Long <longb at cray dot com> ---
Any update on a fix for this?  (The original customer is asking.)

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
  2020-06-11 17:50 ` [Bug fortran/95644] " dominiq at lps dot ens.fr
  2020-10-02 21:46 ` longb at cray dot com
@ 2020-10-05 19:45 ` anlauf at gcc dot gnu.org
  2020-10-05 19:50 ` longb at cray dot com
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-10-05 19:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|IEEE_FMA is missing from    |[F2018] IEEE_FMA is missing
                   |the IEEE_ARITHMETIC module  |from the IEEE_ARITHMETIC
                   |                            |module

--- Comment #3 from anlauf at gcc dot gnu.org ---
> Any update on a fix for this?  (The original customer is asking.)

I assume the customer or Cray didn't set a bounty on this?

Adding F2018 to summary.

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (2 preceding siblings ...)
  2020-10-05 19:45 ` [Bug fortran/95644] [F2018] " anlauf at gcc dot gnu.org
@ 2020-10-05 19:50 ` longb at cray dot com
  2021-01-22 18:00 ` longb at cray dot com
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: longb at cray dot com @ 2020-10-05 19:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

--- Comment #4 from Bill Long <longb at cray dot com> ---
The customer has nuclear weapons.  They do not do "bounty". :)  Cray/HPE is
just the messenger. I think they would be happy with a plan for including the
routine.

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (3 preceding siblings ...)
  2020-10-05 19:50 ` longb at cray dot com
@ 2021-01-22 18:00 ` longb at cray dot com
  2021-01-23  3:07 ` jvdelisle at charter dot net
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: longb at cray dot com @ 2021-01-22 18:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

--- Comment #5 from Bill Long <longb at cray dot com> ---
Original customer is asking again...

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (4 preceding siblings ...)
  2021-01-22 18:00 ` longb at cray dot com
@ 2021-01-23  3:07 ` jvdelisle at charter dot net
  2021-03-03 21:59 ` longb at cray dot com
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jvdelisle at charter dot net @ 2021-01-23  3:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

Jerry DeLisle <jvdelisle at charter dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at charter dot net

--- Comment #6 from Jerry DeLisle <jvdelisle at charter dot net> ---
Hi Bill, per our operational security procedure we can't talk about
ieee_arithmetic, especially when we dont get paid.  However, I can go look at
the code and see if Steve's patch got in or not.

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (5 preceding siblings ...)
  2021-01-23  3:07 ` jvdelisle at charter dot net
@ 2021-03-03 21:59 ` longb at cray dot com
  2021-03-04  0:51 ` kargl at gcc dot gnu.org
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: longb at cray dot com @ 2021-03-03 21:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

--- Comment #7 from Bill Long <longb at cray dot com> ---
Inquiry from the original site:

"Does GCC provide a timeline for when they will conform to F2018?"

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (6 preceding siblings ...)
  2021-03-03 21:59 ` longb at cray dot com
@ 2021-03-04  0:51 ` kargl at gcc dot gnu.org
  2021-03-04  2:04 ` kargl at gcc dot gnu.org
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-03-04  0:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #8 from kargl at gcc dot gnu.org ---
(In reply to Bill Long from comment #7)
> Inquiry from the original site:
> 
> "Does GCC provide a timeline for when they will conform to F2018?"

gfortran is maintained mostly by a very, very, very, small group
of individuals who have very, very, very, limited free time.  Things
get fixed and implemented as time and whim permits.

The quickest way to ensure something is implemented/fixed is to
download the source code and dive in.

Short of someone diving in, there is always the kludge of

module kludge

   use iso_c_binding, only : fp => c_float
   use iso_c_binding, only : dp => c_double
   use iso_c_binding, only : lp => c_long_double

   implicit none

   private

   public ieee_fma

   interface ieee_fma

      function fmaf(x, y, z) bind(c, name='fmaf')
         import fp
         real(fp) fmaf
         real(fp), intent(in), value :: x, y, z
      end function fmaf

      function fma(x, y, z) bind(c, name='fma')
         import dp
         real(dp) fma
         real(dp), intent(in), value :: x, y, z
      end function fma

      function fmal(x, y, z) bind(c, name='fmal')
         import lp
         real(lp) fmal
         real(lp), intent(in), value :: x, y, z
      end function fmal
   end interface ieee_fma

end module

program foo
   use kludge, only : ieee_fma
   real x, y, z    ! Yeah, I should use fp from kludge.
   x = 1.
   y = 2. / 3.
   z = y
   print *, ieee_fma(x, y, z)
end program foo

Or, if the availability of IEEE_FMA is must have feature and someone
is incapability of implemented, someone could approach on of those
very, very, very, few individuals and pay for the work to be done.

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (7 preceding siblings ...)
  2021-03-04  0:51 ` kargl at gcc dot gnu.org
@ 2021-03-04  2:04 ` kargl at gcc dot gnu.org
  2021-03-04  2:22 ` jvdelisle at gcc dot gnu.org
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-03-04  2:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

--- Comment #9 from kargl at gcc dot gnu.org ---
(In reply to kargl from comment #8)
> 
> Short of someone diving in, there is always the kludge of ...
> 

This is a better kludge, but is far from the correct approach
as gfortran should use the __builtin_fma() family of functions.
But, this works for at least static linking.  I did not update
the symbol map for dynamic linking.  I also did not test the
libquadmath portion.  ENOTIME.

diff --git a/libgfortran/ieee/ieee_arithmetic.F90
b/libgfortran/ieee/ieee_arithmetic.F90
index 35a16938f8e..3d686863e90 100644
--- a/libgfortran/ieee/ieee_arithmetic.F90
+++ b/libgfortran/ieee/ieee_arithmetic.F90
@@ -39,7 +39,7 @@ module IEEE_ARITHMETIC
     IEEE_DIVIDE_BY_ZERO, IEEE_UNDERFLOW, IEEE_INEXACT, IEEE_USUAL, &
     IEEE_ALL, IEEE_STATUS_TYPE, IEEE_GET_FLAG, IEEE_GET_HALTING_MODE, &
     IEEE_GET_STATUS, IEEE_SET_FLAG, IEEE_SET_HALTING_MODE, &
-    IEEE_SET_STATUS, IEEE_SUPPORT_FLAG, IEEE_SUPPORT_HALTING
+    IEEE_SET_STATUS, IEEE_SUPPORT_FLAG, IEEE_SUPPORT_HALTING, IEEE_FMA

   ! Derived types and named constants

@@ -88,6 +88,17 @@ module IEEE_ARITHMETIC
   end interface
   public :: operator (.ne.)

+  ! IEEE_FMA
+  interface ieee_fma
+      module procedure fma04
+      module procedure fma08
+#ifdef HAVE_GFC_REAL_10
+      module procedure fma10
+#endif
+#ifdef HAVE_GFC_REAL_16
+      module procedure fma16
+#endif
+  end interface ieee_fma

   ! IEEE_IS_FINITE

@@ -808,6 +819,65 @@ SUPPORTGENERIC(IEEE_SUPPORT_STANDARD)

 contains

+      impure elemental function fma04(x, y, z)
+         use iso_c_binding, only : knd => c_float
+         real(4) fma04
+         real(4), intent(in) :: x, y, z
+         interface
+            function fmaf(x, y, z) bind(c, name='fmaf')
+               import knd
+               real(knd) fmaf
+               real(knd), intent(in), value :: x, y, z
+            end function fmaf
+         end interface
+         fma04 = fmaf(real(x, knd), real(y, knd), real(z, knd))
+      end function fma04
+
+      impure elemental function fma08(x, y, z)
+         use iso_c_binding, only : knd => c_double
+         real(8) fma08
+         real(8), intent(in) :: x, y, z
+         interface
+            function fma(x, y, z) bind(c, name='fma')
+               import knd
+               real(knd) fma
+               real(knd), intent(in), value :: x, y, z
+            end function fma
+         end interface
+         fma08 = fma(real(x, knd), real(y, knd), real(z, knd))
+      end function fma08
+#ifdef HAVE_GFC_REAL_10
+      impure elemental function fma10(x, y, z)
+         use iso_c_binding, only : knd => c_long_double
+         real(10) fma10
+         real(10), intent(in) :: x, y, z
+         interface
+            function fmal(x, y, z) bind(c, name='fmal')
+               import knd
+               real(knd) fmal
+               real(knd), intent(in), value :: x, y, z
+            end function fmal
+         end interface
+         fma10 = fmal(real(x, knd), real(y, knd), real(z, knd))
+      end function fma10
+#endif
+#ifdef HAVE_GFC_REAL_16
+      impure elemental function fma16(x, y, z)
+         integer, parameter :: knd = 16
+         real(16) fma16
+         real(16), intent(in) :: x, y, z
+         interface
+            function fmaq(x, y, z) bind(c, name='fmaq')
+               import knd
+               real(knd) fmaq
+               real(knd), intent(in) :: x, y, z
+            end function fmaq
+         end interface
+         fma16 = fmaq(real(x, knd), real(y, knd), real(z, knd))
+      end function fma16
+#endif
+
+
   ! Equality operators for IEEE_CLASS_TYPE and IEEE_ROUNDING_MODE
   elemental logical function IEEE_CLASS_TYPE_EQ (X, Y) result(res)
     implicit none

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (8 preceding siblings ...)
  2021-03-04  2:04 ` kargl at gcc dot gnu.org
@ 2021-03-04  2:22 ` jvdelisle at gcc dot gnu.org
  2021-03-04  4:02 ` sgk at troutmask dot apl.washington.edu
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2021-03-04  2:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

--- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
It is very likely that the gcc optimizers will actually convert the to fma
machine instructions, but no guarantee.

I don't have much time, but it is likely some of the tricks we used in matmul
can be used to get this to be "register" implemented .

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (9 preceding siblings ...)
  2021-03-04  2:22 ` jvdelisle at gcc dot gnu.org
@ 2021-03-04  4:02 ` sgk at troutmask dot apl.washington.edu
  2021-12-30  0:36 ` ally.alto.0z at icloud dot com
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: sgk at troutmask dot apl.washington.edu @ 2021-03-04  4:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

--- Comment #11 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Thu, Mar 04, 2021 at 02:22:46AM +0000, jvdelisle at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644
> 
> --- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
> It is very likely that the gcc optimizers will actually convert the to fma
> machine instructions, but no guarantee.

That's what __builtin_fma() will do.  The second kludge I
posted would still have the layer of indirection of calling
on of fma04, fma08, fma10, or fma16.  Also, note that the
kludge declares these as IMPURE ELEMENTAL because of the
BIND(C) stuff.  This is technically incorrect.

> I don't have much time, but it is likely some of the tricks we used in matmul
> can be used to get this to be "register" implemented .

The correct approach would give interfaces in the
ieee_arithmetic so that argument checking can be
done.  The implementation details would be contained
in trans-intrinsic.c where conv_intrinsic_fma() is
called and __builtin_fma is directly emitted.  Another
approach, where conv_intrinsic_fma() is unneeded,
would be to register __builtin_fma() as builtin function
with gfortran.  This, however, requires more work because
gfortran currently does not have a mechanism for registering
a 3 argument builtin function.

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (10 preceding siblings ...)
  2021-03-04  4:02 ` sgk at troutmask dot apl.washington.edu
@ 2021-12-30  0:36 ` ally.alto.0z at icloud dot com
  2021-12-30  0:44 ` kargl at gcc dot gnu.org
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ally.alto.0z at icloud dot com @ 2021-12-30  0:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

ally.alto.0z at icloud dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ally.alto.0z at icloud dot com

--- Comment #12 from ally.alto.0z at icloud dot com ---
Bill you say you are a “master engineer” and have 25 years of Fortran
experience and are a principal member of a Fortran committee.

Would it be unexpected for someone with that experience to offer a fix
themselves rather than treating this like a free source of labor for their
lucrative support contracts?

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (11 preceding siblings ...)
  2021-12-30  0:36 ` ally.alto.0z at icloud dot com
@ 2021-12-30  0:44 ` kargl at gcc dot gnu.org
  2021-12-30 16:30 ` fxcoudert at gcc dot gnu.org
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: kargl at gcc dot gnu.org @ 2021-12-30  0:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

--- Comment #13 from kargl at gcc dot gnu.org ---
(In reply to ally.alto.0z from comment #12)
> Bill you say you are a “master engineer” and have 25 years of Fortran
> experience and are a principal member of a Fortran committee.
> 
> Would it be unexpected for someone with that experience to offer a fix
> themselves rather than treating this like a free source of labor for their
> lucrative support contracts?

I'm not Bill.  Bill is employed by Cray to work on the Cray Fortran
compiler.  He has been quite helpful in reporting gfortran issues
found either by Cray or by Cray users.

That said, I see that you forgot to attach the patch that you have
developed to fix this issue.  For the record, the patch in comment 
#9 is mine.

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (12 preceding siblings ...)
  2021-12-30  0:44 ` kargl at gcc dot gnu.org
@ 2021-12-30 16:30 ` fxcoudert at gcc dot gnu.org
  2021-12-30 17:15 ` fxcoudert at gcc dot gnu.org
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2021-12-30 16:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |fxcoudert at gcc dot gnu.org
                 CC|                            |fxcoudert at gcc dot gnu.org

--- Comment #14 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Taking this, I have a tentative patch which:
  - declares the interface in libgfortran/ieee/ieee_arithmetic.f90
  - generates direct calls to GCC's FMA built-in in
gcc/fortran/trans-intrinsic.c

This is how we handle many other IEEE intrinsics that don't need to depend on
library support, like IEEE_RINT, IEEE_COPY_SIGN, and others.

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (13 preceding siblings ...)
  2021-12-30 16:30 ` fxcoudert at gcc dot gnu.org
@ 2021-12-30 17:15 ` fxcoudert at gcc dot gnu.org
  2021-12-31 22:24 ` fxcoudert at gcc dot gnu.org
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2021-12-30 17:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

--- Comment #15 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Created attachment 52094
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52094&action=edit
Tentative patch, adding IEEE_FMA and IEEE_SIGNBIT

I am attaching a tentative patch for the issue. I also added IEEE_SIGNBIT while
I was at it, since it was relatively simple. Other new IEEE functions in
Fortran 2018 will be more work.

The patch converts calls to IEEE_FMA and IEEE_SIGNBIT to the GCC builtins of
the same name. For IEEE_FMA, it also works with _Float128, and there it will
generate calls to the fmaq() function in libquadmath.

It generates the right code on simple examples, but I would welcome examples of
test programs that check the output of both IEEE_SIGNBIT and IEEE_FMA on
"interesting" cases.

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (14 preceding siblings ...)
  2021-12-30 17:15 ` fxcoudert at gcc dot gnu.org
@ 2021-12-31 22:24 ` fxcoudert at gcc dot gnu.org
  2022-05-06  8:30 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2021-12-31 22:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (15 preceding siblings ...)
  2021-12-31 22:24 ` fxcoudert at gcc dot gnu.org
@ 2022-05-06  8:30 ` jakub at gcc dot gnu.org
  2023-05-08 12:21 ` rguenth at gcc dot gnu.org
  2023-06-06 12:56 ` fxcoudert at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-06  8:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.0                        |12.2

--- Comment #16 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 12.1 is being released, retargeting bugs to GCC 12.2.

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (16 preceding siblings ...)
  2022-05-06  8:30 ` jakub at gcc dot gnu.org
@ 2023-05-08 12:21 ` rguenth at gcc dot gnu.org
  2023-06-06 12:56 ` fxcoudert at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-05-08 12:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|12.3                        |12.4

--- Comment #18 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.3 is being released, retargeting bugs to GCC 12.4.

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

* [Bug fortran/95644] [F2018] IEEE_FMA is missing from the IEEE_ARITHMETIC module
  2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
                   ` (17 preceding siblings ...)
  2023-05-08 12:21 ` rguenth at gcc dot gnu.org
@ 2023-06-06 12:56 ` fxcoudert at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2023-06-06 12:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95644

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |13.0
   Target Milestone|12.4                        |13.0
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #19 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Not sure why this was not cross-posted here automatically, but it was fixed a
year ago, and part of GCC 13 release:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=7c4c65d11469d29403d5a88316445ec95cd3c3f8


commit 7c4c65d11469d29403d5a88316445ec95cd3c3f8
Author: Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Date:   Wed Aug 31 15:22:50 2022 +0200

    fortran: Add IEEE_SIGNBIT and IEEE_FMA functions

    The functions are added to the IEEE_ARITHMETIC module, but
    are entirely expanded in the front-end, using GCC built-ins.

    2022-08-31  Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>

            PR fortran/95644

    gcc/fortran/
            * f95-lang.cc (gfc_init_builtin_functions): Declare FMA
            built-ins.
            * mathbuiltins.def: Declare FMA built-ins.
            * trans-intrinsic.cc (conv_intrinsic_ieee_fma): New function.
            (conv_intrinsic_ieee_signbit): New function.
            (gfc_build_intrinsic_lib_fndecls): Add cases for FMA and
            SIGNBIT.

    gcc/testsuite/
            * gfortran.dg/ieee/fma_1.f90: New test.
            * gfortran.dg/ieee/signbit_1.f90: New test.

    libgfortran/
            * ieee/ieee_arithmetic.F90: Add IEEE_SIGNBIT and IEEE_FMA.

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

end of thread, other threads:[~2023-06-06 12:56 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 16:55 [Bug fortran/95644] New: IEEE_FMA is missing from the IEEE_ARITHMETIC module longb at cray dot com
2020-06-11 17:50 ` [Bug fortran/95644] " dominiq at lps dot ens.fr
2020-10-02 21:46 ` longb at cray dot com
2020-10-05 19:45 ` [Bug fortran/95644] [F2018] " anlauf at gcc dot gnu.org
2020-10-05 19:50 ` longb at cray dot com
2021-01-22 18:00 ` longb at cray dot com
2021-01-23  3:07 ` jvdelisle at charter dot net
2021-03-03 21:59 ` longb at cray dot com
2021-03-04  0:51 ` kargl at gcc dot gnu.org
2021-03-04  2:04 ` kargl at gcc dot gnu.org
2021-03-04  2:22 ` jvdelisle at gcc dot gnu.org
2021-03-04  4:02 ` sgk at troutmask dot apl.washington.edu
2021-12-30  0:36 ` ally.alto.0z at icloud dot com
2021-12-30  0:44 ` kargl at gcc dot gnu.org
2021-12-30 16:30 ` fxcoudert at gcc dot gnu.org
2021-12-30 17:15 ` fxcoudert at gcc dot gnu.org
2021-12-31 22:24 ` fxcoudert at gcc dot gnu.org
2022-05-06  8:30 ` jakub at gcc dot gnu.org
2023-05-08 12:21 ` rguenth at gcc dot gnu.org
2023-06-06 12:56 ` fxcoudert at gcc dot gnu.org

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