]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/43546 (ICE: in assign_stack_local_1, at function.c:353 with...
authorJakub Jelinek <jakub@redhat.com>
Thu, 6 Mar 2014 08:02:46 +0000 (09:02 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 6 Mar 2014 08:02:46 +0000 (09:02 +0100)
Backport from mainline
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.

* gcc.target/i386/pr43546.c: New test.

From-SVN: r208369

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr43546.c [new file with mode: 0644]

index eeed95ae7756fc02fd719509955d4eb6b48905eb..ac038e41555ae69fe45505b4e28ab13eb6d18067 100644 (file)
@@ -1,6 +1,12 @@
 2014-03-06  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
+       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-11  Richard Henderson  <rth@redhat.com>
                    Jakub Jelinek  <jakub@redhat.com>
 
index d39bdce4caf42ba76acc3bc4cf6c51d1ffeeb4a0..01697e99ac8731cbe3ae287680e595c99df26d23 100644 (file)
@@ -3611,12 +3611,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;
     }
 
index 29e3975fa6ab819cc8465f7c9d9f9e5aaafaa27d..425cbf690faf334e52e47c0d0ee8fb586f72d5cc 100644 (file)
@@ -1,6 +1,11 @@
 2014-03-06  Jakub Jelinek  <jakub@redhat.com>
 
        Backport from mainline
+       2014-02-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/43546
+       * gcc.target/i386/pr43546.c: New test.
+
        2014-02-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/60101
diff --git a/gcc/testsuite/gcc.target/i386/pr43546.c b/gcc/testsuite/gcc.target/i386/pr43546.c
new file mode 100644 (file)
index 0000000..53cb3a0
--- /dev/null
@@ -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);
+}