public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/37009]  New: No need to align stack when incoming stack is aligned
@ 2008-08-02 14:57 hjl dot tools at gmail dot com
  2008-08-03  0:55 ` [Bug middle-end/37009] " hjl dot tools at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-08-02 14:57 UTC (permalink / raw)
  To: gcc-bugs

If a parameter is passed on stack, caller is responsible to align
the stack frame to at least the alignment of the parameter. But gcc
will align the stack even when it has been aligned already by caller.

bash-3.2$ cat 1.i
typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
int
__attribute__ ((noinline))
foo(__m128 x, int size, ...)
{
  volatile char * ptr=__builtin_alloca(size);
  volatile int __attribute((aligned(16))) xxx;

  xxx = 2;
  ptr [1]= 30;
  return xxx;
}

int
bar ()
{
  __m128 x = { 1.0 };
  foo (x, 30);
  return 0;
}
bash-3.2$  /export/build/gnu/gcc-avx/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-stack/build-x86_64-linux/gcc/ -msse2 -m32
-mpreferred-stack-boundary=2 -S -o 1.s 1.i
bash-3.2$ cat 1.s
        .file   "1.i"
        .text
.globl foo
        .type   foo, @function
foo:
        leal    4(%esp), %ecx
        andl    $-16, %esp
        pushl   -4(%ecx)
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ecx
        subl    $36, %esp
        movl    16(%ecx), %eax
        addl    $15, %eax
        addl    $3, %eax
        shrl    $2, %eax
        sall    $2, %eax
        subl    %eax, %esp
        movl    %esp, -28(%ebp)
        movl    -28(%ebp), %eax
        addl    $15, %eax
        shrl    $4, %eax
        sall    $4, %eax
        movl    %eax, -28(%ebp)
        movl    -28(%ebp), %eax
        movl    %eax, -12(%ebp)
        movl    $2, -24(%ebp)
        movl    -12(%ebp), %eax
        addl    $1, %eax
        movb    $30, (%eax)
        movl    -24(%ebp), %eax
        movl    -4(%ebp), %ecx
        leave
        leal    -4(%ecx), %esp
        ret
        .size   foo, .-foo
.globl bar
        .type   bar, @function
bar:
        pushl   %ebp
        movl    %esp, %ebp
        andl    $-16, %esp
        subl    $48, %esp
        movss   .LC0, %xmm0
        movlps  %xmm0, 32(%esp)
        movhps  %xmm0, 40(%esp)
        movl    $30, 16(%esp)
        xorps   %xmm0, %xmm0
        movlps  32(%esp), %xmm0
        movhps  40(%esp), %xmm0
        movlps  %xmm0, (%esp)
        movhps  %xmm0, 8(%esp)
        call    foo
        movl    $0, %eax
        leave
        ret
        .size   bar, .-bar
        .section        .rodata
        .align 16
.LC0:
        .long   1065353216
        .long   0
        .long   0
        .long   0
        .ident  "GCC: (GNU) 4.4.0 20080802 (experimental) [stack revision
138551]"
        .section        .note.GNU-stack,"",@progbits
bash-3.2$


-- 
           Summary: No need to align stack when incoming stack is aligned
           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=37009


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

* [Bug middle-end/37009] No need to align stack when incoming stack is aligned
  2008-08-02 14:57 [Bug middle-end/37009] New: No need to align stack when incoming stack is aligned hjl dot tools at gmail dot com
@ 2008-08-03  0:55 ` hjl dot tools at gmail dot com
  2008-08-04 13:54 ` hjl at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-08-03  0:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hjl dot tools at gmail dot com  2008-08-03 00:54 -------
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2008-08/msg00124.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |37010
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2008-
                   |                            |08/msg00124.html


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


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

* [Bug middle-end/37009] No need to align stack when incoming stack is aligned
  2008-08-02 14:57 [Bug middle-end/37009] New: No need to align stack when incoming stack is aligned hjl dot tools at gmail dot com
  2008-08-03  0:55 ` [Bug middle-end/37009] " hjl dot tools at gmail dot com
@ 2008-08-04 13:54 ` hjl at gcc dot gnu dot org
  2008-08-04 17:49 ` hjl at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: hjl at gcc dot gnu dot org @ 2008-08-04 13:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl at gcc dot gnu dot org  2008-08-04 13:53 -------
Subject: Bug 37009

Author: hjl
Date: Mon Aug  4 13:51:36 2008
New Revision: 138621

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138621
Log:
gcc/

2008-08-04  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/37009
        * cfgexpand.c (expand_stack_alignment): Check parm_stack_boundary
        for incoming stack boundary.

        * function.c (assign_parm_find_entry_rtl): Update
        parm_stack_boundary.

        * function.h (rtl_data): Add parm_stack_boundary.

        * config/i386/i386.c (ix86_finalize_stack_realign_flags): Check
        parm_stack_boundary for incoming stack boundary.

gcc/testsuite/

2008-08-04  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/37009
        * gcc.dg/torture/stackalign/alloca-2.c: New.
        * gcc.dg/torture/stackalign/alloca-3.c: Likewise.
        * gcc.dg/torture/stackalign/vararg-3.c: Likewise.
        * gcc.target/i386/incoming-1.c: Likewise.
        * gcc.target/i386/incoming-2.c: Likewise.
        * gcc.target/i386/incoming-3.c: Likewise.
        * gcc.target/i386/incoming-4.c: Likewise.

Added:
    branches/stack/gcc/testsuite/gcc.dg/torture/stackalign/alloca-2.c
    branches/stack/gcc/testsuite/gcc.dg/torture/stackalign/alloca-3.c
    branches/stack/gcc/testsuite/gcc.dg/torture/stackalign/vararg-3.c
    branches/stack/gcc/testsuite/gcc.target/i386/incoming-1.c
    branches/stack/gcc/testsuite/gcc.target/i386/incoming-2.c
    branches/stack/gcc/testsuite/gcc.target/i386/incoming-3.c
    branches/stack/gcc/testsuite/gcc.target/i386/incoming-4.c
Modified:
    branches/stack/gcc/ChangeLog.stackalign
    branches/stack/gcc/cfgexpand.c
    branches/stack/gcc/config/i386/i386.c
    branches/stack/gcc/function.c
    branches/stack/gcc/function.h
    branches/stack/gcc/testsuite/ChangeLog.stackalign


-- 


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


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

* [Bug middle-end/37009] No need to align stack when incoming stack is aligned
  2008-08-02 14:57 [Bug middle-end/37009] New: No need to align stack when incoming stack is aligned hjl dot tools at gmail dot com
  2008-08-03  0:55 ` [Bug middle-end/37009] " hjl dot tools at gmail dot com
  2008-08-04 13:54 ` hjl at gcc dot gnu dot org
@ 2008-08-04 17:49 ` hjl at gcc dot gnu dot org
  2008-08-06 15:32 ` hjl at gcc dot gnu dot org
  2008-08-06 15:46 ` hjl dot tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl at gcc dot gnu dot org @ 2008-08-04 17:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hjl at gcc dot gnu dot org  2008-08-04 17:48 -------
Subject: Bug 37009

Author: hjl
Date: Mon Aug  4 17:47:02 2008
New Revision: 138644

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138644
Log:
2008-08-04  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/37009
        * gcc.dg/torture/stackalign/alloca-4.c: New.
        * gcc.target/i386/incoming-5.c: Likewise.

        * gcc.target/i386/incoming-1.c: Update scan.
        * gcc.target/i386/incoming-4.c: Likewise.

Added:
    branches/stack/gcc/testsuite/gcc.dg/torture/stackalign/alloca-4.c
    branches/stack/gcc/testsuite/gcc.target/i386/incoming-5.c
Modified:
    branches/stack/gcc/testsuite/ChangeLog.stackalign
    branches/stack/gcc/testsuite/gcc.target/i386/incoming-1.c
    branches/stack/gcc/testsuite/gcc.target/i386/incoming-4.c


-- 


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


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

* [Bug middle-end/37009] No need to align stack when incoming stack is aligned
  2008-08-02 14:57 [Bug middle-end/37009] New: No need to align stack when incoming stack is aligned hjl dot tools at gmail dot com
                   ` (2 preceding siblings ...)
  2008-08-04 17:49 ` hjl at gcc dot gnu dot org
@ 2008-08-06 15:32 ` hjl at gcc dot gnu dot org
  2008-08-06 15:46 ` hjl dot tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl at gcc dot gnu dot org @ 2008-08-06 15:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hjl at gcc dot gnu dot org  2008-08-06 15:30 -------
Subject: Bug 37009

Author: hjl
Date: Wed Aug  6 15:29:37 2008
New Revision: 138806

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138806
Log:
gcc/

2008-08-06  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/37009
        * cfgexpand.c (expand_stack_alignment): Check parm_stack_boundary
        for incoming stack boundary.

        * function.c (assign_parm_find_entry_rtl): Update
        parm_stack_boundary.

        * function.h (rtl_data): Add parm_stack_boundary.

        * config/i386/i386.c (ix86_finalize_stack_realign_flags): Check
        parm_stack_boundary for incoming stack boundary.

gcc/testsuite/

2008-08-06  H.J. Lu  <hongjiu.lu@intel.com>

        PR middle-end/37009
        * gcc.dg/torture/stackalign/alloca-2.c: New.
        * gcc.dg/torture/stackalign/alloca-3.c: Likewise.
        * gcc.dg/torture/stackalign/alloca-4.c: Likewise.
        * gcc.dg/torture/stackalign/vararg-3.c: Likewise.
        * gcc.target/i386/incoming-1.c: Likewise.
        * gcc.target/i386/incoming-2.c: Likewise.
        * gcc.target/i386/incoming-3.c: Likewise.
        * gcc.target/i386/incoming-4.c: Likewise.
        * gcc.target/i386/incoming-5.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.dg/torture/stackalign/alloca-2.c
    trunk/gcc/testsuite/gcc.dg/torture/stackalign/alloca-3.c
    trunk/gcc/testsuite/gcc.dg/torture/stackalign/alloca-4.c
    trunk/gcc/testsuite/gcc.dg/torture/stackalign/vararg-3.c
    trunk/gcc/testsuite/gcc.target/i386/incoming-1.c
    trunk/gcc/testsuite/gcc.target/i386/incoming-2.c
    trunk/gcc/testsuite/gcc.target/i386/incoming-3.c
    trunk/gcc/testsuite/gcc.target/i386/incoming-4.c
    trunk/gcc/testsuite/gcc.target/i386/incoming-5.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgexpand.c
    trunk/gcc/config/i386/i386.c
    trunk/gcc/function.c
    trunk/gcc/function.h
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug middle-end/37009] No need to align stack when incoming stack is aligned
  2008-08-02 14:57 [Bug middle-end/37009] New: No need to align stack when incoming stack is aligned hjl dot tools at gmail dot com
                   ` (3 preceding siblings ...)
  2008-08-06 15:32 ` hjl at gcc dot gnu dot org
@ 2008-08-06 15:46 ` hjl dot tools at gmail dot com
  4 siblings, 0 replies; 6+ messages in thread
From: hjl dot tools at gmail dot com @ 2008-08-06 15:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hjl dot tools at gmail dot com  2008-08-06 15:44 -------
Fixed.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-08-06 15:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-02 14:57 [Bug middle-end/37009] New: No need to align stack when incoming stack is aligned hjl dot tools at gmail dot com
2008-08-03  0:55 ` [Bug middle-end/37009] " hjl dot tools at gmail dot com
2008-08-04 13:54 ` hjl at gcc dot gnu dot org
2008-08-04 17:49 ` hjl at gcc dot gnu dot org
2008-08-06 15:32 ` hjl at gcc dot gnu dot org
2008-08-06 15:46 ` 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).