Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 27 Feb 2019 19:32:01 +0300 (MSK)
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Subject: Re: FE Exception triggered by comparison

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)

Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.