aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2003-01-15 13:43:35 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2003-01-15 12:43:35 +0000
commitb1a6f8db645316b579bf6d42fdfadaea03e44a03 (patch)
tree6deb389e7c733b4c85650e832ec219085b0ff935 /gcc/fold-const.c
parentd18c7e595f818f688d073496d64fae9c00b594d6 (diff)
downloadgcc-b1a6f8db645316b579bf6d42fdfadaea03e44a03.zip
gcc-b1a6f8db645316b579bf6d42fdfadaea03e44a03.tar.gz
gcc-b1a6f8db645316b579bf6d42fdfadaea03e44a03.tar.bz2
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 726e845..3ab360b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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). */