This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, i386]: Avoid store forwarding stalls in assign_i386_stack_local


Hello!

This patch avoids store forwarding stalls in stack slots, created by assign_i386_stack_local. We use DImode slots to load DImode values into x87 reg usign fildll insn through the stack. When stored value crosses 16byte boundary this causes store forwarding stall.

2008-03-22 Uros Bizjak <ubizjak@gmail.com>

       * config/i386/i386.c (assign_386_stack_local): Align DImode slots
       to their natural alignment to avoid store forwarding stalls.

Patch is bootstrapped and regression tested on x86_64-pc-linux-gnu, committed to SVN.

Uros.
Index: i386.c
===================================================================
--- i386.c	(revision 133445)
+++ i386.c	(working copy)
@@ -16315,6 +16315,7 @@ rtx
 assign_386_stack_local (enum machine_mode mode, enum ix86_stack_slot n)
 {
   struct stack_local_entry *s;
+  int align;
 
   gcc_assert (n < MAX_386_STACK_LOCALS);
 
@@ -16325,11 +16326,19 @@ assign_386_stack_local (enum machine_mod
     if (s->mode == mode && s->n == n)
       return copy_rtx (s->rtl);
 
+  /* Align DImode slots to their natural alignment
+     to avoid store forwarding stalls.  */
+  if (mode == DImode
+      && (GET_MODE_BITSIZE (mode) > GET_MODE_ALIGNMENT (mode)))
+    align = GET_MODE_BITSIZE (mode);
+  else
+    align = 0;
+
   s = (struct stack_local_entry *)
     ggc_alloc (sizeof (struct stack_local_entry));
   s->n = n;
   s->mode = mode;
-  s->rtl = assign_stack_local (mode, GET_MODE_SIZE (mode), 0);
+  s->rtl = assign_stack_local (mode, GET_MODE_SIZE (mode), align);
 
   s->next = ix86_stack_locals;
   ix86_stack_locals = s;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]