public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [x32] PATCH: PR middle-end/47725: [x32] error: unable to find a register to spill in class DIREG
@ 2011-02-14 19:04 H.J. Lu
  2011-02-14 19:07 ` Jeff Law
  0 siblings, 1 reply; 25+ messages in thread
From: H.J. Lu @ 2011-02-14 19:04 UTC (permalink / raw)
  To: gcc-patches

Hi,

cant_combine_insn_p won't check ZERO_EXTEND and SIGN_EXTEND.  This
patch helps cant_combine_insn_p by copying the arg in the incoming mode
and extending the copy instead of the arg.  OK for trunk when stage 1
is open?

Thanks.


H.J.
---
Index: gcc/testsuite/ChangeLog.x32
===================================================================
--- gcc/testsuite/ChangeLog.x32	(revision 170144)
+++ gcc/testsuite/ChangeLog.x32	(working copy)
@@ -1,5 +1,10 @@
 2011-02-13  H.J. Lu  <hongjiu.lu@intel.com>
 
+	PR middle-end/47725
+	* gcc.dg/torture/pr47725.c: New.
+
+2011-02-13  H.J. Lu  <hongjiu.lu@intel.com>
+
 	PR target/47715
 	* gcc.target/i386/pr47715-3.c: New.
 
Index: gcc/testsuite/gcc.dg/torture/pr47725.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr47725.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr47725.c	(revision 0)
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+struct _Unwind_Context
+{
+  void *reg[17];
+  void *ra;
+};
+extern void bar (struct _Unwind_Context *);
+void
+__frame_state_for (void *pc_target)
+{
+  struct _Unwind_Context context;
+  __builtin_memset (&context, 0, sizeof (struct _Unwind_Context));
+  context.ra = pc_target;
+  bar (&context);
+}
Index: gcc/function.c
===================================================================
--- gcc/function.c	(revision 170144)
+++ gcc/function.c	(working copy)
@@ -3004,6 +3004,14 @@ assign_parm_setup_reg (struct assign_par
 	  HARD_REG_SET hardregs;
 
 	  start_sequence ();
+	  if (REG_P (op1) && REGNO (op1) < FIRST_PSEUDO_REGISTER)
+	    {
+	      /* We must copy the hard register first before extending
+		 it.  Otherwise, combine won't see the hard register.  */
+	      rtx copy = gen_reg_rtx (data->passed_mode);
+	      emit_move_insn (copy, op1);
+	      op1 = copy;
+	    }
 	  insn = gen_extend_insn (op0, op1, promoted_nominal_mode,
 				  data->passed_mode, unsignedp);
 	  emit_insn (insn);
Index: gcc/ChangeLog.x32
===================================================================
--- gcc/ChangeLog.x32	(revision 170146)
+++ gcc/ChangeLog.x32	(working copy)
@@ -1,3 +1,9 @@
+2011-02-14  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR middle-end/47725
+	* function.c (assign_parm_setup_reg): Copy the hard register
+	first before extending it.
+
 2011-02-13  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR target/47715

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2011-03-29 17:11 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 19:04 [x32] PATCH: PR middle-end/47725: [x32] error: unable to find a register to spill in class DIREG H.J. Lu
2011-02-14 19:07 ` Jeff Law
2011-02-14 19:11   ` H.J. Lu
2011-02-14 19:17     ` Jeff Law
2011-02-14 19:39       ` Eric Botcazou
2011-02-14 19:49         ` Bernd Schmidt
2011-02-14 19:51           ` Eric Botcazou
2011-02-15 23:09             ` Bernd Schmidt
2011-03-18  0:30               ` H.J. Lu
2011-03-18  4:01                 ` H.J. Lu
2011-03-21  4:15                   ` H.J. Lu
2011-03-22 20:10                     ` Eric Botcazou
2011-03-23  3:29                       ` H.J. Lu
2011-03-23  8:27                         ` Eric Botcazou
2011-03-23 10:57                           ` H.J. Lu
2011-03-24 15:56                             ` Eric Botcazou
2011-03-29 17:50                               ` H.J. Lu
2011-02-14 19:54           ` H.J. Lu
2011-02-15 15:53             ` Bernd Schmidt
2011-02-15 17:02               ` H.J. Lu
2011-02-15 17:49               ` Eric Botcazou
2011-02-15 18:14                 ` H.J. Lu
2011-02-15 19:03                   ` Eric Botcazou
2011-02-15 21:16                   ` Jeff Law
2011-02-15 21:39                 ` Bernd Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).