public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>
To: egcs@cygnus.com
Subject: another IEE related problem
Date: Wed, 19 Nov 1997 19:21:00 -0000	[thread overview]
Message-ID: <x7wwi4i73i.fsf@myware.rz.uni-karlsruhe.de> (raw)

Hi,

Compiling this little piece of code on a ix86 machine

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
extern inline float
bar (float x)
{
  float res;
  asm ("fsqrt" : "=t" (res) : "0" (x));
  return res;
}
extern float fabsf (float);

float
foo (float x)
{
  float res = fabsf (bar (x));
  return res;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The generated code with -O3 -momit-leaf-frame-pointer

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo:
        flds 4(%esp)
#APP
        fsqrt
#NO_APP
        ret
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is wrong.  In the real code I added the `fabs' in full knowledge
of the situation.  The problem is that according to IEEE

	sqrt(-0.0) == -0.0

and so I get a wrong result.  I don't know why gcc thinks the
fabs call is redundant (it should not be able to analyze the asm
statement) but in any case it is plainly wrong.

Another bug preventing the glibc test suite to be passed.

-- Uli
---------------.      drepper at gnu.org  ,-.   Rubensstrasse 5
Ulrich Drepper  \    ,-------------------'   \  76149 Karlsruhe/Germany
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

             reply	other threads:[~1997-11-19 19:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-19 19:21 Ulrich Drepper [this message]
1997-12-10  3:32 ` Bernd Schmidt
1997-12-10  7:26   ` Ulrich Drepper
1997-12-10 10:58   ` Ulrich Drepper
1997-12-10 19:56   ` Jeffrey A Law
1997-12-10 19:28     ` Ulrich Drepper

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=x7wwi4i73i.fsf@myware.rz.uni-karlsruhe.de \
    --to=drepper@ipd.info.uni-karlsruhe.de \
    --cc=egcs@cygnus.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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).