aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-02-13 13:20:06 +0000
committerJakub Jelinek <jakub@redhat.com>2014-02-13 13:20:06 +0000
commit5ccc80c365dafacf9ff77cc85b2c68fbc0e8be42 (patch)
treec1735f9881991b7373fa30d6129d1344232c83c2 /gcc/expr.c
parente1e981d2b1641a55253d72bb375519b73b41ec0f (diff)
PR target/43546
* expr.c (compress_float_constant): If x is a hard register, extend into a pseudo and then move to x. * gcc.target/i386/pr43546.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@207757 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index f6708da20d9..29ce694704c 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -3726,12 +3726,21 @@ compress_float_constant (rtx x, rtx y)
into a new pseudo. This constant may be used in different modes,
and if not, combine will put things back together for us. */
trunc_y = force_reg (srcmode, trunc_y);
- emit_unop_insn (ic, x, trunc_y, UNKNOWN);
+
+ /* If x is a hard register, perform the extension into a pseudo,
+ so that e.g. stack realignment code is aware of it. */
+ rtx target = x;
+ if (REG_P (x) && HARD_REGISTER_P (x))
+ target = gen_reg_rtx (dstmode);
+
+ emit_unop_insn (ic, target, trunc_y, UNKNOWN);
last_insn = get_last_insn ();
- if (REG_P (x))
+ if (REG_P (target))
set_unique_reg_note (last_insn, REG_EQUAL, y);
+ if (target != x)
+ return emit_move_insn (x, target);
return last_insn;
}