From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id AAB8F3858D1E for ; Fri, 1 Sep 2023 21:32:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AAB8F3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="6.02,220,1688457600"; d="scan'208";a="18001694" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 01 Sep 2023 13:32:26 -0800 IronPort-SDR: snVbOfQz6jXCjfYoCIgujfOmyei/fWcBEK5h1owxFk4Lt5ftBPoqAOBZuxE7X/uoEoBQgDzHWD k1VHpaofjy4X7lX56/YYutfQU5oAjXcLmf9ufdScmPWZDd/cGhBbX9Mtqjkg4RYo2VI2Hqg9W/ HTF4vxRv/0mEVy3RpN4pjrvMLm+9SM+5rFj6Z5WReyTtCVHNyQ0IpucSE94ZUUOE6dxwxxM4TQ A5UFwup+KUviuwrKkppR5v+bioNqYjE1PquOhbzx/pL9tFighdglgjxklh0mHS2UZF3oW+yeGj YX4= Date: Fri, 1 Sep 2023 21:32:22 +0000 From: Joseph Myers To: Jakub Jelinek CC: Richard Biener , Subject: Re: [PATCH 14/12] libgcc _BitInt helper documentation [PR102989] In-Reply-To: Message-ID: <4746d3d-c45f-abf-c31d-6c3aa91e315@codesourcery.com> References: <409a2da3-1c2d-e62-6f7-8a3ec74871c7@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3104.6 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, 22 Aug 2023, Jakub Jelinek via Gcc-patches wrote: > +significant limb if @var{N} is not divisible by @var{N} should be @var{n}, throughout. > +@deftypefn {Runtime Function} void __bid_fixsdbitint (@code{UBILtype} *@var{r}, int32_t @var{rprec}, _Decimal32 @var{a}) > +@deftypefnx {Runtime Function} void __bid_fixddbitint (@code{UBILtype} *@var{r}, int32_t @var{rprec}, _Decimal64 @var{a}) > +@deftypefnx {Runtime Function} void __bid_fixtdbitint (@code{UBILtype} *@var{r}, int32_t @var{rprec}, _Decimal128 @var{a}) > +These functions convert @var{a} to bit-precise integer @var{r}, rounding toward zero. > +If @var{rprec} is positive, it converts to unsigned bit-precise integer and > +negative values all become zero, if @var{rprec} is negative, it converts > +to signed bit-precise integer. > +@end deftypefn > + > +@deftypefn {Runtime Function} _Decimal32 __bid_floatbitintsd (@code{UBILtype} *@var{i}, int32_t @var{iprec}) > +@deftypefnx {Runtime Function} _Decimal64 __bid_floatbitintdd (@code{UBILtype} *@var{i}, int32_t @var{iprec}) > +@deftypefnx {Runtime Function} _Decimal128 __bid_floatbitinttd (@code{UBILtype} *@var{i}, int32_t @var{iprec}) > +These functions convert bit-precise integer @var{i} to decimal floating point. If > +@var{iprec} is positive, it is conversion from unsigned bit-precise integer, > +otherwise from signed bit-precise integer. > +@end deftypefn The documentation for __bid_* should say explicitly that these functions are for BID format (assuming it's intended that functions for DPD format should use __dpd_* when support is added for an architecture using DPD). > +/* Common final part of __fix?fbitint conversion functions. > + The A floating point value should have been converted using > + soft-fp macros into RV, U##DI##type DI##_BITS precise normal > + integral type and SHIFT, how many bits should that value be > + shifted to the left. R is pointer to limbs array passed to the > + function, RN number of limbs in it, ARPREC absolute value of > + RPREC argument passed to it, RSIZE number of significant bits in RV. > + RSIGNED is non-zero if the result is signed bit-precise integer, > + otherwise zero. If OVF is true, instead of storing RV shifted left > + by SHIFT bits and zero or sign extended store minimum or maximum > + of the signed or unsigned bit-precise integer type depending on if > + RV contains the minimum or maximum signed or unsigned value. */ As I understand it, OVF is also for the case of a zero result from input close to zero, for signed types (when that's not the maximum or minimum) in addition to unsigned types. > +/* Common initial part of __floatbitint?f conversion functions. > + I and IPREC are arguments passed to those functions, convert that > + into a pair of DI##type IV integer and SHIFT, such that converting > + IV to floating point and multiplicating that by pow (2, SHIFT) > + gives the expected result. IV size needs to be chosen such that > + it is large than number of bits in floating-point mantissa and "large than" -> "larger than". This patch is OK with those fixes. -- Joseph S. Myers joseph@codesourcery.com