public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: Kito Cheng <kito.cheng@sifive.com>,
	newlib@sourceware.org, kito.cheng@gmail.com
Cc: Jesse Huang <jesse.huang@sifive.com>
Subject: Re: [PATCH] RISC-V: Support Zfinx/Zdinx extension.
Date: Tue, 10 Oct 2023 07:26:16 +0200	[thread overview]
Message-ID: <9a1432c3-9fe7-4389-bf48-927ad22e8935@embedded-brains.de> (raw)
In-Reply-To: <20230726100319.45915-1-kito.cheng@sifive.com>

On 26.07.23 12:03, Kito Cheng via Newlib wrote:
> Zfinx/Zdinx are new extensions ratified in 2022, it similar to F/D 
> extensions, support hard float operation for single/double precision, 
> but the difference between Zfinx/Zdinx and F/D is Zfinx/Zdinx is 
> operating under general purpose registers rather than dedicated 
> floating-point registers. This patch improve the hard float support 
> detection for RISC-V port, so that Zfinx/Zdinx can have better/right 
> performance. Co-authored-by: Jesse Huang <jesse.huang@sifive.com>

This patch probably broke the RTEMS build of Newlib:

../../../../../gnu-mirror-gcc-d04fe55/newlib/libm/machine/riscv/fesetround.c: 
In function 'fesetround':
../../../../../gnu-mirror-gcc-d04fe55/newlib/libm/machine/riscv/fesetround.c:56:12: 
error: 'FE_RMODE_MASK' undeclared (first use in this function)
    56 |   round &= FE_RMODE_MASK;
       |            ^~~~~~~~~~~~~
../../../../../gnu-mirror-gcc-d04fe55/newlib/libm/machine/riscv/fesetround.c:56:12: 
note: each undeclared identifier is reported only once for each function 
it appears in
make[6]: *** [Makefile:48845: libm/machine/riscv/libm_a-fesetround.o] 
Error 1
make[6]: *** Waiting for unfinished jobs....
../../../../../gnu-mirror-gcc-d04fe55/newlib/libm/complex/cprojl.c: In 
function 'cprojl':
../../../../../gnu-mirror-gcc-d04fe55/newlib/libm/complex/cprojl.c:60:18: 
warning: implicit declaration of function 'copysignl'; did you mean 
'copysignf'? [-Wimplicit-function-declaration]
    60 |   IMAG_PART(w) = copysignl(0.0L, cimagl(z));
       |                  ^~~~~~~~~
       |                  copysignf
make[6]: Leaving directory 
'/tmp/sh/b-rsb/riscv-rtems6-gcc-d04fe55-newlib-fe5886a-x86_64-linux-gnu-1/build/riscv-rtems6/rv32imaf/ilp32f/newlib'

We have

#if defined(__riscv_f) || defined(__riscv_zfinx)

[...]

/* Per "The RISC-V Instruction Set Manual: Volume I: User-Level ISA:
  * Version 2.1", Section 8.2, "Floating-Point Control and Status
  * Register":
  *
  * Rounding Mode  Mnemonic Meaning  Meaning
  * -------------  ----------------  -------
  * 000            RNE               Round to Nearest, ties to Even
  * 001            RTZ               Round towards Zero
  * 010            RDN               Round Down (towards −∞)
  * 011            RUP               Round Up (towards +∞)
  * 100            RMM               Round to Nearest, ties to Max Magnitude
  * 101                              Invalid. Reserved for future use.
  * 110                              Invalid. Reserved for future use.
  * 111                              In instruction’s rm field, selects 
dynamic rounding mode;
  *                                  In Rounding Mode register, Invalid
  */

#define FE_TONEAREST_MM 0x00000004
#define FE_UPWARD     	0x00000003
#define FE_DOWNWARD   	0x00000002
#define FE_TOWARDZERO 	0x00000001
#define FE_TONEAREST  	0x00000000

#define FE_RMODE_MASK   0x7

vs.

int fesetround(int round)
{

#ifdef __RISCV_HARD_FLOAT

   /* Mask round to be sure only valid rounding bits are set */

   round &= FE_RMODE_MASK;

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

      parent reply	other threads:[~2023-10-10  5:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 10:03 Kito Cheng
2023-07-26 13:27 ` Corinna Vinschen
2023-10-10  5:26 ` Sebastian Huber [this message]

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=9a1432c3-9fe7-4389-bf48-927ad22e8935@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=jesse.huang@sifive.com \
    --cc=kito.cheng@gmail.com \
    --cc=kito.cheng@sifive.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).