another IEE related problem
Bernd Schmidt
crux@starsky.Informatik.RWTH-Aachen.DE
Wed Dec 10 03:32:00 GMT 1997
> 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
More information about the Gcc
mailing list