summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-13 13:20:06 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-13 13:20:06 +0000
commit0614d12ceb32da61e99e0474cf52906bfd076805 (patch)
treec1735f9881991b7373fa30d6129d1344232c83c2
parented87d3a6a1563df30079b1b7655e1033ced5f3e2 (diff)
downloadgcc-0614d12ceb32da61e99e0474cf52906bfd076805.tar.gz
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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207757 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/expr.c13
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr43546.c12
4 files changed, 34 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e0293c5096f..d159346e723 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-02-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/43546
+ * expr.c (compress_float_constant): If x is a hard register,
+ extend into a pseudo and then move to x.
+
2014-02-13 Dominik Vogt <vogt@linux.vnet.ibm.com>
* config/s390/s390.c (s390_asm_output_function_label): Fix crash
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;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 392986f4f8f..881aa3df2a0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-02-13 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/43546
+ * gcc.target/i386/pr43546.c: New test.
+
2014-02-13 Dominik Vogt <vogt@linux.vnet.ibm.com>
* gcc.target/s390/hotpatch-compile-8.c: New test.
diff --git a/gcc/testsuite/gcc.target/i386/pr43546.c b/gcc/testsuite/gcc.target/i386/pr43546.c
new file mode 100644
index 00000000000..53cb3a07fdf
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr43546.c
@@ -0,0 +1,12 @@
+/* PR target/43546 */
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+/* { dg-additional-options "-mpreferred-stack-boundary=2 -msseregparm -msse" { target ia32 } } */
+
+extern void bar (double);
+
+void
+foo (void)
+{
+ bar (1.0);
+}