mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Sergey Dmitrouk <sdmitrouk@accesssoftek.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: Re: [PATCH] Make musl math depend less on libgcc builtins
Date: Thu, 11 Sep 2014 18:04:43 +0300	[thread overview]
Message-ID: <20140911150443.GA5896@zx-spectrum> (raw)
In-Reply-To: <20140911141123.GL21835@port70.net>

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
> 
> http://goo.gl/GsdpZA
> 
> (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..)


  reply	other threads:[~2014-09-11 15:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-11  7:35 Sergey Dmitrouk
2014-09-11  9:47 ` Szabolcs Nagy
2014-09-11 11:42   ` Sergey Dmitrouk
2014-09-11 12:26     ` Szabolcs Nagy
2014-09-11 13:22       ` Sergey Dmitrouk
2014-09-11 14:11         ` Szabolcs Nagy
2014-09-11 15:04           ` Sergey Dmitrouk [this message]
2014-09-11 15:14           ` Alexander Monakov
2014-09-11 15:34             ` Szabolcs Nagy
2014-09-18 14:28           ` Sergey Dmitrouk
2014-09-18 17:55             ` Szabolcs Nagy
2014-09-18 19:21               ` Sergey Dmitrouk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140911150443.GA5896@zx-spectrum \
    --to=sdmitrouk@accesssoftek.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).