public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Torbjorn SVENSSON <torbjorn.svensson@st.com>
To: Andrea Corallo <andrea.corallo@arm.com>,
	"newlib@sourceware.org" <newlib@sourceware.org>
Cc: "nd@arm.com" <nd@arm.com>
Subject: RE: [PATCH] Aarch32/64: Support __FLT_EVAL_METHOD__ values other than 0, 1, 2
Date: Mon, 4 Apr 2022 09:32:41 +0000	[thread overview]
Message-ID: <AM6PR10MB219782B2F7F7A1264D56EEA181E59@AM6PR10MB2197.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <gkr8rsl9r9e.fsf@arm.com>

Hello,

It would have been easier to review the patch if it was inline, but this will have to do anyway.
I think there is a typo in math.h. Aren't you supposed to do "#ifndef" and not "#ifdef"?

Kind regards,
Torbjörn


ST Restricted

-----Original Message-----
From: Newlib <newlib-bounces+torbjorn.svensson=st.com@sourceware.org> On Behalf Of Andrea Corallo
Sent: den 4 april 2022 10:39
To: newlib@sourceware.org
Cc: nd@arm.com
Subject: [PATCH] Aarch32/64: Support __FLT_EVAL_METHOD__ values other than 0, 1, 2

Hi all,

when _Float16 in native precision is supported GCC defines
__FLT_EVAL_METHOD__ to 16 as per ISO/IEC TS 18661-3.

Ex:

$ ./arm-none-eabi-gcc -mthumb -march=armv8.1-m.main+fp  -mfloat-abi=softfp -xc /dev/null -E -dM | grep FLT_EVAL
#define __FLT_EVAL_METHOD__ 16
#define __FLT_EVAL_METHOD_TS_18661_3__ 16

Unfortunately libc/include/math.h understands only values 0, 1 and 2
leading to have newlib non compilable for those configurations.

I think in newlib we should either:

1- Handle __FLT_EVAL_METHOD__ == 16
2- Build in a C mode which does not enable _Float16 (ex -std=c11)
3- Build without the _FloatN extensions -fpermitted-flt-eval-methods=c11

I think 1 should be the favorite approach.

ISO/IEC 9899:201x [1] suggests that for other values of FLT_EVAL_METHOD
other than 0, 1, 2 the definition of float_t and double_t is
implementation-defined.

The suggested patch implements that for arm and Aarch64.

Note, some previous discussion on this topic can be found here [2] as
follow-up to a patch addressing the same issue (only for the
case__FLT_EVAL_METHOD__ == 16 case).

Best Regards

  Andrea

[1] <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf>
[2] <https://sourceware.org/legacy-ml/newlib/2019/msg00597.html>


  reply	other threads:[~2022-04-04  9:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-04  8:39 Andrea Corallo
2022-04-04  9:32 ` Torbjorn SVENSSON [this message]
2022-04-04 14:53   ` [PATCH V2] " Andrea Corallo
2022-04-04 15:12     ` Torbjorn SVENSSON
2022-04-08 10:09     ` Richard Earnshaw
2022-04-08 21:22       ` Jeff Johnston
2022-04-11 13:52         ` [PATCH V3] " Andrea Corallo
2022-04-11 16:01           ` Jeff Johnston

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=AM6PR10MB219782B2F7F7A1264D56EEA181E59@AM6PR10MB2197.EURPRD10.PROD.OUTLOOK.COM \
    --to=torbjorn.svensson@st.com \
    --cc=andrea.corallo@arm.com \
    --cc=nd@arm.com \
    --cc=newlib@sourceware.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).