public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/36253]  New: Caller-save stack slot may not have proper alignment
@ 2008-05-17  0:18 hjl dot tools at gmail dot com
  2008-05-17  2:18 ` [Bug middle-end/36253] " hjl dot tools at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-05-17  0:18 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2008-05-26 14:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-17  0:18 [Bug middle-end/36253] New: Caller-save stack slot may not have proper alignment hjl dot tools at gmail dot com
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

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).