OSDN Git Service

gcc/
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 Mar 2009 22:37:39 +0000 (22:37 +0000)
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 Mar 2009 22:37:39 +0000 (22:37 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145138 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cfgexpand.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr39315-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr39315-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr39315-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr39315-4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/pr39315-check.c [new file with mode: 0644]

index 7fd95bc..e7d95c7 100644 (file)
@@ -1,3 +1,9 @@
+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
index 4bfdc5f..695e4ef 100644 (file)
@@ -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;
 
index 5fea6b9..ff739ac 100644 (file)
 
 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.
diff --git a/gcc/testsuite/gcc.target/i386/pr39315-1.c b/gcc/testsuite/gcc.target/i386/pr39315-1.c
new file mode 100644 (file)
index 0000000..16ba5d5
--- /dev/null
@@ -0,0 +1,18 @@
+/* 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);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr39315-2.c b/gcc/testsuite/gcc.target/i386/pr39315-2.c
new file mode 100644 (file)
index 0000000..ab3dcd0
--- /dev/null
@@ -0,0 +1,15 @@
+/* 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));
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr39315-3.c b/gcc/testsuite/gcc.target/i386/pr39315-3.c
new file mode 100644 (file)
index 0000000..07862db
--- /dev/null
@@ -0,0 +1,19 @@
+/* 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);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr39315-4.c b/gcc/testsuite/gcc.target/i386/pr39315-4.c
new file mode 100644 (file)
index 0000000..2e55c25
--- /dev/null
@@ -0,0 +1,15 @@
+/* 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));
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr39315-check.c b/gcc/testsuite/gcc.target/i386/pr39315-check.c
new file mode 100644 (file)
index 0000000..ff92605
--- /dev/null
@@ -0,0 +1,22 @@
+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;
+}