re PR rtl-optimization/9258 (ICE in compensate_edge, at reg-stack.c:2589)
PR f/9258 * global.c (struct allocno): Add no_stack_reg. (global_conflicts): Set no_stack_reg. (find_reg): Use it. * convert.c (convert_to_real): Fold - and abs only when profitable. * fold-const.c (fold): Fold truncates in - and abs. * gcc.c-torture/compile/20030115-1.c: New test. * gcc.dg/i386-fpcvt-1.c: New test. * gcc.dg/i386-fpcvt-2.c: New test. From-SVN: r61329
This commit is contained in:
parent
d18c7e595f
commit
b1a6f8db64
@ -1,3 +1,13 @@
|
||||
Wed Jan 15 12:23:21 CET 2003 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR f/9258
|
||||
* global.c (struct allocno): Add no_stack_reg.
|
||||
(global_conflicts): Set no_stack_reg.
|
||||
(find_reg): Use it.
|
||||
|
||||
* convert.c (convert_to_real): Fold - and abs only when profitable.
|
||||
* fold-const.c (fold): Fold truncates in - and abs.
|
||||
|
||||
2003-01-15 Josef Zlomek <zlomekj@suse.cz>
|
||||
|
||||
Segher Boessenkool <segher@koffie.nl>
|
||||
|
@ -229,9 +229,11 @@ convert_to_real (type, expr)
|
||||
/* convert (float)-x into -(float)x. This is always safe. */
|
||||
case ABS_EXPR:
|
||||
case NEGATE_EXPR:
|
||||
return build1 (TREE_CODE (expr), type,
|
||||
fold (convert_to_real (type,
|
||||
TREE_OPERAND (expr, 0))));
|
||||
if (TYPE_PRECISION (type) < TYPE_PRECISION (TREE_TYPE (expr)))
|
||||
return build1 (TREE_CODE (expr), type,
|
||||
fold (convert_to_real (type,
|
||||
TREE_OPERAND (expr, 0))));
|
||||
break;
|
||||
/* convert (outertype)((innertype0)a+(innertype1)b)
|
||||
into ((newtype)a+(newtype)b) where newtype
|
||||
is the widest mode from all of these. */
|
||||
|
@ -5035,6 +5035,15 @@ fold (expr)
|
||||
}
|
||||
else if (TREE_CODE (arg0) == NEGATE_EXPR)
|
||||
return TREE_OPERAND (arg0, 0);
|
||||
/* Convert -((double)float) into (double)(-float). */
|
||||
else if (TREE_CODE (arg0) == NOP_EXPR
|
||||
&& TREE_CODE (type) == REAL_TYPE)
|
||||
{
|
||||
tree targ0 = strip_float_extensions (arg0);
|
||||
if (targ0 != arg0)
|
||||
return convert (type, build1 (NEGATE_EXPR, TREE_TYPE (targ0), targ0));
|
||||
|
||||
}
|
||||
|
||||
/* Convert - (a - b) to (b - a) for non-floating-point. */
|
||||
else if (TREE_CODE (arg0) == MINUS_EXPR
|
||||
@ -5083,6 +5092,15 @@ fold (expr)
|
||||
}
|
||||
else if (TREE_CODE (arg0) == ABS_EXPR || TREE_CODE (arg0) == NEGATE_EXPR)
|
||||
return build1 (ABS_EXPR, type, TREE_OPERAND (arg0, 0));
|
||||
/* Convert fabs((double)float) into (double)fabsf(float). */
|
||||
else if (TREE_CODE (arg0) == NOP_EXPR
|
||||
&& TREE_CODE (type) == REAL_TYPE)
|
||||
{
|
||||
tree targ0 = strip_float_extensions (arg0);
|
||||
if (targ0 != arg0)
|
||||
return convert (type, build1 (ABS_EXPR, TREE_TYPE (targ0), targ0));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* fabs(sqrt(x)) = sqrt(x) and fabs(exp(x)) = exp(x). */
|
||||
|
19
gcc/global.c
19
gcc/global.c
@ -132,6 +132,11 @@ struct allocno
|
||||
/* Set of hard registers that some later allocno has a preference for. */
|
||||
|
||||
HARD_REG_SET regs_someone_prefers;
|
||||
|
||||
#ifdef STACK_REGS
|
||||
/* Set to true if allocno can't be allocated in the stack register. */
|
||||
bool no_stack_reg;
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct allocno *allocno;
|
||||
@ -708,8 +713,14 @@ global_conflicts ()
|
||||
if (e->flags & EDGE_ABNORMAL)
|
||||
break;
|
||||
if (e != NULL)
|
||||
for (ax = FIRST_STACK_REG; ax <= LAST_STACK_REG; ax++)
|
||||
record_one_conflict (ax);
|
||||
{
|
||||
EXECUTE_IF_SET_IN_ALLOCNO_SET (allocnos_live, ax,
|
||||
{
|
||||
allocno[ax].no_stack_reg = 1;
|
||||
});
|
||||
for (ax = FIRST_STACK_REG; ax <= LAST_STACK_REG; ax++)
|
||||
record_one_conflict (ax);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -1205,6 +1216,10 @@ find_reg (num, losers, alt_regs_p, accept_call_clobbered, retrying)
|
||||
#ifdef CANNOT_CHANGE_MODE_CLASS
|
||||
&& ! invalid_mode_change_p (regno, REGNO_REG_CLASS (regno),
|
||||
mode)
|
||||
#endif
|
||||
#ifdef STACK_REGS
|
||||
&& (!allocno[num].no_stack_reg
|
||||
|| regno < FIRST_STACK_REG || regno > LAST_STACK_REG)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
@ -1,3 +1,10 @@
|
||||
Wed Jan 15 12:20:52 CET 2003 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* gcc.c-torture/compile/20030115-1.c: New test.
|
||||
|
||||
* gcc.dg/i386-fpcvt-1.c: New test.
|
||||
* gcc.dg/i386-fpcvt-2.c: New test.
|
||||
|
||||
2003-01-14 Jeffrey D. Oldham <oldham@codesourcery.com>
|
||||
|
||||
Further conform g++'s __vmi_class_type_info to the C++ ABI
|
||||
|
14
gcc/testsuite/g77.f-torture/compile/20030115-1.c
Normal file
14
gcc/testsuite/g77.f-torture/compile/20030115-1.c
Normal file
@ -0,0 +1,14 @@
|
||||
SUBROUTINE FOO (B)
|
||||
|
||||
10 CALL BAR(A)
|
||||
ASSIGN 20 TO M
|
||||
IF(100.LT.A) GOTO 10
|
||||
GOTO 40
|
||||
C
|
||||
20 IF(B.LT.ABS(A)) GOTO 10
|
||||
ASSIGN 30 TO M
|
||||
GOTO 40
|
||||
C
|
||||
30 ASSIGN 10 TO M
|
||||
40 GOTO M,(10,20,30)
|
||||
END
|
8
gcc/testsuite/gcc.dg/i386-fpcvt-3.c
Normal file
8
gcc/testsuite/gcc.dg/i386-fpcvt-3.c
Normal file
@ -0,0 +1,8 @@
|
||||
/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
|
||||
/* { dg-options "-O2 -msse2 -march=athlon" } */
|
||||
/* { dg-final { scan-assembler-not "cvtss2sd" } } */
|
||||
float a,b;
|
||||
main()
|
||||
{
|
||||
a=fabs(b)+1.0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user