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
+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>
/* 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. */
}
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
}
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). */
/* 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;
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
}
#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
)
{
+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
--- /dev/null
+ 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
--- /dev/null
+/* { 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;
+}