public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Schmidt <crux@starsky.Informatik.RWTH-Aachen.DE>
To: Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>
Cc: egcs@cygnus.com, kenner@vlsi1.ultra.nyu.edu
Subject: Re: another IEE related problem
Date: Wed, 10 Dec 1997 03:32:00 -0000	[thread overview]
Message-ID: <Pine.SOL.3.90.971210122825.25453C-100000@starsky.informatik.rwth-aachen.de> (raw)
In-Reply-To: <x7wwi4i73i.fsf@myware.rz.uni-karlsruhe.de>

> 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
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[the fabs statement is missing]

This is a bug in the combiner. When trying to simplify an
(ABS:SF (ASM_OPERANDS ...)) expression it thinks that the ASM_OPERANDS is
always positive.
This can be fixed with the patch I have appended.

> Another bug preventing the glibc test suite to be passed.

Ulrich, do you have more unsolved bugs that affect glibc?

Bernd

*** ./combine.c.orig-1	Tue Dec  9 10:53:39 1997
--- ./combine.c	Tue Dec  9 10:55:52 1997
*************** simplify_rtx (x, op0_mode, last, in_dest
*** 4092,4101 ****
      case XOR:
        return simplify_logical (x, last);
  
!     case ABS:
        /* (abs (neg <foo>)) -> (abs <foo>) */
        if (GET_CODE (XEXP (x, 0)) == NEG)
  	SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0));
  
        /* If operand is something known to be positive, ignore the ABS.  */
        if (GET_CODE (XEXP (x, 0)) == FFS || GET_CODE (XEXP (x, 0)) == ABS
--- 4092,4106 ----
      case XOR:
        return simplify_logical (x, last);
  
!     case ABS:      
        /* (abs (neg <foo>)) -> (abs <foo>) */
        if (GET_CODE (XEXP (x, 0)) == NEG)
  	SUBST (XEXP (x, 0), XEXP (XEXP (x, 0), 0));
+ 
+       /* If the mode of the operand is VOIDmode (i.e. if it is ASM_OPERANDS),
+          do nothing.  */
+       if (GET_MODE (XEXP (x, 0)) == VOIDmode)
+ 	break;
  
        /* If operand is something known to be positive, ignore the ABS.  */
        if (GET_CODE (XEXP (x, 0)) == FFS || GET_CODE (XEXP (x, 0)) == ABS

  reply	other threads:[~1997-12-10  3:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-11-19 19:21 Ulrich Drepper
1997-12-10  3:32 ` Bernd Schmidt [this message]
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=Pine.SOL.3.90.971210122825.25453C-100000@starsky.informatik.rwth-aachen.de \
    --to=crux@starsky.informatik.rwth-aachen.de \
    --cc=drepper@ipd.info.uni-karlsruhe.de \
    --cc=egcs@cygnus.com \
    --cc=kenner@vlsi1.ultra.nyu.edu \
    /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).