* [PATCH] Document -fexcess-precision=16.
@ 2024-03-18 10:55 liuhongt
2024-03-18 16:16 ` Joseph Myers
0 siblings, 1 reply; 6+ messages in thread
From: liuhongt @ 2024-03-18 10:55 UTC (permalink / raw)
To: gcc-patches; +Cc: crazylht, hjl.tools
Ok for trunk?
gcc/ChangeLog:
* doc/invoke.texi: Document -fexcess-precision=16.
---
gcc/doc/invoke.texi | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 85c938d4a14..673420fdd3e 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -14930,6 +14930,9 @@ assignments). This option is enabled by default for C or C++ if a strict
conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
@option{-ffast-math} enables @option{-fexcess-precision=fast} by default
regardless of whether a strict conformance option is used.
+If @option{-fexcess-precision=16} is specified, casts and assignments of
+@code{_Float16} and @code{bfloat16_t} cause value to be rounded to their
+semantic types if they're supported by the target.
@opindex mfpmath
@option{-fexcess-precision=standard} is not implemented for languages
--
2.31.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Document -fexcess-precision=16.
2024-03-18 10:55 [PATCH] Document -fexcess-precision=16 liuhongt
@ 2024-03-18 16:16 ` Joseph Myers
2024-03-19 0:58 ` Hongtao Liu
0 siblings, 1 reply; 6+ messages in thread
From: Joseph Myers @ 2024-03-18 16:16 UTC (permalink / raw)
To: liuhongt; +Cc: gcc-patches, crazylht, hjl.tools
On Mon, 18 Mar 2024, liuhongt wrote:
> +If @option{-fexcess-precision=16} is specified, casts and assignments of
> +@code{_Float16} and @code{bfloat16_t} cause value to be rounded to their
> +semantic types if they're supported by the target.
Isn't that option about rounding results of all operations, whether or not
a cast or assignment is involved? That's certainly what the brief mention
of this option in extend.texi says, and fits the intent that
-fexcess-precision=16 corresponds to FLT_EVAL_METHOD == 16.
--
Joseph S. Myers
josmyers@redhat.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Document -fexcess-precision=16.
2024-03-18 16:16 ` Joseph Myers
@ 2024-03-19 0:58 ` Hongtao Liu
2024-03-19 19:56 ` Joseph Myers
0 siblings, 1 reply; 6+ messages in thread
From: Hongtao Liu @ 2024-03-19 0:58 UTC (permalink / raw)
To: Joseph Myers; +Cc: liuhongt, gcc-patches, hjl.tools
On Tue, Mar 19, 2024 at 12:16 AM Joseph Myers <josmyers@redhat.com> wrote:
>
> On Mon, 18 Mar 2024, liuhongt wrote:
>
> > +If @option{-fexcess-precision=16} is specified, casts and assignments of
> > +@code{_Float16} and @code{bfloat16_t} cause value to be rounded to their
> > +semantic types if they're supported by the target.
>
> Isn't that option about rounding results of all operations, whether or not
> a cast or assignment is involved? That's certainly what the brief mention
> of this option in extend.texi says, and fits the intent that
> -fexcess-precision=16 corresponds to FLT_EVAL_METHOD == 16.
Yes, how about this.
+If @option{-fexcess-precision=16} is specified, each operation of
+@code{_Float16} and @code{bfloat16_t} causes value to be rounded to their
+semantic types if they're supported by the target.
>
> --
> Joseph S. Myers
> josmyers@redhat.com
>
--
BR,
Hongtao
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Document -fexcess-precision=16.
2024-03-19 0:58 ` Hongtao Liu
@ 2024-03-19 19:56 ` Joseph Myers
2024-03-20 1:09 ` [PATCH V2] " liuhongt
0 siblings, 1 reply; 6+ messages in thread
From: Joseph Myers @ 2024-03-19 19:56 UTC (permalink / raw)
To: Hongtao Liu; +Cc: liuhongt, gcc-patches, hjl.tools
[-- Attachment #1: Type: text/plain, Size: 1619 bytes --]
On Tue, 19 Mar 2024, Hongtao Liu wrote:
> On Tue, Mar 19, 2024 at 12:16 AM Joseph Myers <josmyers@redhat.com> wrote:
> >
> > On Mon, 18 Mar 2024, liuhongt wrote:
> >
> > > +If @option{-fexcess-precision=16} is specified, casts and assignments of
> > > +@code{_Float16} and @code{bfloat16_t} cause value to be rounded to their
> > > +semantic types if they're supported by the target.
> >
> > Isn't that option about rounding results of all operations, whether or not
> > a cast or assignment is involved? That's certainly what the brief mention
> > of this option in extend.texi says, and fits the intent that
> > -fexcess-precision=16 corresponds to FLT_EVAL_METHOD == 16.
> Yes, how about this.
>
>
> +If @option{-fexcess-precision=16} is specified, each operation of
> +@code{_Float16} and @code{bfloat16_t} causes value to be rounded to their
> +semantic types if they're supported by the target.
I'm sure sure it's quite right to say the operation causes the value to be
rounded, considering it's results not arguments that are rounded, and from
the user perspective the rounding is an implementation detail, it's just
computing the results in the semantic type. So maybe more like:
If @option{-fexcess-precision=16} is specified, constants and the
results of expressions with types @code{_Float16} and @code{__bf16}
are computed without excess precision.
(Also, I've suggested there to use the built-in type name __bf16; the name
__bfloat16 from avx512bf16vlintrin.h would also be a possibility. As far
as I know, the bfloat16_t name is only in C++.)
--
Joseph S. Myers
josmyers@redhat.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH V2] Document -fexcess-precision=16.
2024-03-19 19:56 ` Joseph Myers
@ 2024-03-20 1:09 ` liuhongt
2024-03-20 21:10 ` Joseph Myers
0 siblings, 1 reply; 6+ messages in thread
From: liuhongt @ 2024-03-20 1:09 UTC (permalink / raw)
To: gcc-patches; +Cc: josmyers
gcc/ChangeLog:
* doc/invoke.texi: Document -fexcess-precision=16.
---
gcc/doc/invoke.texi | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 85c938d4a14..6bc1ebf9721 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -14930,6 +14930,9 @@ assignments). This option is enabled by default for C or C++ if a strict
conformance option such as @option{-std=c99} or @option{-std=c++17} is used.
@option{-ffast-math} enables @option{-fexcess-precision=fast} by default
regardless of whether a strict conformance option is used.
+If @option{-fexcess-precision=16} is specified, constants and the
+results of expressions with types @code{_Float16} and @code{__bf16}
+are computed without excess precision.
@opindex mfpmath
@option{-fexcess-precision=standard} is not implemented for languages
--
2.31.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH V2] Document -fexcess-precision=16.
2024-03-20 1:09 ` [PATCH V2] " liuhongt
@ 2024-03-20 21:10 ` Joseph Myers
0 siblings, 0 replies; 6+ messages in thread
From: Joseph Myers @ 2024-03-20 21:10 UTC (permalink / raw)
To: liuhongt; +Cc: gcc-patches
On Wed, 20 Mar 2024, liuhongt wrote:
> gcc/ChangeLog:
>
> * doc/invoke.texi: Document -fexcess-precision=16.
OK.
--
Joseph S. Myers
josmyers@redhat.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-03-20 21:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18 10:55 [PATCH] Document -fexcess-precision=16 liuhongt
2024-03-18 16:16 ` Joseph Myers
2024-03-19 0:58 ` Hongtao Liu
2024-03-19 19:56 ` Joseph Myers
2024-03-20 1:09 ` [PATCH V2] " liuhongt
2024-03-20 21:10 ` Joseph Myers
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).