From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/13890 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: FE Exception triggered by comparison Date: Wed, 27 Feb 2019 18:08:53 +0100 Message-ID: <20190227170853.GF21289@port70.net> References: <20190224210438.6980bd87@inria.fr> <20190225155109.GB28106@voyager> <20190227164225.GV23599@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="189984"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) To: musl@lists.openwall.com Original-X-From: musl-return-13906-gllmg-musl=m.gmane.org@lists.openwall.com Wed Feb 27 18:09:08 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1gz2hf-000nHu-71 for gllmg-musl@m.gmane.org; Wed, 27 Feb 2019 18:09:07 +0100 Original-Received: (qmail 14146 invoked by uid 550); 27 Feb 2019 17:09:05 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 14128 invoked from network); 27 Feb 2019 17:09:05 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20190227164225.GV23599@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:13890 Archived-At: * Rich Felker [2019-02-27 11:42:25 -0500]: > On Wed, Feb 27, 2019 at 07:32:01PM +0300, Alexander Monakov wrote: > > On Thu, 28 Feb 2019, Damian McGuckin wrote: > > > > > > Hm, no, for x86 with GCC you should not see that: the compiler knows how to > > > > expand isnan efficiently. Are you perhaps on OS X and the 'gcc' command > > > > actually invokes Clang/LLVM? > > > > > > No. > > > > > > > If not, can you show output of 'gcc -v', command-line flags you used, and > > > > the assembly you're seeing? > > > > > > gcc -O3 -S -msse4.2 -mfma mynan.c > > > > Ah, in this case you're falling victim of a problem in your Glibc version: > > while GCC is sufficiently new to know how to expand isnan efficiently, > > Glibc math.h defines isnan as a macro that redirects to __isnan that GCC > > does not recognize. Newer Glibc versions use __builtin_isnan where suitable, > > which leads to optimal assembly. > > > > (musl does not use this builtin, expanding the macro to a bit test instead) > > Are there reasons we should perhaps use the __builtin versions of > these when __GNUC__ indicates they're available? I like our bit test > versions we have now, and I think they're sufficiently efficient, but > I'm open to changes if there's a good reason. yeah, a target may have slow fpreg->greg moves to do the bit checks, but fast single instruction check on the fpreg and then the builtin would be preferred.