public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl dot tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/36253]  New: Caller-save stack slot may not have proper alignment
Date: Sat, 17 May 2008 00:18:00 -0000	[thread overview]
Message-ID: <bug-36253-682@http.gcc.gnu.org/bugzilla/> (raw)

setup_save_areas calls assign_stack_local to allocate a stack
slot for a hard register in the widest mode. assign_stack_local
has

  if (align == 0)
    {    
      tree type;

      if (mode == BLKmode)
        alignment = BIGGEST_ALIGNMENT;
      else 
        alignment = GET_MODE_ALIGNMENT (mode);

      /* Allow the target to (possibly) increase the alignment of this
         stack slot.  */
      type = lang_hooks.types.type_for_mode (mode, 0);
      if (type)
        alignment = LOCAL_ALIGNMENT (type, alignment);

      alignment /= BITS_PER_UNIT;
    }    

For x87, the widest mode is XF, which is 12byte aligned at 4 byte.
So a 12byte stack slot aligned at 4 byte is allocated for an x87
register.  For x87, DF is 8 byte aligned at 8 byte. If it turns out
later that we need to save/restore DF instead XF, we load/store the DF
register at 4 byte instead of 8 byte. It won't give us the best x87
performance. One fix is change

     if (type)
        alignment = LOCAL_ALIGNMENT (type, alignment);

to

    alignment = LOCAL_ALIGNMENT (type, mode, alignment);

If type is NULL, it is used for stack slot. We can return proper
alignment based on mode.


-- 
           Summary: Caller-save stack slot may not have proper alignment
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36253


             reply	other threads:[~2008-05-17  0:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-17  0:18 hjl dot tools at gmail dot com [this message]
2008-05-17  2:18 ` [Bug middle-end/36253] " hjl dot tools at gmail dot com
2008-05-17 15:19 ` hjl dot tools at gmail dot com
2008-05-17 23:51 ` hjl dot tools at gmail dot com
2008-05-17 23:59 ` hjl at gcc dot gnu dot org
2008-05-26 14:01 ` hjl at gcc dot gnu dot org
2008-05-26 14:29 ` hjl dot tools at gmail dot com

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=bug-36253-682@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).