public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: "Thomas König" <tk@tkoenig.net>
Cc: Toon Moene <toon@moene.org>, <cglwdm@scu.edu.cn>, <fortran@gcc.gnu.org>
Subject: Re: gfortran fp16
Date: Tue, 17 May 2022 12:26:00 +0200	[thread overview]
Message-ID: <26541eb8-0e28-0172-8af8-15dc70f73dff@codesourcery.com> (raw)
In-Reply-To: <836D64F9-FA54-4DB3-BC12-2FA5464EA5EB@tkoenig.net>

On 17.05.22 12:09, Thomas König wrote:
> be might complement to the QP support for POWER in gcc 12, and I have actually thought about doing. The library has its gotchas, though - I do not suppose we can count on fp16 support for trigonometrics and similar, for example,

I think that mostly depends on what the hardware supports and what
has been implemented in the target code.

For instance nvptx supports tanh and ex2 (ex2(a) := 2**a)) for .f16 –
and nvidia.md also contains, e.g. '(define_insn "exp2hf2"' which operates on "HF".

And there is also the following in gcc/builtins.def:

DEF_C99_BUILTIN        (BUILT_IN_ACOSHF, "acoshf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_BUILTIN        (BUILT_IN_ASINHF, "asinhf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_BUILTIN        (BUILT_IN_ATANHF, "atanhf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_COSHF, "coshf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_SINHF, "sinhf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING_ERRNO)
DEF_C99_C90RES_BUILTIN (BUILT_IN_TANHF, "tanhf", BT_FN_FLOAT_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN        (BUILT_IN_CACOSHF, "cacoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN        (BUILT_IN_CASINHF, "casinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN        (BUILT_IN_CATANHF, "catanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN        (BUILT_IN_CCOSHF, "ccoshf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN        (BUILT_IN_CSINHF, "csinhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)
DEF_C99_COMPL_BUILTIN        (BUILT_IN_CTANHF, "ctanhf", BT_FN_COMPLEX_FLOAT_COMPLEX_FLOAT, ATTR_MATHFN_FPROUNDING)

But as said: the basic support for HF-supporting target should be simple,
supporting all the library is more difficult. But the question is whether
full support is needed or not. For 'acoshf' - if it is not available but
used, it is mostly a user problem - which can be fixed by a suitable libm.
I assume that on systems where HF is relevant, libm can be compiled such
that it works.

And in the compiler, you can use '#ifdef HAVE_HFmode' to check whether it exists.

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

  reply	other threads:[~2022-05-17 10:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <13b127cf.c856.180cb531986.Coremail.cglwdm@scu.edu.cn>
2022-05-16  7:51 ` Fwd: " Toon Moene
2022-05-16 10:50   ` Tobias Burnus
2022-05-17 10:09     ` Thomas König
2022-05-17 10:26       ` Tobias Burnus [this message]
2022-05-17 18:33         ` James Cloos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26541eb8-0e28-0172-8af8-15dc70f73dff@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=cglwdm@scu.edu.cn \
    --cc=fortran@gcc.gnu.org \
    --cc=tk@tkoenig.net \
    --cc=toon@moene.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).