This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR middle-end/37009: No need to align stack when incomingstack 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;
}