From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua1-x929.google.com (mail-ua1-x929.google.com [IPv6:2607:f8b0:4864:20::929]) by sourceware.org (Postfix) with ESMTPS id 7D4EF385841C for ; Fri, 27 Jan 2023 09:09:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7D4EF385841C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ua1-x929.google.com with SMTP id a40so909249uad.12 for ; Fri, 27 Jan 2023 01:09:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=PKmPDK76+2SUSPPaneXlBrP5pyOzTF32zK9fRlUFP+Y=; b=P5IxHwKSHwsiTB7xnPDg6nH5UXF+F3bSn0f6bQFZGXeJaK+USid0xNvJrHnk0kgdpc kgHnFtdZc/26X9Tn25BORLEVytcs9hgOFqKXe2Eern6WB1UIjrACwjuons6cgfG/Mdm8 oP3h+hlqNmkiXmL2jlyFeQNJ4gC20aOizViQ+BBLfziHxiA9tIQYocqx6z0/VDwQfSjg 6ORQKMUnJU7h/zTs/eryPopoBxgUVlxb9LlPVlQd+IgsciKFdP66aEUe48hG7K8x/FMX GOQKUsUVluNgwlEe/PPVMIUiLv6cvwiTLwOparGmhex+SVAUMG/U+kVluHOlde2qaxEm oCVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PKmPDK76+2SUSPPaneXlBrP5pyOzTF32zK9fRlUFP+Y=; b=5yO4WcVbxa47qP8SBH1TTy4VdqupYYtLzyoumkmecIq5SZeb3KUCaPoZmPANB94Jvf nFAWnJ7VyGEvWK5ncSxMR+yVDlbV2RpzzC53tvEnxcd8dsrdUVQeCnDWHmlyM29RwlCe l7hwXp4gWxGfNYznTbJx6Y5Rr4akE2NNOPrVXFuPkQobiMFML8wnECr6LagZDmLKFLx/ ynLEax327QcmMyX45TO9gz8jw0tbjwOnJbC/jW0VXuxvck8IBRk2mlkxJlvALMdnVHF3 vOfnACjUhV4ywR5baSCN61C7ofsGp+tr/ax1vg8jmTrhjlv/PrXpwgFtRH23L7qT6qXE 8WHg== X-Gm-Message-State: AO0yUKX8/rIcQ14Fsv2yxvHQOgeCF44Sh0xOihRFDqwcVMAf2lCeWOuu YNtr+2LGdOk8dZoRyZw6fqWgpDcTBKOBxXmow06RkRqr X-Google-Smtp-Source: AK7set/WY9NbyhWi/sEb2r+wSv5aLY5IEIrbAxmFbPgYMti1LOE2zMZK0OMZ0/AfFoPBCQSfW1xiQfnSZQ3yEVTKKbo= X-Received: by 2002:ab0:15b0:0:b0:657:6ebc:a2be with SMTP id i45-20020ab015b0000000b006576ebca2bemr1182217uae.64.1674810540648; Fri, 27 Jan 2023 01:09:00 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Kito Cheng Date: Fri, 27 Jan 2023 17:08:49 +0800 Message-ID: Subject: Re: [PATCH] RISC-V: Fix floating-point environment support for soft float To: "Maciej W. Rozycki" Cc: newlib@sourceware.org Content-Type: multipart/alternative; boundary="000000000000576e4805f33b371a" X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --000000000000576e4805f33b371a Content-Type: text/plain; charset="UTF-8" ok, thanks! On Fri, Jan 27, 2023 at 4:53 PM Maciej W. Rozycki wrote: > We don't have floating-point exception or non-default rounding mode > support for the RISC-V soft-float environment, `feraiseexcept' and > `fesetround' do nothing unless the `__riscv_flen' macro has been set. > Therefore following ISO C language requirements[1] only define macros > for soft float that correspond to actually supported floating-point > environment features, removing failures from GCC testing such as: > > FAIL: gcc.dg/torture/fp-int-convert-timode-3.c -O0 execution test > FAIL: gcc.dg/torture/fp-int-convert-timode-4.c -O0 execution test > > References: > > [1] "Programming languages -- C", ISO/IEC 9899:2023, working draft -- > September 3, 2022, Section 7.6 "Floating-point environment " > > Fixes: 7040b2de0883 ("Add RISC-V port for libm") > Signed-off-by: Maciej W. Rozycki > --- > newlib/libc/machine/riscv/sys/fenv.h | 9 +++++++++ > 1 file changed, 9 insertions(+) > > newlib-riscv-fenv-soft-float.diff > Index: newlib/newlib/libc/machine/riscv/sys/fenv.h > =================================================================== > --- newlib.orig/newlib/libc/machine/riscv/sys/fenv.h > +++ newlib/newlib/libc/machine/riscv/sys/fenv.h > @@ -14,6 +14,8 @@ > > #include > > +#if __riscv_flen > + > /* Per "The RISC-V Instruction Set Manual: Volume I: User-Level ISA: > * Version 2.1", Section 8.2, "Floating-Point Control and Status > * Register": > @@ -69,6 +71,13 @@ > * floating-point unit." > */ > > +#else /* !__riscv_flen */ > + > +#define FE_ALL_EXCEPT 0x00000000 > +#define FE_TONEAREST 0x00000000 > + > +#endif /* !__riscv_flen */ > + > typedef size_t fenv_t; > typedef size_t fexcept_t; > extern const fenv_t fe_dfl_env; > --000000000000576e4805f33b371a--