public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [PATCH, i386]: Avoid store forwarding stalls in assign_i386_stack_local
Date: Sat, 22 Mar 2008 19:43:00 -0000	[thread overview]
Message-ID: <47E55F31.9020605@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 560 bytes --]

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.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 1033 bytes --]

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;

                 reply	other threads:[~2008-03-22 19:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47E55F31.9020605@gmail.com \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).