This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: another IEE related problem
- To: Ulrich Drepper <drepper at ipd dot info dot uni-karlsruhe dot de>
- Subject: Re: another IEE related problem
- From: Bernd Schmidt <crux at starsky dot Informatik dot RWTH-Aachen dot DE>
- Date: Wed, 10 Dec 1997 12:31:43 +0100 (MET)
- cc: egcs at cygnus dot com, kenner at vlsi1 dot ultra dot nyu dot edu
- Reply-To: egcs at cygnus dot com
> 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