From: Qing Zhao <qing.zhao@oracle.com>
To: Jakub Jelinek <jakub@redhat.com>,
Andrew Pinski <pinskia@gmail.com>,
"richard.earnshaw@arm.com" <richard.earnshaw@arm.com>
Cc: gcc Patches <gcc-patches@gcc.gnu.org>,
Richard Sandiford <richard.sandiford@arm.com>
Subject: Re: Should -ffp-contract=off the default on GCC?
Date: Mon, 20 Mar 2023 22:05:57 +0000 [thread overview]
Message-ID: <D897BDFE-58A9-4C0A-AE10-389A07F77232@oracle.com> (raw)
In-Reply-To: <ZBNJlxyrvv9nfswE@tucnak>
Hi,
> On Mar 16, 2023, at 12:53 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>
> On Thu, Mar 16, 2023 at 04:38:41PM +0000, Qing Zhao via Gcc-patches wrote:
>>> NO. We have this debate every few years and such.
>>
>> So, what’s the major reason we keep the default that is not IEEE754 compliant from the beginning?
>
> It is compliant. fusedMultiplyAdd is a standard IEEE 754 operation,
After checking the IEEE754, IEEE standard for Floating-Point Arithmetic, fusedMultiplyAdd is clearly documented:
"
fusedMultiplyAdd: The operation fusedMultiplyAdd(x, y, z) computes (x×y)+z as if with unbounded
range and precision, rounding only once to the destination format.
"
> and
> C explicitly allows contractions.
However, I failed to locate where in C standard the fusedMultiplyAdd is allowed.
I got the draft version of C89, C99 and C11 from the following links:
• C89 – Draft version in ANSI text format: (https://web.archive.org/web/20161223125339/http://flash-gordon.me.uk/ansi.c.txt)
• C89 – Draft version as HTML document: (http://port70.net/~nsz/c/c89/c89-draft.html)
• C99 – Draft version (N1256) as HTML document: (http://port70.net/~nsz/c/c99/n1256.html)
• C11 – Draft version (N1570) as HTML document: (http://port70.net/~nsz/c/c11/n1570.html)
In both C99 and C11, I Only found the following section:
http://port70.net/%7Ensz/c/c99/n1256.html#7.12.13:
====
7.12.13 Floating multiply-add
7.12.13.1 The fma functions
Synopsis
1
#include <math.h>
double fma(double x, double y, double z);
float fmaf(float x, float y, float z);
long double fmal(long double x, long double y,
long double z);
Description
2 The fma functions compute (x y) + z, rounded as one ternary operation: they compute the value (as if) to infinite precision and round once to the result format, according to the current rounding mode. A range error may occur.
Returns
3 The fma functions return (x y) + z, rounded as one ternary operation.
====
My question: is the above section the place in C standard “explicitly allows contractions”? If not, where it is in C standard?
Another question to ARM port maintainers is:
Is fmadd instruction provided by Aarch64 architecture IEEE754 compliant?
Thanks a lot for your help.
Qing
>
> Jakub
>
next prev parent reply other threads:[~2023-03-20 22:06 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 16:24 Qing Zhao
2023-03-16 16:31 ` Andrew Pinski
2023-03-16 16:38 ` Qing Zhao
2023-03-16 16:53 ` Jakub Jelinek
2023-03-16 18:40 ` Qing Zhao
2023-03-20 22:05 ` Qing Zhao [this message]
2023-03-20 22:25 ` Jakub Jelinek
2023-03-21 12:49 ` Qing Zhao
2023-03-21 15:01 ` Qing Zhao
2023-03-21 16:56 ` Paul Koning
2023-03-21 17:00 ` Qing Zhao
2023-03-21 17:59 ` Jeff Law
2023-03-21 18:03 ` Paul Koning
2023-03-21 18:55 ` Toon Moene
2023-03-21 18:12 ` Alexander Monakov
2023-03-21 18:18 ` Jeff Law
2023-03-22 10:13 ` Richard Biener
2023-03-22 12:26 ` Alexander Monakov
2023-03-22 13:57 ` Richard Biener
2023-03-22 15:52 ` Qing Zhao
2023-03-24 7:12 ` Fangrui Song
2023-03-24 19:42 ` Andrew Pinski
2023-03-31 16:31 ` Qing Zhao
2023-03-21 19:01 ` Qing Zhao
2023-03-21 19:12 ` Jakub Jelinek
2023-03-21 23:28 ` Jeff Law
2023-03-21 23:31 ` Jakub Jelinek
2023-03-21 19:51 ` Jeff Law
2023-03-21 21:08 ` Qing Zhao
2023-03-22 12:33 ` Alexander Monakov
2023-03-22 14:33 ` Qing Zhao
2023-03-27 9:03 Zeson
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=D897BDFE-58A9-4C0A-AE10-389A07F77232@oracle.com \
--to=qing.zhao@oracle.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=pinskia@gmail.com \
--cc=richard.earnshaw@arm.com \
--cc=richard.sandiford@arm.com \
/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).