public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/45701]  New: [regression 4.5] Fail to prefer using r3 for padding a push/pop multiple to 8-byte alignment
@ 2010-09-17 10:52 qiyao at gcc dot gnu dot org
  2010-09-17 10:52 ` [Bug target/45701] " qiyao at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: qiyao at gcc dot gnu dot org @ 2010-09-17 10:52 UTC (permalink / raw)
  To: gcc-bugs

This was implemented in gcc-4.5, still works in gcc-4.5 branch.
2009-06-02 Richard Earnshaw <rearnsha@arm.com>

        * arm.c (arm_get_frame_offsets): Prefer using r3 for padding a
        push/pop multiple to 8-byte alignment.
However, it doesn't work any longer on gcc-4.6 trunk.  Reproduced on the
following steps,

$ arm-none-linux-gnueabi-gcc -Os -mthumb -march=armv7-a bashline.c -S

On gcc-4.5 branch, r3 is used to keep stack alignment, which is expected.
history_expand_line_internal:
        @ args = 0, pretend = 0, frame = 0 
        @ frame_needed = 0, uses_anonymous_args = 0 
        push    {r3, r4, r5, r6, r7, lr} 

However, on gcc-4.6 trunk, we can see that, r8 is used to keep stack alignment,
which is *not* expected.
history_expand_line_internal:
        @ args = 0, pretend = 0, frame = 0 
        @ frame_needed = 0, uses_anonymous_args = 0 
        push    {r4, r5, r6, r7, r8, lr}


-- 
           Summary: [regression 4.5] Fail to prefer using r3 for padding a
                    push/pop multiple to 8-byte alignment
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: qiyao at gcc dot gnu dot org
  GCC host triplet: i486-build_pc-linux-gnu
GCC target triplet: arm-unknown-linux-gnueabi


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


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

* [Bug target/45701] [regression 4.5] Fail to prefer using r3 for padding a push/pop multiple to 8-byte alignment
  2010-09-17 10:52 [Bug target/45701] New: [regression 4.5] Fail to prefer using r3 for padding a push/pop multiple to 8-byte alignment qiyao at gcc dot gnu dot org
@ 2010-09-17 10:52 ` qiyao at gcc dot gnu dot org
  2010-09-17 11:32 ` [Bug target/45701] [4.6 Regression] " rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: qiyao at gcc dot gnu dot org @ 2010-09-17 10:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from qiyao at gcc dot gnu dot org  2010-09-17 10:52 -------
Created an attachment (id=21816)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21816&action=view)
Test case


-- 


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


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

* [Bug target/45701] [4.6 Regression] Fail to prefer using r3 for padding a push/pop multiple to 8-byte alignment
  2010-09-17 10:52 [Bug target/45701] New: [regression 4.5] Fail to prefer using r3 for padding a push/pop multiple to 8-byte alignment qiyao at gcc dot gnu dot org
  2010-09-17 10:52 ` [Bug target/45701] " qiyao at gcc dot gnu dot org
@ 2010-09-17 11:32 ` rguenth at gcc dot gnu dot org
  2010-09-19 13:19 ` qiyao at gcc dot gnu dot org
  2010-09-22  2:18 ` qiyao at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-09-17 11:32 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[regression 4.5] Fail to    |[4.6 Regression] Fail to
                   |prefer using r3 for padding |prefer using r3 for padding
                   |a push/pop multiple to 8-   |a push/pop multiple to 8-
                   |byte alignment              |byte alignment
   Target Milestone|---                         |4.6.0


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


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

* [Bug target/45701] [4.6 Regression] Fail to prefer using r3 for padding a push/pop multiple to 8-byte alignment
  2010-09-17 10:52 [Bug target/45701] New: [regression 4.5] Fail to prefer using r3 for padding a push/pop multiple to 8-byte alignment qiyao at gcc dot gnu dot org
  2010-09-17 10:52 ` [Bug target/45701] " qiyao at gcc dot gnu dot org
  2010-09-17 11:32 ` [Bug target/45701] [4.6 Regression] " rguenth at gcc dot gnu dot org
@ 2010-09-19 13:19 ` qiyao at gcc dot gnu dot org
  2010-09-22  2:18 ` qiyao at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: qiyao at gcc dot gnu dot org @ 2010-09-19 13:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from qiyao at gcc dot gnu dot org  2010-09-19 13:19 -------
In arm.c:arm_get_frame_offsets (void)

          if (!crtl->tail_call_emit
              && arm_size_return_regs () <= 12
              && (offsets->saved_regs_mask & (1 << 3)) == 0)
            {
              reg = 3;
            }

In gcc-4.5, crtl->tail_call_emit is always false, so the condition is true. 
However, in gcc-4.6, crtl->tail_call_emit can be true.  My stupid question is
'why can't we use r3 when we do tail call optimization?'.  I read one sentence
in comment, 'We try to avoid using the arg registers (r0 -r3) as they might be 
used to pass values in a tail call.'.  Is it the answer to my question?

If that is the answer, in oder to fix this bug, we may refine the condition to
'tail call insns are emitted, and r3 is used to pass values to tail call', like
this,

  if (!(crtl->tail_call_emit && used_to_pass_values (3))
       && ...
       && ...)

Is this a correct fix?


-- 


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


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

* [Bug target/45701] [4.6 Regression] Fail to prefer using r3 for padding a push/pop multiple to 8-byte alignment
  2010-09-17 10:52 [Bug target/45701] New: [regression 4.5] Fail to prefer using r3 for padding a push/pop multiple to 8-byte alignment qiyao at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-09-19 13:19 ` qiyao at gcc dot gnu dot org
@ 2010-09-22  2:18 ` qiyao at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: qiyao at gcc dot gnu dot org @ 2010-09-22  2:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from qiyao at gcc dot gnu dot org  2010-09-22 02:18 -------
Patch is submitted to gcc-patches for review
http://gcc.gnu.org/ml/gcc-patches/2010-09/msg01741.html


-- 

qiyao at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qiyao at gcc dot gnu dot org


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


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

end of thread, other threads:[~2010-09-22  2:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-17 10:52 [Bug target/45701] New: [regression 4.5] Fail to prefer using r3 for padding a push/pop multiple to 8-byte alignment qiyao at gcc dot gnu dot org
2010-09-17 10:52 ` [Bug target/45701] " qiyao at gcc dot gnu dot org
2010-09-17 11:32 ` [Bug target/45701] [4.6 Regression] " rguenth at gcc dot gnu dot org
2010-09-19 13:19 ` qiyao at gcc dot gnu dot org
2010-09-22  2:18 ` qiyao at gcc dot gnu dot org

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