summaryrefslogtreecommitdiffstats
path: root/gcc/expr.c
diff options
context:
space:
mode:
authordalej <dalej@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-12 20:29:51 +0000
committerdalej <dalej@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-12 20:29:51 +0000
commit8b1bf1e977f237ec4b74568e78ae6a36a3fdcdea (patch)
tree3fdf52c0ba14a4c842f30934ba59c2b3808ab4ea /gcc/expr.c
parent227e942303e8b1341b3e418d5e28b3280a5b98bf (diff)
downloadppe42-gcc-8b1bf1e977f237ec4b74568e78ae6a36a3fdcdea.tar.gz
ppe42-gcc-8b1bf1e977f237ec4b74568e78ae6a36a3fdcdea.zip
2005-07-12 Dale Johannesen <dalej@apple.com>
* expr.c (compress_float_constant): Add cost check. * config/rs6000.c (rs6000_rtx_cost): Adjust FLOAT_EXTEND cost. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101938 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 01f890fa6a5..182ab2382be 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -3202,9 +3202,15 @@ compress_float_constant (rtx x, rtx y)
enum machine_mode orig_srcmode = GET_MODE (y);
enum machine_mode srcmode;
REAL_VALUE_TYPE r;
+ int oldcost, newcost;
REAL_VALUE_FROM_CONST_DOUBLE (r, y);
+ if (LEGITIMATE_CONSTANT_P (y))
+ oldcost = rtx_cost (y, SET);
+ else
+ oldcost = rtx_cost (force_const_mem (dstmode, y), SET);
+
for (srcmode = GET_CLASS_NARROWEST_MODE (GET_MODE_CLASS (orig_srcmode));
srcmode != orig_srcmode;
srcmode = GET_MODE_WIDER_MODE (srcmode))
@@ -3229,12 +3235,23 @@ compress_float_constant (rtx x, rtx y)
the extension. */
if (! (*insn_data[ic].operand[1].predicate) (trunc_y, srcmode))
continue;
+ /* This is valid, but may not be cheaper than the original. */
+ newcost = rtx_cost (gen_rtx_FLOAT_EXTEND (dstmode, trunc_y), SET);
+ if (oldcost < newcost)
+ continue;
}
else if (float_extend_from_mem[dstmode][srcmode])
- trunc_y = validize_mem (force_const_mem (srcmode, trunc_y));
+ {
+ trunc_y = force_const_mem (srcmode, trunc_y);
+ /* This is valid, but may not be cheaper than the original. */
+ newcost = rtx_cost (gen_rtx_FLOAT_EXTEND (dstmode, trunc_y), SET);
+ if (oldcost < newcost)
+ continue;
+ trunc_y = validize_mem (trunc_y);
+ }
else
continue;
-
+
emit_unop_insn (ic, x, trunc_y, UNKNOWN);
last_insn = get_last_insn ();
OpenPOWER on IntegriCloud