From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27565 invoked from network); 13 Aug 2021 18:32:47 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 13 Aug 2021 18:32:47 -0000 Received: (qmail 9446 invoked by uid 550); 13 Aug 2021 18:32:46 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 9428 invoked from network); 13 Aug 2021 18:32:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexgo.de; s=vfde-smtpout-mb-15sep; t=1628879554; bh=kv2aKfSc7Gc7ZdpJgut84+b2xzy93Air0NYlPN5bbSY=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=Yerjg66qDe45ZDDsyYpgknPSmRudXqZYyDGL9gTl5sTlmRa1cup1RXmDFl+B//V8l N9m3TttCJ9sbEYwvVjnSxF6N4YHxU15StAdEtI/XotouwzHE7mVsnAjssliVPXa7mg ejRW4BBj1VgFJRw3c+4F+7tJv3eLjsbmabgyds4E= Message-ID: From: "Stefan Kanthak" To: "Rich Felker" Cc: "Szabolcs Nagy" , References: <0C6AAAD55DA44C6189B2FF4F5FB2C3E7@H270> <20210810213455.GB37904@port70.net> <20210813155917.GE13220@brightrain.aerifal.cx> In-Reply-To: <20210813155917.GE13220@brightrain.aerifal.cx> Date: Fri, 13 Aug 2021 20:30:00 +0200 Organization: Me, myself & IT MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Windows Mail 6.0.6002.18197 X-MimeOLE: Produced By Microsoft MimeOLE V6.1.7601.24158 X-purgate-type: clean X-purgate-Ad: Categorized by eleven eXpurgate (R) http://www.eleven.de X-purgate: This mail is considered clean (visit http://www.eleven.de for further information) X-purgate: clean X-purgate-size: 1964 X-purgate-ID: 155817::1628879553-0000752D-76DBF9F8/0/0 Subject: Re: [musl] [PATCH #2] Properly simplified nextafter() Rich Felker wrote: > On Fri, Aug 13, 2021 at 02:04:51PM +0200, Stefan Kanthak wrote: >> Szabolcs Nagy wrote on 2021-08-10 at 23:34: >> >> >* Stefan Kanthak [2021-08-10 08:23:46 +0200]: >> >> >> >> has quite some superfluous statements: >> >> >> >> 1. there's absolutely no need for 2 uint64_t holding |x| and |y|; >> >> 2. IEEE-754 specifies -0.0 == +0.0, so (x == y) is equivalent to >> >> (ax == 0) && (ay == 0): the latter 2 tests can be removed; >> > >> > you replaced 4 int cmps with 4 float cmps (among other things). >> > >> > it's target dependent if float compares are fast or not. >> >> It's also target dependent whether the FP additions and multiplies >> used to raise overflow/underflow are SLOOOWWW: how can you justify >> them, especially for targets using soft-float? > > On a target with fenv, raising the exception flags is mandatory and > something must be done to make that happen. Performing the arithmetic > is far faster than prodding at the status flag registers explicitly. I did NOT propose the latter; I just questioned whether/why you use two multiplications to detect underflow. JFTR: FORCE_EVAL(dummy+0.0); raises both overflow and underflow, without multiplication. > On a target without fenv (all the existing soft float targets), it > should be valid for the compiler just not to emit them, since they > have no side effects. I think we could make FORCE_EVAL expand to > nothing on such targets (if the FE_* macros are not defined). This is > probably worth doing. Correct, that's the right thing to do there. [ buggy compiler ] > It may be possible to reduce the number of such ops too; not sure. But > there's no way to eliminate them. It's definitely possible to do a strength reduction and get rid of the multiplications. Stefan