This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: PATCH: PR middle-end/37009: No need to align stack whenincomingstack is aligned


Should be check_int (&a,  __alignof__(a)) instead

-----Original Message-----
From: H.J. Lu [mailto:hjl.tools@gmail.com] 
Sent: 2008年8月4日 22:36
To: Ye, Joey
Cc: gcc-patches@gcc.gnu.org; Guo, Xuepeng
Subject: Re: PATCH: PR middle-end/37009: No need to align stack whenincomingstack is aligned

2008/8/4 Ye, Joey <joey.ye@intel.com>:
> My case is trying to test if callee will think incoming boundary is still 4 bytes or not. At beginning I suspect callee will make wrong decision that incoming is 8 bytes. But the case proves your patch works fine.
>

Your testcase only has

 check_int (&i,  __alignof__(i));

'i' here is aligned at 8 byte. It doesn't test alignments of
parameters on stack.

H.J.
-- 
> Thanks - Joey
>
> -----Original Message-----
> From: H.J. Lu [mailto:hjl.tools@gmail.com]
> Sent: 2008年8月4日 21:49
> To: Ye, Joey
> Cc: gcc-patches@gcc.gnu.org; Guo, Xuepeng
> Subject: Re: PATCH: PR middle-end/37009: No need to align stack whenincomingstack is aligned
>
> On Mon, Aug 04, 2008 at 02:22:28PM +0800, Joey Ye wrote:
>> The patch is OK. Suggest to add attached testcase to assert that
>> parameter boundary is NOT set to 8 when double is passed.
>
> My patch only records the largest parameter boundary in
> parm_stack_boundary. It doesn't sets parameter boundary. My
> patch is an optimization. It will remove unnecessary
> alignment instructions and won't add new ones.  I am checking it
> into stack branch.
>
> BTW, I am not sure what your t.c is testing beyond what we already
> have.
>
>
> H.J.
> -----
> /* PR middle-end/37009 */
> /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
> /* { dg-options "-m32 -mincoming-stack-boundary=2 -mpreferred-stack-boundary=2" } */
>
> #include <emmintrin.h>
> #include "check.h"
>
> typedef double aligned;
>
> void
> bar (char *p, int size)
> {
>  __builtin_strncpy (p, "good", size);
> }
>
> void
> __attribute__ ((noinline))
> foo (aligned x, aligned y ,aligned z ,aligned a, int size)
> {
>  char *p = __builtin_alloca (size + 1);
>  aligned i;
>
>  bar (p, size);
>  if (__builtin_strncmp (p, "good", size) != 0)
>    {
> #ifdef DEBUG
>      p[size] = '\0';
>      printf ("Failed: %s != good\n", p);
> #endif
>     abort ();
>    }
>
>  check_int (&i,  __alignof__(i));
> }
>
> int
> main (void)
> {
>  aligned x =  1.0 ;
>
>  foo (x, x, x, x, 5);
>
>  return 0;
> }
>



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]