diff options
author | H.J. Lu <hongjiu.lu@intel.com> | 2008-05-29 12:35:04 +0000 |
---|---|---|
committer | H.J. Lu <hjl@gcc.gnu.org> | 2008-05-29 05:35:04 -0700 |
commit | a20007a490d5105e25086df930a4bd67e5e250a0 (patch) | |
tree | d0969736c4a71863eb798df7de1d852409735ce7 /gcc | |
parent | 37f449aa3b21401759cef03a60c0d9ee320b24a3 (diff) | |
download | gcc-a20007a490d5105e25086df930a4bd67e5e250a0.zip gcc-a20007a490d5105e25086df930a4bd67e5e250a0.tar.gz gcc-a20007a490d5105e25086df930a4bd67e5e250a0.tar.bz2 |
re PR middle-end/35771 (Call expander ignores type alignment)
gcc/
2008-05-29 H.J. Lu <hongjiu.lu@intel.com>
PR target/35771
* config/i386/i386.c (ix86_function_arg_boundary): Convert to
canonical type if needed.
gcc/testsuite/
2008-05-29 H.J. Lu <hongjiu.lu@intel.com>
PR target/35771
* gcc.dg/torture/pr35771.h: New.
* gcc.dg/torture/pr35771-1.c: Likewise.
* gcc.dg/torture/pr35771-2.c: Likewise.
* gcc.dg/torture/pr35771-3.c: Likewise.
From-SVN: r136159
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr35771-1.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr35771-2.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr35771-3.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr35771.h | 40 |
7 files changed, 83 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5fb8fdd..d522309 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-05-29 H.J. Lu <hongjiu.lu@intel.com> + + PR target/35771 + * config/i386/i386.c (ix86_function_arg_boundary): Convert to + canonical type if needed. + 2008-05-29 Eric Botcazou <ebotcazou@adacore.com> * tree-nested.c (check_for_nested_with_variably_modified): Fix typo. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index cbb122a..6640c62 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -4639,10 +4639,11 @@ ix86_function_arg_boundary (enum machine_mode mode, tree type) int align; if (type) { - if (TYPE_STRUCTURAL_EQUALITY_P (type)) - align = TYPE_ALIGN (type); - else - align = TYPE_ALIGN (TYPE_CANONICAL (type)); + /* Since canonical type is used for call, we convert it to + canonical type if needed. */ + if (!TYPE_STRUCTURAL_EQUALITY_P (type)) + type = TYPE_CANONICAL (type); + align = TYPE_ALIGN (type); } else align = GET_MODE_ALIGNMENT (mode); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1a27c7c..9df869d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2008-05-29 H.J. Lu <hongjiu.lu@intel.com> + + PR target/35771 + * gcc.dg/torture/pr35771.h: New. + * gcc.dg/torture/pr35771-1.c: Likewise. + * gcc.dg/torture/pr35771-2.c: Likewise. + * gcc.dg/torture/pr35771-3.c: Likewise. + 2008-05-29 Eric Botcazou <ebotcazou@adacore.com> * gcc.dg/nested-func-6.c: New test. diff --git a/gcc/testsuite/gcc.dg/torture/pr35771-1.c b/gcc/testsuite/gcc.dg/torture/pr35771-1.c new file mode 100644 index 0000000..c88241b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr35771-1.c @@ -0,0 +1,8 @@ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-msse2" } */ + +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); + +#define TYPE __m128 + +#include "pr35771.h" diff --git a/gcc/testsuite/gcc.dg/torture/pr35771-2.c b/gcc/testsuite/gcc.dg/torture/pr35771-2.c new file mode 100644 index 0000000..d036f39 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr35771-2.c @@ -0,0 +1,8 @@ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-msse2" } */ + +typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__)); + +#define TYPE __m128d + +#include "pr35771.h" diff --git a/gcc/testsuite/gcc.dg/torture/pr35771-3.c b/gcc/testsuite/gcc.dg/torture/pr35771-3.c new file mode 100644 index 0000000..b76c569 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr35771-3.c @@ -0,0 +1,8 @@ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-msse2" } */ + +typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); + +#define TYPE __m128i + +#include "pr35771.h" diff --git a/gcc/testsuite/gcc.dg/torture/pr35771.h b/gcc/testsuite/gcc.dg/torture/pr35771.h new file mode 100644 index 0000000..01c2487 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr35771.h @@ -0,0 +1,40 @@ +typedef TYPE __attribute__((aligned(1))) unaligned; + +#include "cpuid.h" + +extern void abort (void); + + +TYPE __attribute__((noinline)) +foo (TYPE a1, TYPE a2, TYPE a3, TYPE a4, + TYPE a5, TYPE a6, TYPE a7, TYPE a8, + int b1, int b2, int b3, int b4, int b5, int b6, int b7, unaligned y) +{ + return y; +} + +void +do_test (void) +{ + unaligned x; + TYPE y = { 0 }; + x = y; + y = foo (y, y, y, y, y, y, y, y, 1, 2, 3, 4, 5, 6, -1, x); + if (__builtin_memcmp (&y, &x, sizeof (y)) != 0) + abort (); +} + +int +main (void) +{ + unsigned int eax, ebx, ecx, edx; + + if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) + return 0; + + /* Run SSE2 test only if host has SSE2 support. */ + if (edx & bit_SSE2) + do_test (); + + return 0; +} |