Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 11 Sep 2014 18:04:43 +0300
From: Sergey Dmitrouk <>
To: "" <>
Subject: Re: [PATCH] Make musl math depend less on libgcc builtins

On Thu, Sep 11, 2014 at 07:11:23AM -0700, Szabolcs Nagy wrote:
> musl checks for nan by if(y!=y) and my guess is that this is
> incorrectly done by a signaling comparision

I see

    vcmpe.f64      d0, d0

which seems to be part of "!isfinite(y)" expression, so your guess is
correct ("vcmpe" instruction raises exceptions, "vcmp" doesn't).

I also checked >, <, <= and >=, which Clang implements as "vcmpe" too.
Linaro GCC 4.9 seems to do the correct thing for ARMhf.  So different
targets behave differently, maybe there is no flag to control this...

> i checked on x86_64 and both clang and gcc get comparisions
> wrong in the other direction: they use quite comparisions
> when signaling is needed, eg
> (on a correct implementation ==, != are quiet, but <,>,<=,>=
> raise invalid if any of the operands are nan, on x86_64 the
> quiet instruction is ucomis* and the signaling one is comis*
> and both gcc-4.9 and clang-3.4 seem to use ucomis* for all
> relational operations, may be there is some compiler flag to
> make them behave..)

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.