Commit 2ac26e15 by H.J. Lu Committed by H.J. Lu

re PR middle-end/39315 (Unaligned move used on aligned stack variable)

gcc/

2009-03-27  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/39315
	* cfgexpand.c (expand_one_stack_var_at): Change alignment
	limit to MAX_SUPPORTED_STACK_ALIGNMENT.

gcc/testsuite/

2009-03-27  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/39315
	* gcc.target/i386/pr39315-1.c: New.
	* gcc.target/i386/pr39315-2.c: Likewise.
	* gcc.target/i386/pr39315-3.c: Likewise.
	* gcc.target/i386/pr39315-4.c: Likewise.
	* gcc.target/i386/pr39315-check.c: Likewise.

From-SVN: r145138
parent 472c7fbd
2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/39315
* cfgexpand.c (expand_one_stack_var_at): Change alignment
limit to MAX_SUPPORTED_STACK_ALIGNMENT.
2009-03-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/39120
......
......@@ -866,7 +866,8 @@ dump_stack_var_partition (void)
static void
expand_one_stack_var_at (tree decl, HOST_WIDE_INT offset)
{
HOST_WIDE_INT align;
/* Alignment is unsigned. */
unsigned HOST_WIDE_INT align;
rtx x;
/* If this fails, we've overflowed the stack frame. Error nicely? */
......@@ -879,8 +880,10 @@ expand_one_stack_var_at (tree decl, HOST_WIDE_INT offset)
offset -= frame_phase;
align = offset & -offset;
align *= BITS_PER_UNIT;
if (align > STACK_BOUNDARY || align == 0)
if (align == 0)
align = STACK_BOUNDARY;
else if (align > MAX_SUPPORTED_STACK_ALIGNMENT)
align = MAX_SUPPORTED_STACK_ALIGNMENT;
DECL_ALIGN (decl) = align;
DECL_USER_ALIGN (decl) = 0;
......
......@@ -10,6 +10,15 @@
2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/39315
* gcc.target/i386/pr39315-1.c: New.
* gcc.target/i386/pr39315-2.c: Likewise.
* gcc.target/i386/pr39315-3.c: Likewise.
* gcc.target/i386/pr39315-4.c: Likewise.
* gcc.target/i386/pr39315-check.c: Likewise.
2009-03-27 H.J. Lu <hongjiu.lu@intel.com>
PR c/39323
* gcc.dg/pr39323-1.c: New.
* gcc.dg/pr39323-2.c: Likewise.
......
/* PR middle-end/39315 */
/* { dg-do compile } */
/* { dg-options "-O -msse2 -mtune=generic" } */
/* { dg-final { scan-assembler-not "movups" } } */
/* { dg-final { scan-assembler-not "movlps" } } */
/* { dg-final { scan-assembler-not "movhps" } } */
/* { dg-final { scan-assembler "movaps" } } */
typedef float __m128 __attribute__ ((__vector_size__ (16)));
extern void bar (__m128 *);
void
foo (__m128 *x)
{
__m128 b = *x;
bar (&b);
}
/* PR middle-end/39315 */
/* { dg-do run } */
/* { dg-options "-O -msse2 -mtune=generic" } */
/* { dg-additional-sources pr39315-check.c } */
typedef float __m128 __attribute__ ((__vector_size__ (16)));
extern void bar (__m128 *, int);
void
foo (__m128 *x)
{
__m128 b = *x;
bar (&b, __alignof__ (x));
}
/* PR middle-end/39315 */
/* { dg-do compile } */
/* { dg-options "-O -msse2 -mtune=generic" } */
/* { dg-final { scan-assembler-not "movups" } } */
/* { dg-final { scan-assembler-not "movlps" } } */
/* { dg-final { scan-assembler-not "movhps" } } */
/* { dg-final { scan-assembler "and\[lq\]?\[\\t \]*\\$-128,\[\\t \]*%\[re\]?sp" } } */
/* { dg-final { scan-assembler "movaps" } } */
typedef float __m128 __attribute__ ((__vector_size__ (16)));
extern void bar (__m128 *);
void
foo (__m128 *x)
{
__m128 b __attribute__ ((aligned(128))) = *x;
bar (&b);
}
/* PR middle-end/39315 */
/* { dg-do run } */
/* { dg-options "-O -msse2 -mtune=generic" } */
/* { dg-additional-sources pr39315-check.c } */
typedef float __m128 __attribute__ ((__vector_size__ (16)));
extern void bar (__m128 *, int);
void
foo (__m128 *x)
{
__m128 b __attribute__ ((aligned(128))) = *x;
bar (&b, __alignof__ (x));
}
typedef float __m128 __attribute__ ((__vector_size__ (16)));
extern void foo (__m128 *);
extern void abort (void);
__m128 y = { 0.0, 1.0, 2.0, 3.0 };
void
bar (__m128 *x, int align)
{
if ((((__PTRDIFF_TYPE__) x) & (align - 1)) != 0)
abort ();
if (__builtin_memcmp (x, &y, sizeof (y)) != 0)
abort ();
}
int
main ()
{
foo (&y);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment