Message ID | AANLkTinBP9St4da_U00R+scX0S_eDv3B5FjtUMxEjpFq@mail.gmail.com |
---|---|
State | New |
Headers | show |
On Sat, Aug 21, 2010 at 7:04 PM, H.J. Lu <hjl.tools@gmail.com> wrote: > On Fri, Aug 20, 2010 at 8:39 AM, Kreitzer, David L > <david.l.kreitzer@intel.com> wrote: >> Hi HJ, >> >> In the Intel compiler, we guarantee that outgoing arguments are aligned properly except in the case of 8-byte alignment on IA-32. We will dynamically align the stack and/or insert padding in the outgoing argument block as necessary to make this happen. >> >> Note that this includes both the alignment requirements of the built-in types as specified by the ABI and alignment requirements specified by the programmer via __attribute__((aligned(N))) or __declspec(align(N)). >> >> To summarize >> >> 1) For Intel64, always properly align outgoing parameter. >> 2) For IA-32, properly align parameter if alignment is >= 16 bytes. Otherwise, align to 4 bytes. >> >> Dave Kreitzer >> > > Here is the patch to implement this. Tested on Linux/ia32 and Linux/Intel64. > OK for trunk? Does the ABI clearly say that? If not this warrants documentation. I suppose an entry in changes.html is also required (supposed the patch is approved of course). Richard. > Thanks. > > > -- > H.J. > --- > gcc/ > > 2010-08-21 H.J. Lu <hongjiu.lu@intel.com> > > PR target/44948 > * config/i386/i386.c (ix86_old_function_arg_boundary): New. > (ix86_function_arg_boundary): Always align parameters on stack > in 64bit and align parameters with alignment >= 16byte on stack > in 32bit. Warn alignment change. > > gcc/testsuite/ > > 2010-08-21 H.J. Lu <hongjiu.lu@intel.com> > > PR target/44948 > * g++.dg/abi/param2.C: Add -Wno-psabi for ilp32 x86. > * g++.dg/vect/pr33860a.cc: Likewise. > * gcc.c-torture/compile/20070522-1.c: Likewise. > * gcc.dg/compat/struct-align-1_x.c: Likewise. > * gcc.dg/compat/struct-align-1_y.c: Likewise. > * gcc.dg/compat/struct-align-2_x.c: Likewise. > * gcc.dg/compat/struct-align-2_y.c: Likewise. > * gcc.dg/pr44136.c: Likewise. > > * gcc.c-torture/compile/pr33617.c: Add -Wno-psabi for x86. > * gcc.dg/compat/vector-1_x.c: Likewise. > * gcc.dg/compat/vector-1_y.c: Likewise. > * gcc.dg/compat/vector-2_x.c: Likewise. > * gcc.dg/compat/vector-2_y.c: Likewise. > * gcc.dg/pr43300.c: Likewise. > > * gcc.dg/compat/vector-1a_x.c: Add -Wno-psabi. > * gcc.dg/compat/vector-1a_y.c: Likewise. > * gcc.dg/compat/vector-1b_x.c: Likewise. > * gcc.dg/compat/vector-1b_y.c: Likewise. > * gcc.dg/compat/vector-2a_x.c: Likewise. > * gcc.dg/compat/vector-2a_y.c: Likewise. > * gcc.dg/compat/vector-2b_x.c: Likewise. > * gcc.dg/compat/vector-2b_y.c: Likewise. > * gcc.target/i386/pr39162.c: Likewise. > * gcc.target/i386/pr40906-2.c: Likewise. > * gcc.target/i386/sse-5.c: Likewise. > > * gcc.dg/pr35442.c: Prune ABI change warnings. > > * gcc.c-torture/execute/pr38151.x: New. > * gcc.target/i386/pr44948-1a.c: Likewise. > * gcc.target/i386/pr44948-1b.c: Likewise. > * gcc.target/i386/pr44948-2a.c: Likewise. > * gcc.target/i386/pr44948-2b.c: Likewise. >
On Mon, Aug 23, 2010 at 9:50 AM, Richard Guenther <richard.guenther@gmail.com> wrote: > On Sat, Aug 21, 2010 at 7:04 PM, H.J. Lu <hjl.tools@gmail.com> wrote: >> On Fri, Aug 20, 2010 at 8:39 AM, Kreitzer, David L >> <david.l.kreitzer@intel.com> wrote: >>> Hi HJ, >>> >>> In the Intel compiler, we guarantee that outgoing arguments are aligned properly except in the case of 8-byte alignment on IA-32. We will dynamically align the stack and/or insert padding in the outgoing argument block as necessary to make this happen. >>> >>> Note that this includes both the alignment requirements of the built-in types as specified by the ABI and alignment requirements specified by the programmer via __attribute__((aligned(N))) or __declspec(align(N)). >>> >>> To summarize >>> >>> 1) For Intel64, always properly align outgoing parameter. >>> 2) For IA-32, properly align parameter if alignment is >= 16 bytes. Otherwise, align to 4 bytes. >>> >>> Dave Kreitzer >>> >> >> Here is the patch to implement this. Tested on Linux/ia32 and Linux/Intel64. >> OK for trunk? > > Does the ABI clearly say that? If not this warrants documentation. I suppose The psABI never mentions passing parameters with alignment attribute on stack. > an entry in changes.html is also required (supposed the patch is approved of > course). > Will do.
> PR target/44948 > * config/i386/i386.c (ix86_old_function_arg_boundary): New. > (ix86_function_arg_boundary): Always align parameters on stack > in 64bit and align parameters with alignment >= 16byte on stack > in 32bit. Warn alignment change. Ok, with... > + if(warn_psabi Watch the spacing. r~
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 0bc1c66..849d462 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -6583,24 +6583,10 @@ contains_aligned_value_p (const_tree type) return false; } -/* Gives the alignment boundary, in bits, of an argument with the - specified mode and type. */ - -int -ix86_function_arg_boundary (enum machine_mode mode, const_tree type) +static int +ix86_old_function_arg_boundary (enum machine_mode mode, const_tree type, + int align) { - int align; - if (type) - { - /* Since the main variant type is used for call, we convert it to - the main variant type. */ - type = TYPE_MAIN_VARIANT (type); - align = TYPE_ALIGN (type); - } - else - align = GET_MODE_ALIGNMENT (mode); - if (align < PARM_BOUNDARY) - align = PARM_BOUNDARY; /* In 32bit, only _Decimal128 and __float128 are aligned to their natural boundaries. */ if (!TARGET_64BIT && mode != TDmode && mode != TFmode) @@ -6628,6 +6614,48 @@ ix86_function_arg_boundary (enum machine_mode mode, const_tree type) return align; } +/* Gives the alignment boundary, in bits, of an argument with the + specified mode and type. */ + +int +ix86_function_arg_boundary (enum machine_mode mode, const_tree type) +{ + int align; + if (type) + { + /* Since the main variant type is used for call, we convert it to + the main variant type. */ + type = TYPE_MAIN_VARIANT (type); + align = TYPE_ALIGN (type); + } + else + align = GET_MODE_ALIGNMENT (mode); + if (align < PARM_BOUNDARY) + align = PARM_BOUNDARY; + else + { + static bool warned; + int saved_align = align; + + if (!TARGET_64BIT && align < 128) + align = PARM_BOUNDARY; + + if(warn_psabi + && !warned + && align != ix86_old_function_arg_boundary (mode, type, + saved_align)) + { + warned = true; + inform (input_location, + "The ABI of passing parameter with %dbyte" + " alignment has changed in GCC 4.6", + align / BITS_PER_UNIT); + } + } + + return align; +} + /* Return true if N is a possible register number of function value. */ static bool diff --git a/gcc/testsuite/g++.dg/abi/param2.C b/gcc/testsuite/g++.dg/abi/param2.C index ed3c0df..d28387a 100644 --- a/gcc/testsuite/g++.dg/abi/param2.C +++ b/gcc/testsuite/g++.dg/abi/param2.C @@ -1,6 +1,7 @@ // PR target/20795 // Test passing aligned empty aggregate // { dg-do compile } +// { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } struct S { union {} a; } __attribute__((aligned)); diff --git a/gcc/testsuite/g++.dg/vect/pr33860a.cc b/gcc/testsuite/g++.dg/vect/pr33860a.cc index a4f7bec..77e2822 100644 --- a/gcc/testsuite/g++.dg/vect/pr33860a.cc +++ b/gcc/testsuite/g++.dg/vect/pr33860a.cc @@ -1,4 +1,6 @@ /* { dg-do compile } */ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + /* Testcase by Martin Michlmayr <tbm@cyrius.com> */ class Matrix diff --git a/gcc/testsuite/gcc.c-torture/compile/20070522-1.c b/gcc/testsuite/gcc.c-torture/compile/20070522-1.c index 4c8b70c..1e1e802 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20070522-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20070522-1.c @@ -1,3 +1,5 @@ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + /* This was PR 31606, we were trying to use TImode to expand the struct copy in SRA but TImode is not support on ia32. */ diff --git a/gcc/testsuite/gcc.c-torture/compile/pr33617.c b/gcc/testsuite/gcc.c-torture/compile/pr33617.c index 0174fb6..51c6f14 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr33617.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr33617.c @@ -1,3 +1,5 @@ +/* { dg-options "-w -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */ + typedef float V8SF __attribute__ ((vector_size (32))); void bar (V8SF); void diff --git a/gcc/testsuite/gcc.c-torture/execute/pr38151.x b/gcc/testsuite/gcc.c-torture/execute/pr38151.x new file mode 100644 index 0000000..cb7b119 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr38151.x @@ -0,0 +1,2 @@ +set additional_flags "-Wno-psabi" +return 0 diff --git a/gcc/testsuite/gcc.dg/compat/struct-align-1_x.c b/gcc/testsuite/gcc.dg/compat/struct-align-1_x.c index 51b2ef4..939db9d 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-align-1_x.c +++ b/gcc/testsuite/gcc.dg/compat/struct-align-1_x.c @@ -1,3 +1,5 @@ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + #include "compat-common.h" #include "struct-align-1.h" diff --git a/gcc/testsuite/gcc.dg/compat/struct-align-1_y.c b/gcc/testsuite/gcc.dg/compat/struct-align-1_y.c index c858e10..77cb098 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-align-1_y.c +++ b/gcc/testsuite/gcc.dg/compat/struct-align-1_y.c @@ -1,3 +1,5 @@ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + #include "compat-common.h" #include "struct-align-1.h" diff --git a/gcc/testsuite/gcc.dg/compat/struct-align-2_x.c b/gcc/testsuite/gcc.dg/compat/struct-align-2_x.c index 2a4ae58..6bfc222 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-align-2_x.c +++ b/gcc/testsuite/gcc.dg/compat/struct-align-2_x.c @@ -1,3 +1,5 @@ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + /* Disable this test for 16-bit targets. */ #include <limits.h> diff --git a/gcc/testsuite/gcc.dg/compat/struct-align-2_y.c b/gcc/testsuite/gcc.dg/compat/struct-align-2_y.c index 0ca2e40..2727015 100644 --- a/gcc/testsuite/gcc.dg/compat/struct-align-2_y.c +++ b/gcc/testsuite/gcc.dg/compat/struct-align-2_y.c @@ -1,3 +1,5 @@ +/* { dg-options "-Wno-psabi" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + /* Disable this test for 16-bit targets. */ #include <limits.h> diff --git a/gcc/testsuite/gcc.dg/compat/vector-1_x.c b/gcc/testsuite/gcc.dg/compat/vector-1_x.c index ab4f88b..29a8170 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-1_x.c +++ b/gcc/testsuite/gcc.dg/compat/vector-1_x.c @@ -1,4 +1,5 @@ /* { dg-options "-w" } */ +/* { dg-options "-w -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */ #ifndef SKIP_ATTRIBUTE diff --git a/gcc/testsuite/gcc.dg/compat/vector-1_y.c b/gcc/testsuite/gcc.dg/compat/vector-1_y.c index 5a09c0e..284b98c 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-1_y.c +++ b/gcc/testsuite/gcc.dg/compat/vector-1_y.c @@ -1,4 +1,5 @@ /* { dg-options "-w" } */ +/* { dg-options "-w -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */ #ifndef SKIP_ATTRIBUTE diff --git a/gcc/testsuite/gcc.dg/compat/vector-1a_x.c b/gcc/testsuite/gcc.dg/compat/vector-1a_x.c index aa0fa7f..1d39cec 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-1a_x.c +++ b/gcc/testsuite/gcc.dg/compat/vector-1a_x.c @@ -1,3 +1,3 @@ -/* { dg-options "-w -mno-mmx -msse2" } */ +/* { dg-options "-w -Wno-psabi -mno-mmx -msse2" } */ #include "vector-1_x.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-1a_y.c b/gcc/testsuite/gcc.dg/compat/vector-1a_y.c index 2c88e19..53b1a7f 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-1a_y.c +++ b/gcc/testsuite/gcc.dg/compat/vector-1a_y.c @@ -1,3 +1,3 @@ -/* { dg-options "-w -mno-mmx -msse2" } */ +/* { dg-options "-w -Wno-psabi -mno-mmx -msse2" } */ #include "vector-1_y.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-1b_x.c b/gcc/testsuite/gcc.dg/compat/vector-1b_x.c index fe2565c..f3f76ec 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-1b_x.c +++ b/gcc/testsuite/gcc.dg/compat/vector-1b_x.c @@ -1,3 +1,3 @@ -/* { dg-options "-w -mno-mmx -mavx" } */ +/* { dg-options "-w -Wno-psabi -mno-mmx -mavx" } */ #include "vector-1_x.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-1b_y.c b/gcc/testsuite/gcc.dg/compat/vector-1b_y.c index 3212bf5..105282c 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-1b_y.c +++ b/gcc/testsuite/gcc.dg/compat/vector-1b_y.c @@ -1,3 +1,3 @@ -/* { dg-options "-w -mno-mmx -mavx" } */ +/* { dg-options "-w -Wno-psabi -mno-mmx -mavx" } */ #include "vector-1_y.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-2_x.c b/gcc/testsuite/gcc.dg/compat/vector-2_x.c index d08c77f..899a3ab 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-2_x.c +++ b/gcc/testsuite/gcc.dg/compat/vector-2_x.c @@ -1,5 +1,6 @@ /* { dg-options "-w" } */ -/* { dg-options "-w -mno-mmx" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-w -mno-mmx -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */ + #ifndef SKIP_ATTRIBUTE diff --git a/gcc/testsuite/gcc.dg/compat/vector-2_y.c b/gcc/testsuite/gcc.dg/compat/vector-2_y.c index fd5830c..a5ab241 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-2_y.c +++ b/gcc/testsuite/gcc.dg/compat/vector-2_y.c @@ -1,5 +1,5 @@ /* { dg-options "-w" } */ -/* { dg-options "-w -mno-mmx" { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-w -mno-mmx -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */ #ifndef SKIP_ATTRIBUTE diff --git a/gcc/testsuite/gcc.dg/compat/vector-2a_x.c b/gcc/testsuite/gcc.dg/compat/vector-2a_x.c index fcfacec..fb62bb8 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-2a_x.c +++ b/gcc/testsuite/gcc.dg/compat/vector-2a_x.c @@ -1,3 +1,3 @@ -/* { dg-options "-w -mno-mmx -msse2" } */ +/* { dg-options "-w -Wno-psabi -mno-mmx -msse2" } */ #include "vector-2_x.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-2a_y.c b/gcc/testsuite/gcc.dg/compat/vector-2a_y.c index 3797acb..7cdd195 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-2a_y.c +++ b/gcc/testsuite/gcc.dg/compat/vector-2a_y.c @@ -1,3 +1,3 @@ -/* { dg-options "-w -mno-mmx -msse2" } */ +/* { dg-options "-w -Wno-psabi -mno-mmx -msse2" } */ #include "vector-2_y.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-2b_x.c b/gcc/testsuite/gcc.dg/compat/vector-2b_x.c index 4dd3436..71b36be 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-2b_x.c +++ b/gcc/testsuite/gcc.dg/compat/vector-2b_x.c @@ -1,3 +1,3 @@ -/* { dg-options "-w -mno-mmx -mavx" } */ +/* { dg-options "-w -Wno-psabi -mno-mmx -mavx" } */ #include "vector-2_x.c" diff --git a/gcc/testsuite/gcc.dg/compat/vector-2b_y.c b/gcc/testsuite/gcc.dg/compat/vector-2b_y.c index 2820e0b..9c114bb 100644 --- a/gcc/testsuite/gcc.dg/compat/vector-2b_y.c +++ b/gcc/testsuite/gcc.dg/compat/vector-2b_y.c @@ -1,3 +1,3 @@ -/* { dg-options "-w -mno-mmx -mavx" } */ +/* { dg-options "-w -Wno-psabi -mno-mmx -mavx" } */ #include "vector-2_y.c" diff --git a/gcc/testsuite/gcc.dg/pr35442.c b/gcc/testsuite/gcc.dg/pr35442.c index 2bf5ce6..875cb0b 100644 --- a/gcc/testsuite/gcc.dg/pr35442.c +++ b/gcc/testsuite/gcc.dg/pr35442.c @@ -11,4 +11,4 @@ foo (A a) } /* Ignore a warning that is irrelevant to the purpose of this test. */ -/* { dg-prune-output ".*GCC vector passed by reference.*" } */ +/* { dg-prune-output "(.*GCC vector passed by reference.*|.*ABI of * passing parameter with.*)" } */ diff --git a/gcc/testsuite/gcc.dg/pr43300.c b/gcc/testsuite/gcc.dg/pr43300.c index df71dbe..a3d66fe 100644 --- a/gcc/testsuite/gcc.dg/pr43300.c +++ b/gcc/testsuite/gcc.dg/pr43300.c @@ -1,5 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-Os -w" } */ +/* { dg-options "-Os -w -Wno-psabi" { target { i?86-*-* x86_64-*-* } } } */ + typedef float V2SF __attribute__ ((vector_size (128))); V2SF diff --git a/gcc/testsuite/gcc.dg/pr44136.c b/gcc/testsuite/gcc.dg/pr44136.c index 71c21ab..e053cf8 100644 --- a/gcc/testsuite/gcc.dg/pr44136.c +++ b/gcc/testsuite/gcc.dg/pr44136.c @@ -1,7 +1,7 @@ /* PR debug/44136 */ /* { dg-do compile } */ /* { dg-options "-w -O2 -g" } */ -/* { dg-options "-w -O2 -g -mno-sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +/* { dg-options "-w -Wno-psabi -O2 -g -mno-sse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ #define vector __attribute((vector_size(16))) vector float a; diff --git a/gcc/testsuite/gcc.target/i386/pr39162.c b/gcc/testsuite/gcc.target/i386/pr39162.c index 2d114b8..09ea615 100644 --- a/gcc/testsuite/gcc.target/i386/pr39162.c +++ b/gcc/testsuite/gcc.target/i386/pr39162.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -msse2 -mno-avx" } */ +/* { dg-options "-O2 -Wno-psabi -msse2 -mno-avx" } */ typedef long long __m256i __attribute__ ((__vector_size__ (32), __may_alias__)); diff --git a/gcc/testsuite/gcc.target/i386/pr40906-2.c b/gcc/testsuite/gcc.target/i386/pr40906-2.c index 535141a..f0eda00 100644 --- a/gcc/testsuite/gcc.target/i386/pr40906-2.c +++ b/gcc/testsuite/gcc.target/i386/pr40906-2.c @@ -1,6 +1,6 @@ /* { dg-do run } */ /* { dg-require-effective-target ilp32 } */ -/* { dg-options "-O2 -fomit-frame-pointer -fno-asynchronous-unwind-tables -mpush-args -mno-accumulate-outgoing-args -m128bit-long-double" } */ +/* { dg-options "-O2 -Wno-psabi -fomit-frame-pointer -fno-asynchronous-unwind-tables -mpush-args -mno-accumulate-outgoing-args -m128bit-long-double" } */ void abort (void); diff --git a/gcc/testsuite/gcc.target/i386/pr44948-1a.c b/gcc/testsuite/gcc.target/i386/pr44948-1a.c new file mode 100644 index 0000000..db58c04 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr44948-1a.c @@ -0,0 +1,18 @@ +/* PR target/44948 */ +/* { dg-do run } */ +/* { dg-options "-O -Wno-psabi -mtune=generic" } */ +/* { dg-require-effective-target avx_runtime } */ +/* { dg-additional-sources pr44948-1b.c } */ + +#pragma GCC target ("avx") + +struct A { long b[8] __attribute__((aligned (32))); }; +void foo (long double, struct A); + +int +main (void) +{ + struct A a = { { 0, 1, 2, 3, 4, 5, 6, 7 } }; + foo (8.0L, a); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr44948-1b.c b/gcc/testsuite/gcc.target/i386/pr44948-1b.c new file mode 100644 index 0000000..1e2d4d3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr44948-1b.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O -mno-avx -Wno-psabi -mtune=generic" } */ + +struct A { long b[8] __attribute__((aligned (32))); }; + +void +foo (long double x, struct A y) +{ + int i; + if (x != 8.0L) + __builtin_abort (); + for (i = 0; i < 8; i++) + if (y.b[i] != i) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/pr44948-2a.c b/gcc/testsuite/gcc.target/i386/pr44948-2a.c new file mode 100644 index 0000000..120346e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr44948-2a.c @@ -0,0 +1,21 @@ +/* PR target/44948 */ +/* { dg-do run } */ +/* { dg-options "-O -Wno-psabi -mno-sse -mtune=generic" } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-require-effective-target sse2_runtime } */ +/* { dg-additional-sources pr44948-2b.c } */ + +#pragma GCC target ("sse2") + +struct A +{ + float V4SF __attribute__ ((vector_size (16))); +}; + +int +main (void) +{ + struct A a = { { 0, 1, 2, 3 } }; + foo (8.0L, a, 8.0L); + return 0; +} diff --git a/gcc/testsuite/gcc.target/i386/pr44948-2b.c b/gcc/testsuite/gcc.target/i386/pr44948-2b.c new file mode 100644 index 0000000..fa1769b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr44948-2b.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O -mno-sse -Wno-psabi -mtune=generic" } */ + +struct A +{ + float V4SF __attribute__ ((vector_size (16))); +}; + +void +foo (long double x, struct A y, long double z) +{ + int i; + struct A a = { { 0, 1, 2, 3 } }; + + if (x != 8.0L || z != 8.0L) + __builtin_abort (); + if (__builtin_memcmp (&a, &y, sizeof (a))) + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.target/i386/sse-5.c b/gcc/testsuite/gcc.target/i386/sse-5.c index bdbd501..934fad5 100644 --- a/gcc/testsuite/gcc.target/i386/sse-5.c +++ b/gcc/testsuite/gcc.target/i386/sse-5.c @@ -1,7 +1,7 @@ /* { dg-do compile } */ /* { dg-require-effective-target ilp32 } */ /* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=i386" } } */ -/* { dg-options "-Winline -O2 -march=i386" } */ +/* { dg-options "-Winline -Wno-psabi -O2 -march=i386" } */ typedef double v2df __attribute__ ((vector_size (16))); v2df p;