diff options
Diffstat (limited to 'gcc/testsuite')
70 files changed, 1384 insertions, 497 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cbd8f7147bf..d3be0344435 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,178 @@ +2011-10-09 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/38980 + * g++.dg/warn/format5.C: New. + +2011-10-09 Tobias Burnus <burnus@net-b.de> + + PR fortran/45044 + * gfortran.dg/common_14.f90: Compile with -Wno-align-commons. + * gfortran.dg/common_16.f90: New. + +2011-10-09 Tobias Burnus <burnus@net-b.de> + + * gfortran.dg/iso_c_binding_param_1.f90: New. + * gfortran.dg/iso_c_binding_param_2.f90: New. + * gfortran.dg/c_sizeof_2.f90: Update dg-error. + +2011-10-09 Ira Rosen <ira.rosen@linaro.org> + + PR tree-optimization/50635 + * gcc.dg/vect/pr50635.c: New test. + +2011-10-09 Janus Weil <janus@gcc.gnu.org> + + PR fortran/50659 + * gfortran.dg/proc_decl_27.f90: New. + +2011-10-08 Nicola Pero <nicola.pero@meta-innovation.com> + + PR libobjc/50428 + * objc/execute/initialize-1.m: New test. + +2011-10-08 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/47844 + * gfortran.dg/pointer_function_result_1.f90 : New test. + +2011-10-07 David S. Miller <davem@davemloft.net> + + PR 50655 + * gcc.target/sparc/sparc.exp: Add vis3 target test. + * gcc.target/sparc/cmask.c: Use it. + * gcc.target/sparc/fhalve.c: Likewise. + * gcc.target/sparc/fnegop.c: Likewise. + * gcc.target/sparc/fpadds.c: Likewise. + * gcc.target/sparc/fshift.c: Likewise. + * gcc.target/sparc/fucmp.c: Likewise. + * gcc.target/sparc/lzd.c: Likewise. + * gcc.target/sparc/vis3misc.c: Likewise. + * gcc.target/sparc/xmul.c: Likewise. + +2011-10-07 Richard Henderson <rth@redhat.com> + + * gcc.target/i386/avx256-unaligned-load-2.c: Tweek vinsert pattern + match for avx2. + * gcc.target/i386/avx256-unaligned-store-2.c: Similarly. + +2011-10-07 Andrew Stubbs <ams@codesourcery.com> + + * gcc.dg/pr50193-1.c: New file. + * gcc.target/arm/shiftable.c: New file. + +2011-10-07 Janus Weil <janus@gcc.gnu.org> + + PR fortran/50625 + * gfortran.dg/class_46.f03: New. + +2011-10-06 Joern Rennecke <joern.rennecke@embecosm.com> + + * gcc.dg/pr47276.c (ASMNAME, ASMNAME2, STRING): Define. + (__EI___vsyslog_chk, __EI_syslog, __EI_vsyslog): Use ASMNAME. + (syslog, vsyslog, __vsyslog_chk): Likewise. + + * gcc.dg/lto/20081222_1.c (ASMNAME, ASMNAME2, STRING): Define. + (x, EXT_x): Use ASMNAME. + + * gcc.dg/torture/pr48044.c (ASMNAME, ASMNAME2, STRING): Define. + (a, c): Use ASMNAME. + +2011-10-07 Tom de Vries <tom@codesourcery.com> + + PR middle-end/50527 + * gcc.dg/pr50527.c: New test. + +2011-10-07 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/50650 + * gcc.c-torture/compile/pr50650.c: New test. + +2011-10-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR tree-optimization/50575 + * gcc.c-torture/execute/vector-compare-2.x: New file. + +2011-10-07 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + PR middle-end/50125 + * gcc.dg/uninit-B.c (baz): Remove xfail *-*-*. + * gcc.dg/uninit-pr19430.c (main): Remove xfail *-*-*. + (bar3): Likewise. + +2011-10-07 Richard Guenther <rguenther@suse.de> + + PR testsuite/50637 + * gcc.dg/vect/vect-align-2.c: Increase array size. + +2011-10-07 Uros Bizjak <ubizjak@gmail.com> + H.J. Lu <hongjiu.lu@intel.com> + + PR target/50603 + * gcc.target/i386/pr50603.c: New test. + +2011-10-06 Jason Merrill <jason@redhat.com> + + PR c++/39164 + * g++.dg/cpp0x/default31.C: New. + +2011-10-06 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/50596 + * lib/target-supports.exp (check_effective_target_vect_cond_mixed): + New. + * gcc.dg/vect/vect-cond-8.c: New test. + +2011-10-06 Richard Henderson <rth@redhat.com> + + * gcc.c-torture/execute/vect-shuffle-1.c: Remove. + * gcc.c-torture/execute/vect-shuffle-2.c: Remove. + * gcc.c-torture/execute/vect-shuffle-3.c: Remove. + * gcc.c-torture/execute/vect-shuffle-4.c: Remove. + * gcc.c-torture/execute/vect-shuffle-5.c: Remove. + * gcc.c-torture/execute/vect-shuffle-6.c: Remove. + * gcc.c-torture/execute/vect-shuffle-7.c: Remove. + * gcc.c-torture/execute/vect-shuffle-8.c: Remove. + * gcc.c-torture/execute/vshuf-16.inc: New file. + * gcc.c-torture/execute/vshuf-2.inc: New file. + * gcc.c-torture/execute/vshuf-4.inc: New file. + * gcc.c-torture/execute/vshuf-8.inc: New file. + * gcc.c-torture/execute/vshuf-main.inc: New file. + * gcc.c-torture/execute/vshuf-v16qi.c: New test. + * gcc.c-torture/execute/vshuf-v2df.c: New test. + * gcc.c-torture/execute/vshuf-v2di.c: New test. + * gcc.c-torture/execute/vshuf-v2sf.c: New test. + * gcc.c-torture/execute/vshuf-v2si.c: New test. + * gcc.c-torture/execute/vshuf-v4df.c: New test. + * gcc.c-torture/execute/vshuf-v4di.c: New test. + * gcc.c-torture/execute/vshuf-v4hi.c: New test. + * gcc.c-torture/execute/vshuf-v4sf.c: New test. + * gcc.c-torture/execute/vshuf-v4si.c: New test. + * gcc.c-torture/execute/vshuf-v8hi.c: New test. + * gcc.c-torture/execute/vshuf-v8qi.c: New test. + * gcc.c-torture/execute/vshuf-v8si.c: New test. + +2011-10-06 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/49279 + * gcc.dg/tree-ssa/restrict-4.c: XFAIL. + * gcc.c-torture/execute/pr49279.c: New test. + +2011-10-06 Bernd Schmidt <bernds@codesourcery.com> + + PR target/49049 + * gcc.c-torture/compile/pr49049.c: New test. + +2011-10-06 Ulrich Weigand <ulrich.weigand@linaro.org> + + PR target/50305 + * gcc.target/arm/pr50305.c: New test. + +2011-10-06 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/38884 + * gcc.dg/tree-ssa/ssa-fre-34.c: New testcase. + * gcc.dg/tree-ssa/ssa-fre-35.c: Likewise. + 2011-10-05 David S. Miller <davem@davemloft.net> * gcc.target/sparc/lzd.c: New test. @@ -81,8 +256,7 @@ 2011-10-04 Artem Shinkarov <artyom.shinkaroff@gmail.com> - * gcc.c-torture/execute/vector-compare-1.c: Fix trailing white - spaces. + * gcc.c-torture/execute/vector-compare-1.c: Fix trailing white spaces. (main): Use __typeof to get result type of comparison. 2011-10-04 Ira Rosen <ira.rosen@linaro.org> @@ -235,8 +409,8 @@ PR testsuite/50485 * gcc.target/i386/sse4_1-blendps.c: Include <stdlib.h>. (TEST): Initialize src3 with random floats. - * gcc.target/i386/sse4_1-blendps-2.c (sse4_1_test): Remove field i from - union src3. Initialize src3 with random floats. + * gcc.target/i386/sse4_1-blendps-2.c (sse4_1_test): Remove field i + from union src3. Initialize src3 with random floats. 2011-09-27 Oleg Endo <oleg.endo@t-online.de> @@ -596,8 +770,7 @@ 2011-09-20 H.J. Lu <hongjiu.lu@intel.com> PR testsuite/50469 - * gfortran.dg/storage_size_2.f08: Replace "must be be" with - "must be". + * gfortran.dg/storage_size_2.f08: Replace "must be be" with "must be". 2011-09-20 Jason Merrill <jason@redhat.com> @@ -983,8 +1156,7 @@ gcc.dg/vect/vect-54.c, gcc.dg/vect/vect-46.c, gcc.dg/vect/vect-48.c, gcc.dg/vect/vect-96.c, gcc.dg/vect/vect-multitypes-3.c, gcc.dg/vect/vect-40.c: Likewise. - * gcc.dg/vect/vect-outer-5.c: Remove quad-vectors option as - redundant. + * gcc.dg/vect/vect-outer-5.c: Remove quad-vectors option as redundant. * gcc.dg/vect/vect-109.c, gcc.dg/vect/vect-peel-1.c, gcc.dg/vect/vect-peel-2.c, gcc.dg/vect/slp-25.c, gcc.dg/vect/vect-multitypes-1.c, gcc.dg/vect/slp-3.c, @@ -1041,8 +1213,8 @@ 2011-09-05 Georg-Johann Lay <avr@gjlay.de> - * gcc.dg/ipa/ipcp-3.c (mark_cell): Use mask 1 << 14 instead of 1 - << 18 to avoid warning on int=16 platforms.. + * gcc.dg/ipa/ipcp-3.c (mark_cell): Use mask 1 << 14 instead of 1 << 18 + to avoid warning on int=16 platforms.. 2011-09-05 Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted31.C b/gcc/testsuite/g++.dg/cpp0x/defaulted31.C new file mode 100644 index 00000000000..de6a29854a5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted31.C @@ -0,0 +1,16 @@ +// PR c++/39164 +// { dg-options -std=c++0x } + +struct A +{ + A() { } // { dg-error "defined" } + ~A() = default; // { dg-error "defaulted" } +}; + +A::A() = default; // { dg-error "redefinition" } +A::~A() noexcept (true) { } // { dg-error "defaulted" } + +int main() +{ + A a; +} diff --git a/gcc/testsuite/g++.dg/warn/format5.C b/gcc/testsuite/g++.dg/warn/format5.C new file mode 100644 index 00000000000..e219f881092 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/format5.C @@ -0,0 +1,12 @@ +// PR c++/38980 +// { dg-options "-Wformat" } + +extern "C" +int printf(const char *format, ...) __attribute__((format(printf, 1, 2) )); + +const char fmt1[] = "Hello, %s"; + +void f() +{ + printf(fmt1, 3); // { dg-warning "expects argument" } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49049.c b/gcc/testsuite/gcc.c-torture/compile/pr49049.c new file mode 100644 index 00000000000..a24b2a41c75 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr49049.c @@ -0,0 +1,28 @@ +__extension__ typedef unsigned long long int uint64_t; + +static int +sub (int a, int b) +{ + return a - b; +} + +static uint64_t +add (uint64_t a, uint64_t b) +{ + return a + b; +} + +int *ptr; + +int +foo (uint64_t arg1, int *arg2) +{ + int j; + for (; j < 1; j++) + { + *arg2 |= sub ( sub (sub (j || 1 ^ 0x1, 1), arg1 < 0x1 <= + sub (1, *ptr & j)), + (sub ( j != 1 || sub (j && j, 1) >= 0, + add (!j > arg1, 0x35DLL)))); + } +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr50650.c b/gcc/testsuite/gcc.c-torture/compile/pr50650.c new file mode 100644 index 00000000000..6c443e6475c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr50650.c @@ -0,0 +1,10 @@ +/* PR tree-optimization/50650 */ + +unsigned int +foo (unsigned int x, unsigned int y) +{ + int i; + for (i = 8; i--; x <<= 1) + y ^= (x ^ y) & 0x80 ? 79U : 0U; + return y; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr49279.c b/gcc/testsuite/gcc.c-torture/execute/pr49279.c new file mode 100644 index 00000000000..7f2c0d22129 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr49279.c @@ -0,0 +1,35 @@ +/* PR tree-optimization/49279 */ +extern void abort (void); + +struct S { int a; int *__restrict p; }; + +__attribute__((noinline, noclone)) +struct S *bar (struct S *p) +{ + struct S *r; + asm volatile ("" : "=r" (r) : "0" (p) : "memory"); + return r; +} + +__attribute__((noinline, noclone)) +int +foo (int *p, int *q) +{ + struct S s, *t; + s.a = 1; + s.p = p; + t = bar (&s); + t->p = q; + s.p[0] = 0; + t->p[0] = 1; + return s.p[0]; +} + +int +main () +{ + int a, b; + if (foo (&a, &b) != 1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-1.c b/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-1.c deleted file mode 100644 index 3b836362003..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-1.c +++ /dev/null @@ -1,68 +0,0 @@ -#if __SIZEOF_INT__ == 4 -typedef unsigned int V __attribute__((vector_size(16), may_alias)); - -struct S -{ - V in, mask, out; -}; - -struct S tests[] = { - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 0, 1, 2, 3 }, - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - }, - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 0+1*4, 1+2*4, 2+3*4, 3+4*4 }, - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - }, - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 3, 2, 1, 0 }, - { 0x44444444, 0x33333333, 0x22222222, 0x11111111 }, - }, - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 0, 3, 2, 1 }, - { 0x11111111, 0x44444444, 0x33333333, 0x22222222 }, - }, - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 0, 2, 1, 3 }, - { 0x11111111, 0x33333333, 0x22222222, 0x44444444 }, - }, - { - { 0x11223344, 0x55667788, 0x99aabbcc, 0xddeeff00 }, - { 3, 1, 2, 0 }, - { 0xddeeff00, 0x55667788, 0x99aabbcc, 0x11223344 }, - }, - { - { 0x11223344, 0x55667788, 0x99aabbcc, 0xddeeff00 }, - { 0, 0, 0, 0 }, - { 0x11223344, 0x11223344, 0x11223344, 0x11223344 }, - }, - { - { 0x11223344, 0x55667788, 0x99aabbcc, 0xddeeff00 }, - { 1, 2, 1, 2 }, - { 0x55667788, 0x99aabbcc, 0x55667788, 0x99aabbcc }, - } -}; - -extern void abort(void); - -int main() -{ - int i; - - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) - { - V r = __builtin_shuffle(tests[i].in, tests[i].mask); - if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0) - abort(); - } - - return 0; -} - -#endif /* SIZEOF_INT */ diff --git a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-2.c b/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-2.c deleted file mode 100644 index 68ae2256f15..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-2.c +++ /dev/null @@ -1,68 +0,0 @@ -#if __SIZEOF_SHORT__ == 2 -typedef unsigned short V __attribute__((vector_size(16), may_alias)); - -struct S -{ - V in, mask, out; -}; - -struct S tests[] = { - { - { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, - }, - { - { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, - { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87 }, - { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, - }, - { - { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, - { 7, 6, 5, 4, 3, 2, 1, 0 }, - { 0x8888, 0x7777, 0x6666, 0x5555, 0x4444, 0x3333, 0x2222, 0x1111 }, - }, - { - { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, - { 7, 0, 5, 3, 2, 4, 1, 6 }, - { 0x8888, 0x1111, 0x6666, 0x4444, 0x3333, 0x5555, 0x2222, 0x7777 }, - }, - { - { 0x1111, 0x2222, 0x3333, 0x4444, 0x5555, 0x6666, 0x7777, 0x8888 }, - { 0, 2, 1, 3, 4, 6, 5, 7 }, - { 0x1111, 0x3333, 0x2222, 0x4444, 0x5555, 0x7777, 0x6666, 0x8888 }, - }, - { - { 0x1122, 0x3344, 0x5566, 0x7788, 0x99aa, 0xbbcc, 0xddee, 0xff00 }, - { 3, 1, 2, 0, 7, 5, 6, 4 }, - { 0x7788, 0x3344, 0x5566, 0x1122, 0xff00, 0xbbcc, 0xddee, 0x99aa }, - }, - { - { 0x1122, 0x3344, 0x5566, 0x7788, 0x99aa, 0xbbcc, 0xddee, 0xff00 }, - { 0, 0, 0, 0 }, - { 0x1122, 0x1122, 0x1122, 0x1122, 0x1122, 0x1122, 0x1122, 0x1122 }, - }, - { - { 0x1122, 0x3344, 0x5566, 0x7788, 0x99aa, 0xbbcc, 0xddee, 0xff00 }, - { 1, 6, 1, 6, 1, 6, 1, 6 }, - { 0x3344, 0xddee, 0x3344, 0xddee, 0x3344, 0xddee, 0x3344, 0xddee }, - } -}; - -extern void abort(void); - -int main() -{ - int i; - - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) - { - V r = __builtin_shuffle(tests[i].in, tests[i].mask); - if (memcmp(&r, &tests[i].out, sizeof(V)) != 0) - abort(); - } - - return 0; -} - -#endif /* SIZEOF_SHORT */ diff --git a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-3.c b/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-3.c deleted file mode 100644 index 96aee650994..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-3.c +++ /dev/null @@ -1,58 +0,0 @@ -#if __SIZEOF_LONG_LONG__ == 8 -typedef unsigned long long V __attribute__((vector_size(16), may_alias)); - -struct S -{ - V in, mask, out; -}; - -struct S tests[] = { - { - { 0x1111111111111111, 0x2222222222222222 }, - { 0, 1 }, - { 0x1111111111111111, 0x2222222222222222 }, - }, - { - { 0x1111111111111111, 0x2222222222222222 }, - { 0x0102030405060700, 0xffeeddccbbaa99f1 }, - { 0x1111111111111111, 0x2222222222222222 }, - }, - { - { 0x1111111111111111, 0x2222222222222222 }, - { 1, 0 }, - { 0x2222222222222222, 0x1111111111111111 }, - }, - { - { 0x1111111111111111, 0x2222222222222222 }, - { 0, 0 }, - { 0x1111111111111111, 0x1111111111111111 }, - }, - { - { 0x1122334455667788, 0x99aabbccddeeff00 }, - { 1, 1 }, - { 0x99aabbccddeeff00, 0x99aabbccddeeff00 }, - }, - { - { 0x1122334455667788, 0x99aabbccddeeff00 }, - { 1, 0 }, - { 0x99aabbccddeeff00, 0x1122334455667788 }, - }, -}; - -extern void abort(void); - -int main() -{ - int i; - - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) - { - V r = __builtin_shuffle(tests[i].in, tests[i].mask); - if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0) - abort(); - } - - return 0; -} - -#endif /* SIZEOF_LONG_LONG */ diff --git a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-4.c b/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-4.c deleted file mode 100644 index fa036eb0093..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-4.c +++ /dev/null @@ -1,51 +0,0 @@ -typedef unsigned char V __attribute__((vector_size(16), may_alias)); - -struct S -{ - V in, mask, out; -}; - -struct S tests[] = { - { - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, - { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, }, - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, - }, - { - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, - { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87, - 0x98, 0xa9, 0xba, 0xcb, 0xdc, 0xed, 0xfe, 0xff }, - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, - }, - { - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, - { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, - { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }, - }, - { - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, - { 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15 }, - { 1, 3, 5, 7, 9, 11, 13, 15, 2, 4, 6, 8, 10, 12, 14, 16 }, - }, - { - { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, - { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, - }, -}; - -extern void abort(void); - -int main() -{ - int i; - - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) - { - V r = __builtin_shuffle(tests[i].in, tests[i].mask); - if (memcmp(&r, &tests[i].out, sizeof(V)) != 0) - abort(); - } - - return 0; -} diff --git a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-5.c b/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-5.c deleted file mode 100644 index f07025d567e..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-5.c +++ /dev/null @@ -1,64 +0,0 @@ -#if __SIZEOF_INT__ == 4 -typedef unsigned int V __attribute__((vector_size(16), may_alias)); - -struct S -{ - V in1, in2, mask, out; -}; - -struct S tests[] = { - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 0x55555555, 0x66666666, 0x77777777, 0x88888888 }, - { 0, 1, 2, 3 }, - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - }, - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 0x55555555, 0x66666666, 0x77777777, 0x88888888 }, - { 4, 5, 6, 7 }, - { 0x55555555, 0x66666666, 0x77777777, 0x88888888 }, - }, - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 0x55555555, 0x66666666, 0x77777777, 0x88888888 }, - { 0, 4, 1, 5 }, - { 0x11111111, 0x55555555, 0x22222222, 0x66666666 }, - }, - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 0x55555555, 0x66666666, 0x77777777, 0x88888888 }, - { 0, 7, 4, 3 }, - { 0x11111111, 0x88888888, 0x55555555, 0x44444444 }, - }, - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 0x55555555, 0x66666666, 0x77777777, 0x88888888 }, - { 0, 0, 0, 0 }, - { 0x11111111, 0x11111111, 0x11111111, 0x11111111 }, - }, - { - { 0x11111111, 0x22222222, 0x33333333, 0x44444444 }, - { 0x55555555, 0x66666666, 0x77777777, 0x88888888 }, - { 7, 7, 7, 7 }, - { 0x88888888, 0x88888888, 0x88888888, 0x88888888 }, - }, -}; - -extern void abort(void); - -int main() -{ - int i; - - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) - { - V r = __builtin_shuffle(tests[i].in1, tests[i].in2, tests[i].mask); - if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0) - abort(); - } - - return 0; -} - -#endif /* SIZEOF_INT */ diff --git a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-6.c b/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-6.c deleted file mode 100644 index 63eaf96900e..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-6.c +++ /dev/null @@ -1,64 +0,0 @@ -#if __SIZEOF_SHORT__ == 2 -typedef unsigned short V __attribute__((vector_size(16), may_alias)); - -struct S -{ - V in1, in2, mask, out; -}; - -struct S tests[] = { - { - { 0x1010, 0x2121, 0x3232, 0x4343, 0x5454, 0x6565, 0x7676, 0x8787 }, - { 0x9898, 0xa9a9, 0xbaba, 0xcbcb, 0xdcdc, 0xeded, 0xfefe, 0x0f0f }, - { 0, 1, 2, 3, 4, 5, 6, 7 }, - { 0x1010, 0x2121, 0x3232, 0x4343, 0x5454, 0x6565, 0x7676, 0x8787 }, - }, - { - { 0x1010, 0x2121, 0x3232, 0x4343, 0x5454, 0x6565, 0x7676, 0x8787 }, - { 0x9898, 0xa9a9, 0xbaba, 0xcbcb, 0xdcdc, 0xeded, 0xfefe, 0x0f0f }, - { 8, 9, 10, 11, 12, 13, 14, 15 }, - { 0x9898, 0xa9a9, 0xbaba, 0xcbcb, 0xdcdc, 0xeded, 0xfefe, 0x0f0f }, - }, - { - { 0x1010, 0x2121, 0x3232, 0x4343, 0x5454, 0x6565, 0x7676, 0x8787 }, - { 0x9898, 0xa9a9, 0xbaba, 0xcbcb, 0xdcdc, 0xeded, 0xfefe, 0x0f0f }, - { 0, 8, 1, 9, 2, 10, 3, 11 }, - { 0x1010, 0x9898, 0x2121, 0xa9a9, 0x3232, 0xbaba, 0x4343, 0xcbcb }, - }, - { - { 0x1010, 0x2121, 0x3232, 0x4343, 0x5454, 0x6565, 0x7676, 0x8787 }, - { 0x9898, 0xa9a9, 0xbaba, 0xcbcb, 0xdcdc, 0xeded, 0xfefe, 0x0f0f }, - { 0, 15, 4, 11, 12, 3, 7, 8 }, - { 0x1010, 0x0f0f, 0x5454, 0xcbcb, 0xdcdc, 0x4343, 0x8787, 0x9898 }, - }, - { - { 0x1010, 0x2121, 0x3232, 0x4343, 0x5454, 0x6565, 0x7676, 0x8787 }, - { 0x9898, 0xa9a9, 0xbaba, 0xcbcb, 0xdcdc, 0xeded, 0xfefe, 0x0f0f }, - { 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010 }, - }, - { - { 0x1010, 0x2121, 0x3232, 0x4343, 0x5454, 0x6565, 0x7676, 0x8787 }, - { 0x9898, 0xa9a9, 0xbaba, 0xcbcb, 0xdcdc, 0xeded, 0xfefe, 0x0f0f }, - { 14, 14, 14, 14, 14, 14, 14, 14 }, - { 0xfefe, 0xfefe, 0xfefe, 0xfefe, 0xfefe, 0xfefe, 0xfefe, 0xfefe }, - }, -}; - -extern void abort(void); - -int main() -{ - int i; - - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) - { - V r = __builtin_shuffle(tests[i].in1, tests[i].in2, tests[i].mask); - if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0) - abort(); - } - - return 0; -} - -#endif /* SIZEOF_SHORT */ diff --git a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-7.c b/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-7.c deleted file mode 100644 index 3336c6f7bd5..00000000000 --- a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-7.c +++ /dev/null @@ -1,70 +0,0 @@ -#if __SIZEOF_LONG_LONG__ == 8 -typedef unsigned long long V __attribute__((vector_size(16), may_alias)); - -struct S -{ - V in1, in2, mask, out; -}; - -struct S tests[] = { - { - { 0x1112131415161718, 0x2122232425262728 }, - { 0x3132333435363738, 0x4142434445464748 }, - { 0, 1 }, - { 0x1112131415161718, 0x2122232425262728 }, - }, - { - { 0x1112131415161718, 0x2122232425262728 }, - { 0x3132333435363738, 0x4142434445464748 }, - { 2, 3 }, - { 0x3132333435363738, 0x4142434445464748 }, - }, - { - { 0x1112131415161718, 0x2122232425262728 }, - { 0x3132333435363738, 0x4142434445464748 }, - { 0, 2 }, - { 0x1112131415161718, 0x3132333435363738 }, - }, - { - { 0x1112131415161718, 0x2122232425262728 }, - { 0x3132333435363738, 0x4142434445464748 }, - { 2, 1 }, - { 0x3132333435363738, 0x2122232425262728 }, - }, - { - { 0x1112131415161718, 0x2122232425262728 }, - { 0x3132333435363738, 0x4142434445464748 }, - { 3, 0 }, - { 0x4142434445464748, 0x1112131415161718 }, - }, - { - { 0x1112131415161718, 0x2122232425262728 }, - { 0x3132333435363738, 0x4142434445464748 }, - { 0, 0 }, - { 0x1112131415161718, 0x1112131415161718 }, - }, - { - { 0x1112131415161718, 0x2122232425262728 }, - { 0x3132333435363738, 0x4142434445464748 }, - { 3, 3 }, - { 0x4142434445464748, 0x4142434445464748 }, - }, -}; - -extern void abort(void); - -int main() -{ - int i; - - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) - { - V r = __builtin_shuffle(tests[i].in1, tests[i].in2, tests[i].mask); - if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0) - abort(); - } - - return 0; -} - -#endif /* SIZEOF_LONG_LONG */ diff --git a/gcc/testsuite/gcc.c-torture/execute/vector-compare-2.x b/gcc/testsuite/gcc.c-torture/execute/vector-compare-2.x new file mode 100644 index 00000000000..cb7b119b8cb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vector-compare-2.x @@ -0,0 +1,2 @@ +set additional_flags "-Wno-psabi" +return 0 diff --git a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-8.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-16.inc index f98e6ec99e2..68f2646d860 100644 --- a/gcc/testsuite/gcc.c-torture/execute/vect-shuffle-8.c +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-16.inc @@ -1,12 +1,52 @@ -typedef unsigned char V __attribute__((vector_size(16), may_alias)); +/* Test fragment for vectors with 16 elements. */ + +#ifndef UNSUPPORTED struct S { - V in1, in2, mask, out; + V in; + VI mask; + V out; }; struct S tests[] = { { + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, }, + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, + }, + { + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, + { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87, + 0x98, 0xa9, 0xba, 0xcb, 0xdc, 0xed, 0xfe, 0xff }, + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, + }, + { + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, + { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }, + }, + { + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, + { 0, 2, 4, 6, 8, 10, 12, 14, 1, 3, 5, 7, 9, 11, 13, 15 }, + { 1, 3, 5, 7, 9, 11, 13, 15, 2, 4, 6, 8, 10, 12, 14, 16 }, + }, + { + { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 }, + { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 }, + { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }, + }, +}; + +struct S2 +{ + V in1, in2; + VI mask; + V out; +}; + +struct S2 tests2[] = { + { { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 }, { 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45 }, { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }, @@ -38,18 +78,4 @@ struct S tests[] = { }, }; -extern void abort(void); - -int main() -{ - int i; - - for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) - { - V r = __builtin_shuffle(tests[i].in1, tests[i].in2, tests[i].mask); - if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0) - abort(); - } - - return 0; -} +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-2.inc b/gcc/testsuite/gcc.c-torture/execute/vshuf-2.inc new file mode 100644 index 00000000000..ef778e59418 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-2.inc @@ -0,0 +1,38 @@ +/* Test fragment for vectors of 2 elements. */ + +#ifndef UNSUPPORTED + +struct S +{ + V in; + VI mask; + V out; +}; + +struct S tests[] = { + { { A, B }, { 0, 1 }, { A, B } }, + { { A, B }, { -16, -1 }, { A, B } }, + { { A, B }, { 1, 0 }, { B, A } }, + { { A, B }, { 0, 0 }, { A, A } }, + { { X, Y }, { 1, 1 }, { Y, Y } }, + { { X, Y }, { 1, 0 }, { Y, X } }, +}; + +struct S2 +{ + V in1, in2; + VI mask; + V out; +}; + +struct S2 tests2[] = { + { { A, B }, { X, Y }, { 0, 1 }, { A, B } }, + { { A, B }, { X, Y }, { 2, 3 }, { X, Y } }, + { { A, B }, { X, Y }, { 0, 2 }, { A, X } }, + { { A, B }, { X, Y }, { 2, 1 }, { X, B } }, + { { A, B }, { X, Y }, { 3, 0 }, { Y, A } }, + { { A, B }, { X, Y }, { 0, 0 }, { A, A } }, + { { A, B }, { X, Y }, { 3, 3 }, { Y, Y } }, +}; + +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-4.inc b/gcc/testsuite/gcc.c-torture/execute/vshuf-4.inc new file mode 100644 index 00000000000..d6e6e102295 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-4.inc @@ -0,0 +1,39 @@ +/* Test fragment for vectors of 4 elements. */ + +#ifndef UNSUPPORTED + +struct S +{ + V in; + VI mask; + V out; +}; + +struct S tests[] = { + { { A, B, C, D }, { 0, 1, 2, 3 }, { A, B, C, D }, }, + { { A, B, C, D }, { 0+1*4, 1+2*4, 2+3*4, 3+4*4 }, { A, B, C, D } }, + { { A, B, C, D }, { 3, 2, 1, 0 }, { D, C, B, A } }, + { { A, B, C, D }, { 0, 3, 2, 1 }, { A, D, C, B } }, + { { A, B, C, D }, { 0, 2, 1, 3 }, { A, C, B, D } }, + { { W, X, Y, Z }, { 3, 1, 2, 0 }, { Z, X, Y, W } }, + { { W, X, Y, Z }, { 0, 0, 0, 0 }, { W, W, W, W } }, + { { W, X, Y, Z }, { 1, 2, 1, 2 }, { X, Y, X, Y } }, +}; + +struct S2 +{ + V in1, in2; + VI mask; + V out; +}; + +struct S2 tests2[] = { + { { A, B, C, D }, { W, X, Y, Z }, { 0, 1, 2, 3 }, { A, B, C, D } }, + { { A, B, C, D }, { W, X, Y, Z }, { 4, 5, 6, 7 }, { W, X, Y, Z } }, + { { A, B, C, D }, { W, X, Y, Z }, { 0, 4, 1, 5 }, { A, W, B, X } }, + { { A, B, C, D }, { W, X, Y, Z }, { 0, 7, 4, 3 }, { A, Z, W, D } }, + { { A, B, C, D }, { W, X, Y, Z }, { 0, 0, 0, 0 }, { A, A, A, A } }, + { { A, B, C, D }, { W, X, Y, Z }, { 7, 7, 7, 7 }, { Z, Z, Z, Z } }, +}; + +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-8.inc b/gcc/testsuite/gcc.c-torture/execute/vshuf-8.inc new file mode 100644 index 00000000000..e6475226a11 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-8.inc @@ -0,0 +1,101 @@ +/* Test fragment for vectors of 8 elements. */ + +#ifndef UNSUPPORTED + +struct S +{ + V in; + VI mask; + V out; +}; + +struct S tests[] = { + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { A1, B1, C1, D1, E1, F1, G1, H1 }, + }, + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { 0x10, 0x21, 0x32, 0x43, 0x54, 0x65, 0x76, 0x87 }, + { A1, B1, C1, D1, E1, F1, G1, H1 }, + }, + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { 7, 6, 5, 4, 3, 2, 1, 0 }, + { H1, G1, F1, E1, D1, C1, B1, A1 }, + }, + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { 7, 0, 5, 3, 2, 4, 1, 6 }, + { H1, A1, F1, D1, C1, E1, B1, G1 }, + }, + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { 0, 2, 1, 3, 4, 6, 5, 7 }, + { A1, C1, B1, D1, E1, G1, F1, H1 }, + }, + { + { A2, B2, C2, D2, E2, F2, G2, H2 }, + { 3, 1, 2, 0, 7, 5, 6, 4 }, + { D2, B2, C2, A2, H2, F2, G2, E2 }, + }, + { + { A2, B2, C2, D2, E2, F2, G2, H2 }, + { 0, 0, 0, 0 }, + { A2, A2, A2, A2, A2, A2, A2, A2 }, + }, + { + { A2, B2, C2, D2, E2, F2, G2, H2 }, + { 1, 6, 1, 6, 1, 6, 1, 6 }, + { B2, G2, B2, G2, B2, G2, B2, G2 }, + } +}; + +struct S2 +{ + V in1, in2; + VI mask; + V out; +}; + +struct S2 tests2[] = { + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { A2, B2, C2, D2, E2, F2, G2, H2 }, + { 0, 1, 2, 3, 4, 5, 6, 7 }, + { A1, B1, C1, D1, E1, F1, G1, H1 }, + }, + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { A2, B2, C2, D2, E2, F2, G2, H2 }, + { 8, 9, 10, 11, 12, 13, 14, 15 }, + { A2, B2, C2, D2, E2, F2, G2, H2 }, + }, + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { A2, B2, C2, D2, E2, F2, G2, H2 }, + { 0, 8, 1, 9, 2, 10, 3, 11 }, + { A1, A2, B1, B2, C1, C2, D1, D2 }, + }, + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { A2, B2, C2, D2, E2, F2, G2, H2 }, + { 0, 15, 4, 11, 12, 3, 7, 8 }, + { A1, H2, E1, D2, E2, D1, H1, A2 }, + }, + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { A2, B2, C2, D2, E2, F2, G2, H2 }, + { 0, 0, 0, 0, 0, 0, 0, 0 }, + { A1, A1, A1, A1, A1, A1, A1, A1 }, + }, + { + { A1, B1, C1, D1, E1, F1, G1, H1 }, + { A2, B2, C2, D2, E2, F2, G2, H2 }, + { 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x8e }, + { G2, G2, G2, G2, G2, G2, G2, G2 }, + }, +}; + +#endif diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-main.inc b/gcc/testsuite/gcc.c-torture/execute/vshuf-main.inc new file mode 100644 index 00000000000..8487131b12d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-main.inc @@ -0,0 +1,26 @@ +/* Driver fragment for __builtin_shuffle of any vector shape. */ + +extern void abort(void); + +int main() +{ +#ifndef UNSUPPORTED + int i; + + for (i = 0; i < sizeof(tests)/sizeof(tests[0]); ++i) + { + V r = __builtin_shuffle(tests[i].in, tests[i].mask); + if (__builtin_memcmp(&r, &tests[i].out, sizeof(V)) != 0) + abort(); + } + + for (i = 0; i < sizeof(tests2)/sizeof(tests2[0]); ++i) + { + V r = __builtin_shuffle(tests2[i].in1, tests2[i].in2, tests2[i].mask); + if (__builtin_memcmp(&r, &tests2[i].out, sizeof(V)) != 0) + abort(); + } +#endif + + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v16qi.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v16qi.c new file mode 100644 index 00000000000..dcd1de1e646 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v16qi.c @@ -0,0 +1,5 @@ +typedef unsigned char V __attribute__((vector_size(16))); +typedef V VI; + +#include "vshuf-16.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2df.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2df.c new file mode 100644 index 00000000000..e88ec08ddf6 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2df.c @@ -0,0 +1,15 @@ +#if __SIZEOF_DOUBLE__ == 8 && __SIZEOF_LONG_LONG__ == 8 +typedef double V __attribute__((vector_size(16))); +typedef unsigned long long VI __attribute__((vector_size(16))); +#else +#define UNSUPPORTED +#endif + +#define A 0.69314718055994530942 +#define B 2.7182818284590452354 + +#define X 3.14159265358979323846 +#define Y 1.41421356237309504880 + +#include "vshuf-2.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2di.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2di.c new file mode 100644 index 00000000000..0985a0de02a --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2di.c @@ -0,0 +1,15 @@ +#if __SIZEOF_LONG_LONG__ == 8 +typedef unsigned long long V __attribute__((vector_size(16))); +typedef V VI; +#else +#define UNSUPPORTED +#endif + +#define A 0x1112131415161718 +#define B 0x2122232425262728 + +#define X 0xc1c2c3c4c5c6c7c8 +#define Y 0xd1d2d3d4d5d6d7d8 + +#include "vshuf-2.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2sf.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2sf.c new file mode 100644 index 00000000000..f9c40b22391 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2sf.c @@ -0,0 +1,21 @@ +#if __SIZEOF_FLOAT__ == 4 +typedef float V __attribute__((vector_size(8))); +# if __SIZEOF_INT__ == 4 +typedef unsigned int VI __attribute__((vector_size(8))); +# elif __SIZEOF_LONG__ == 4 +typedef unsigned long VI __attribute__((vector_size(8))); +# else +# define UNSUPPORTED +# endif +#else +# define UNSUPPORTED +#endif + +#define A 0.69314718055994530942f +#define B 2.7182818284590452354f + +#define X 3.14159265358979323846f +#define Y 1.41421356237309504880f + +#include "vshuf-2.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v2si.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2si.c new file mode 100644 index 00000000000..414743c892f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v2si.c @@ -0,0 +1,18 @@ +#if __SIZEOF_INT__ == 4 +typedef unsigned int V __attribute__((vector_size(8))); +typedef V VI; +#elif __SIZEOF_LONG__ == 4 +typedef unsigned long V __attribute__((vector_size(8))); +typedef V VI; +#else +#define UNSUPPORTED +#endif + +#define A 0x11121314 +#define B 0x21222324 + +#define X 0xd1d2d3d4 +#define Y 0xe1e2e3e4 + +#include "vshuf-2.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4df.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4df.c new file mode 100644 index 00000000000..c4030a7dbab --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4df.c @@ -0,0 +1,19 @@ +#if __SIZEOF_DOUBLE__ == 8 && __SIZEOF_LONG_LONG__ == 8 +typedef double V __attribute__((vector_size(32))); +typedef unsigned long long VI __attribute__((vector_size(32))); +#else +#define UNSUPPORTED +#endif + +#define A 0.69314718055994530942 +#define B 2.7182818284590452354 +#define C 2.30258509299404568402 +#define D 1.4426950408889634074 + +#define W 0.31830988618379067154 +#define X 3.14159265358979323846 +#define Y 1.41421356237309504880 +#define Z 0.70710678118654752440 + +#include "vshuf-4.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4di.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4di.c new file mode 100644 index 00000000000..a84aebefb6d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4di.c @@ -0,0 +1,19 @@ +#if __SIZEOF_LONG_LONG__ == 8 +typedef unsigned long long V __attribute__((vector_size(32))); +typedef V VI; +#else +#define UNSUPPORTED +#endif + +#define A 0x1112131415161718 +#define B 0x2122232425262728 +#define C 0x3132333435363738 +#define D 0x4142434445464748 + +#define W 0xc1c2c3c4c5c6c7c8 +#define X 0xd1d2d3d4d5d6d7d8 +#define Y 0xe1e2e3e4e5e6e7e8 +#define Z 0xf1f2f3f4f5f6f7f8 + +#include "vshuf-4.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4hi.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4hi.c new file mode 100644 index 00000000000..64a2bb4ac82 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4hi.c @@ -0,0 +1,15 @@ +typedef unsigned short V __attribute__((vector_size(8))); +typedef V VI; + +#define A 0x1112 +#define B 0x2122 +#define C 0x3132 +#define D 0x4142 + +#define W 0xc1c2 +#define X 0xd1d2 +#define Y 0xe1e2 +#define Z 0xf1f2 + +#include "vshuf-4.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4sf.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4sf.c new file mode 100644 index 00000000000..283672560a3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4sf.c @@ -0,0 +1,25 @@ +#if __SIZEOF_FLOAT__ == 4 +typedef float V __attribute__((vector_size(16))); +# if __SIZEOF_INT__ == 4 +typedef unsigned int VI __attribute__((vector_size(16))); +# elif __SIZEOF_LONG__ == 4 +typedef unsigned long VI __attribute__((vector_size(16))); +# else +# define UNSUPPORTED +# endif +#else +# define UNSUPPORTED +#endif + +#define A 0.69314718055994530942f +#define B 2.7182818284590452354f +#define C 2.30258509299404568402f +#define D 1.4426950408889634074f + +#define W 0.31830988618379067154f +#define X 3.14159265358979323846f +#define Y 1.41421356237309504880f +#define Z 0.70710678118654752440f + +#include "vshuf-4.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v4si.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4si.c new file mode 100644 index 00000000000..289ec1b5016 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v4si.c @@ -0,0 +1,22 @@ +#if __SIZEOF_INT__ == 4 +typedef unsigned int V __attribute__((vector_size(16))); +typedef V VI; +#elif __SIZEOF_LONG__ == 4 +typedef unsigned long V __attribute__((vector_size(16))); +typedef V VI; +#else +# define UNSUPPORTED +#endif + +#define A 0x11121314 +#define B 0x21222324 +#define C 0x31323334 +#define D 0x41424344 + +#define W 0xc1c2c3c4 +#define X 0xd1d2d3d4 +#define Y 0xe1e2e3e4 +#define Z 0xf1f2f3f4 + +#include "vshuf-4.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v8hi.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v8hi.c new file mode 100644 index 00000000000..ce442c5d995 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v8hi.c @@ -0,0 +1,23 @@ +typedef unsigned short V __attribute__((vector_size(16))); +typedef V VI; + +#define A1 0x1112 +#define B1 0x2122 +#define C1 0x3132 +#define D1 0x4142 +#define E1 0x5152 +#define F1 0x6162 +#define G1 0x7172 +#define H1 0x8182 + +#define A2 0x9192 +#define B2 0xa1a2 +#define C2 0xb1b2 +#define D2 0xc1c2 +#define E2 0xd1d2 +#define F2 0xe1e2 +#define G2 0xf1f2 +#define H2 0x0102 + +#include "vshuf-8.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v8qi.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v8qi.c new file mode 100644 index 00000000000..349ec6db699 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v8qi.c @@ -0,0 +1,23 @@ +typedef unsigned char V __attribute__((vector_size(8))); +typedef V VI; + +#define A1 0x11 +#define B1 0x12 +#define C1 0x13 +#define D1 0x14 +#define E1 0x15 +#define F1 0x16 +#define G1 0x17 +#define H1 0x18 + +#define A2 0xf1 +#define B2 0xf2 +#define C2 0xf3 +#define D2 0xf4 +#define E2 0xf5 +#define F2 0xf6 +#define G2 0xf7 +#define H2 0xf8 + +#include "vshuf-8.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.c-torture/execute/vshuf-v8si.c b/gcc/testsuite/gcc.c-torture/execute/vshuf-v8si.c new file mode 100644 index 00000000000..5b0a2c33e2c --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/vshuf-v8si.c @@ -0,0 +1,30 @@ +#if __SIZEOF_INT__ == 4 +typedef unsigned int V __attribute__((vector_size(32))); +typedef V VI; +#elif __SIZEOF_LONG__ == 4 +typedef unsigned long V __attribute__((vector_size(32))); +typedef V VI; +#else +# define UNSUPPORTED +#endif + +#define A1 0x11121314 +#define B1 0x21222324 +#define C1 0x31323334 +#define D1 0x41424344 +#define E1 0x51525354 +#define F1 0x61626364 +#define G1 0x71727374 +#define H1 0x81828384 + +#define A2 0x91929394 +#define B2 0xa1a2a3a4 +#define C2 0xb1b2b3b4 +#define D2 0xc1c2c3c4 +#define E2 0xd1d2d3d4 +#define F2 0xe1e2e3e4 +#define G2 0xf1f2f3f4 +#define H2 0x01020304 + +#include "vshuf-8.inc" +#include "vshuf-main.inc" diff --git a/gcc/testsuite/gcc.dg/lto/20081222_1.c b/gcc/testsuite/gcc.dg/lto/20081222_1.c index e8f9254421b..755eb9918e9 100644 --- a/gcc/testsuite/gcc.dg/lto/20081222_1.c +++ b/gcc/testsuite/gcc.dg/lto/20081222_1.c @@ -1,8 +1,12 @@ #include "20081222_0.h" +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) STRING (prefix) cname +#define STRING(x) #x + /* Actually, call "x" "INT_X", and make it hidden. */ extern __typeof (x) x - __asm__ ("INT_x") + __asm__ (ASMNAME ("INT_x")) __attribute__ ((__visibility__ ("hidden"))); int x () @@ -12,5 +16,5 @@ int x () /* Make an externally-visible symbol "X" that's an alias for INT_x. */ extern __typeof (x) EXT_x - __asm__ ("x") + __asm__ (ASMNAME ("x")) __attribute__ ((__alias__ ("INT_x"))); diff --git a/gcc/testsuite/gcc.dg/pr47276.c b/gcc/testsuite/gcc.dg/pr47276.c index 3fa1a0e49a8..9276b1a6854 100644 --- a/gcc/testsuite/gcc.dg/pr47276.c +++ b/gcc/testsuite/gcc.dg/pr47276.c @@ -1,6 +1,11 @@ /* { dg-do compile } */ /* { dg-require-alias "" } */ /* { dg-require-visibility "" } */ + +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) STRING (prefix) cname +#define STRING(x) #x + extern void syslog (int __pri, __const char *__fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); extern void vsyslog (int __pri, __const char *__fmt, int __ap) @@ -17,15 +22,15 @@ void __vsyslog_chk(int pri, int flag, const char *fmt, int ap) { } -extern __typeof (__vsyslog_chk) __EI___vsyslog_chk __asm__("" "__vsyslog_chk"); extern __typeof (__vsyslog_chk) __EI___vsyslog_chk __attribute__((alias ("" "__GI___vsyslog_chk"))); +extern __typeof (__vsyslog_chk) __EI___vsyslog_chk __asm__("" ASMNAME ("__vsyslog_chk")); extern __typeof (__vsyslog_chk) __EI___vsyslog_chk __attribute__((alias ("" "__GI___vsyslog_chk"))); void __syslog(int pri, const char *fmt, ...) { } extern __typeof (__syslog) syslog __attribute__ ((alias ("__syslog"))); -extern __typeof (syslog) __EI_syslog __asm__("" "syslog"); extern __typeof (syslog) __EI_syslog __attribute__((alias ("" "__GI_syslog"))); +extern __typeof (syslog) __EI_syslog __asm__("" ASMNAME ("syslog")); extern __typeof (syslog) __EI_syslog __attribute__((alias ("" "__GI_syslog"))); extern __typeof (__vsyslog) vsyslog __attribute__ ((alias ("__vsyslog"))); -extern __typeof (vsyslog) __EI_vsyslog __asm__("" "vsyslog"); extern __typeof (vsyslog) __EI_vsyslog __attribute__((alias ("" "__GI_vsyslog"))); -extern __typeof (syslog) syslog __asm__ ("" "__GI_syslog") __attribute__ ((visibility ("hidden"))); -extern __typeof (vsyslog) vsyslog __asm__ ("" "__GI_vsyslog") __attribute__ ((visibility ("hidden"))); -extern __typeof (__vsyslog_chk) __vsyslog_chk __asm__ ("" "__GI___vsyslog_chk") __attribute__ ((visibility ("hidden"))); +extern __typeof (vsyslog) __EI_vsyslog __asm__("" ASMNAME ("vsyslog")); extern __typeof (vsyslog) __EI_vsyslog __attribute__((alias ("" "__GI_vsyslog"))); +extern __typeof (syslog) syslog __asm__ ("" ASMNAME ("__GI_syslog")) __attribute__ ((visibility ("hidden"))); +extern __typeof (vsyslog) vsyslog __asm__ ("" ASMNAME ("__GI_vsyslog")) __attribute__ ((visibility ("hidden"))); +extern __typeof (__vsyslog_chk) __vsyslog_chk __asm__ ("" ASMNAME ("__GI___vsyslog_chk")) __attribute__ ((visibility ("hidden"))); diff --git a/gcc/testsuite/gcc.dg/pr50193-1.c b/gcc/testsuite/gcc.dg/pr50193-1.c new file mode 100644 index 00000000000..6abc9c40570 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr50193-1.c @@ -0,0 +1,10 @@ +/* PR 50193: ARM: ICE on a | (b << negative-constant) */ +/* Ensure that the compiler doesn't ICE. */ + +/* { dg-options "-O2" } */ + +int +foo(int a, int b) +{ + return a | (b << -3); /* { dg-warning "left shift count is negative" } */ +} diff --git a/gcc/testsuite/gcc.dg/pr50527.c b/gcc/testsuite/gcc.dg/pr50527.c new file mode 100644 index 00000000000..87fae9659d5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr50527.c @@ -0,0 +1,46 @@ +/* { dg-do run } */ +/* { dg-options "-Os --param large-stack-frame=30" } */ + +extern void abort (void); + +void __attribute__((noinline)) +bar (char *a) +{ +} + +void __attribute__((noinline)) +foo (char *a, int b) +{ +} + +void __attribute__((noinline)) +test_align (char *p, int aligned, unsigned int mask) +{ + int p_aligned = ((unsigned long int)p & mask) == 0; + if (aligned != p_aligned) + abort (); +} + +int +main () +{ + const int kIterations = 4; + char results[kIterations]; + int i; + unsigned int mask; + + mask = 0xf; + test_align (results, ((unsigned long int)results & mask) == 0, mask); + mask = 0x7; + test_align (results, ((unsigned long int)results & mask) == 0, mask); + mask = 0x3; + test_align (results, ((unsigned long int)results & mask) == 0, mask); + mask = 0x1; + test_align (results, ((unsigned long int)results & mask) == 0, mask); + + bar (results); + for (i = 0; i < kIterations; i++) + foo ("%d ", results[i]); + + return 0; +} diff --git a/gcc/testsuite/gcc.dg/torture/pr48044.c b/gcc/testsuite/gcc.dg/torture/pr48044.c index fe3b73402cc..d20a634a119 100644 --- a/gcc/testsuite/gcc.dg/torture/pr48044.c +++ b/gcc/testsuite/gcc.dg/torture/pr48044.c @@ -2,6 +2,10 @@ /* { dg-do compile } */ /* { dg-require-alias "" } */ -int a __asm__ ("b") = 0; -extern int c __asm__ ("a") __attribute__ ((alias ("b"))); +#define ASMNAME(cname) ASMNAME2 (__USER_LABEL_PREFIX__, cname) +#define ASMNAME2(prefix, cname) STRING (prefix) cname +#define STRING(x) #x + +int a __asm__ (ASMNAME ("b")) = 0; +extern int c __asm__ (ASMNAME ("a")) __attribute__ ((alias ("b"))); extern int d __attribute__ ((weak, alias ("a"))); diff --git a/gcc/testsuite/gcc.dg/tree-ssa/restrict-4.c b/gcc/testsuite/gcc.dg/tree-ssa/restrict-4.c index a307c89f487..7bcdcdd053a 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/restrict-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/restrict-4.c @@ -22,5 +22,5 @@ bar (int *x, int y) return p1[y]; } -/* { dg-final { scan-tree-dump-times "return 1;" 2 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "return 1;" 2 "optimized" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-34.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-34.c new file mode 100644 index 00000000000..b0b54a22865 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-34.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre1-details" } */ + +#define vector __attribute__((vector_size(16) )) + +struct { + float i; + vector float global_res; +} s; +float foo(float f) +{ + vector float res = (vector float){0.0f,f,0.0f,1.0f}; + s.global_res = res; + return *((float*)&s.global_res + 1); +} + +/* { dg-final { scan-tree-dump "Replaced BIT_FIELD_REF.*with f" "fre1" } } */ +/* { dg-final { cleanup-tree-dump "fre1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-35.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-35.c new file mode 100644 index 00000000000..dfbd7c1bb48 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-35.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre1-details" } */ + +struct s { _Complex float i; }; +void g(struct s *); + +float a1 (float dd) +{ + struct s sv; + sv.i = dd; + float d = __real__ sv.i; + g(&sv); + return d; +} + +/* { dg-final { scan-tree-dump "Replaced REALPART_EXPR.*with dd" "fre1" } } */ +/* { dg-final { cleanup-tree-dump "fre1" } } */ diff --git a/gcc/testsuite/gcc.dg/uninit-B.c b/gcc/testsuite/gcc.dg/uninit-B.c index f03dd701853..adb1461d951 100644 --- a/gcc/testsuite/gcc.dg/uninit-B.c +++ b/gcc/testsuite/gcc.dg/uninit-B.c @@ -9,7 +9,7 @@ void baz (void) { int i; - if (i) /* { dg-warning "is used uninitialized" "uninit i warning" { xfail *-*-* } } */ + if (i) /* { dg-warning "is used uninitialized" "uninit i warning" } */ bar (i); foo (&i); } diff --git a/gcc/testsuite/gcc.dg/uninit-pr19430.c b/gcc/testsuite/gcc.dg/uninit-pr19430.c index 4d2b4f62cef..36129314872 100644 --- a/gcc/testsuite/gcc.dg/uninit-pr19430.c +++ b/gcc/testsuite/gcc.dg/uninit-pr19430.c @@ -29,7 +29,7 @@ void frob(int *pi); int main(void) { int i; - printf("i = %d\n", i); /* { dg-warning "'i' is used uninitialized in this function" "" { xfail *-*-* } } */ + printf("i = %d\n", i); /* { dg-warning "'i' is used uninitialized in this function" "" } */ frob(&i); return 0; @@ -38,6 +38,6 @@ int main(void) void foo3(int*); void bar3(void) { int x; - if(x) /* { dg-warning "'x' is used uninitialized in this function" "uninitialized" { xfail *-*-* } } */ + if(x) /* { dg-warning "'x' is used uninitialized in this function" "uninitialized" } */ foo3(&x); } diff --git a/gcc/testsuite/gcc.dg/vect/pr50635.c b/gcc/testsuite/gcc.dg/vect/pr50635.c new file mode 100644 index 00000000000..6a7ac52e821 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr50635.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +typedef signed long int32_t; +typedef char int8_t; + +void f0a(int32_t * result, int32_t * arg1, int8_t * arg2, int32_t temp_3) +{ + int idx; + for (idx=0;idx<10;idx += 1) + { + int32_t temp_4; + int32_t temp_12; + + temp_4 = (-2 & arg2[idx]) + temp_3; + temp_12 = -2 * arg2[idx] + temp_4; + result[idx] = temp_12; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/vect-align-2.c b/gcc/testsuite/gcc.dg/vect/vect-align-2.c index 08a80112d73..293d07b241d 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-align-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-align-2.c @@ -15,7 +15,7 @@ struct foo { } __attribute__ ((packed)); struct foo f2; -int z[16] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; +int z[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16}; __attribute__ ((noinline)) void fbar(struct foo *fp) diff --git a/gcc/testsuite/gcc.dg/vect/vect-cond-8.c b/gcc/testsuite/gcc.dg/vect/vect-cond-8.c new file mode 100644 index 00000000000..e5702c25a1d --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-cond-8.c @@ -0,0 +1,122 @@ +/* { dg-require-effective-target vect_cond_mixed } */ + +#include "tree-vect.h" + +#define N 1024 +float a[N], b[N], c[N]; +int d[N], e[N], f[N]; +unsigned char k[N]; + +__attribute__((noinline, noclone)) void +f1 (void) +{ + int i; + for (i = 0; i < N; ++i) + k[i] = a[i] < b[i] ? 17 : 0; +} + +__attribute__((noinline, noclone)) void +f2 (void) +{ + int i; + for (i = 0; i < N; ++i) + k[i] = a[i] < b[i] ? 0 : 24; +} + +__attribute__((noinline, noclone)) void +f3 (void) +{ + int i; + for (i = 0; i < N; ++i) + k[i] = a[i] < b[i] ? 51 : 12; +} + +__attribute__((noinline, noclone)) void +f4 (void) +{ + int i; + for (i = 0; i < N; ++i) + { + int d2 = d[i], e2 = e[i]; + f[i] = a[i] < b[i] ? d2 : e2; + } +} + +__attribute__((noinline, noclone)) void +f5 (void) +{ + int i; + for (i = 0; i < N; ++i) + { + float a2 = a[i], b2 = b[i]; + c[i] = d[i] < e[i] ? a2 : b2; + } +} + +int +main () +{ + int i; + + check_vect (); + + for (i = 0; i < N; i++) + { + switch (i % 9) + { + case 0: asm (""); a[i] = - i - 1; b[i] = i + 1; break; + case 1: a[i] = 0; b[i] = 0; break; + case 2: a[i] = i + 1; b[i] = - i - 1; break; + case 3: a[i] = i; b[i] = i + 7; break; + case 4: a[i] = i; b[i] = i; break; + case 5: a[i] = i + 16; b[i] = i + 3; break; + case 6: a[i] = - i - 5; b[i] = - i; break; + case 7: a[i] = - i; b[i] = - i; break; + case 8: a[i] = - i; b[i] = - i - 7; break; + } + d[i] = i; + e[i] = 2 * i; + } + f1 (); + for (i = 0; i < N; i++) + if (k[i] != ((i % 3) == 0 ? 17 : 0)) + abort (); + f2 (); + for (i = 0; i < N; i++) + if (k[i] != ((i % 3) == 0 ? 0 : 24)) + abort (); + f3 (); + for (i = 0; i < N; i++) + if (k[i] != ((i % 3) == 0 ? 51 : 12)) + abort (); + f4 (); + for (i = 0; i < N; i++) + if (f[i] != ((i % 3) == 0 ? d[i] : e[i])) + abort (); + for (i = 0; i < N; i++) + { + switch (i % 9) + { + case 0: asm (""); d[i] = - i - 1; e[i] = i + 1; break; + case 1: d[i] = 0; e[i] = 0; break; + case 2: d[i] = i + 1; e[i] = - i - 1; break; + case 3: d[i] = i; e[i] = i + 7; break; + case 4: d[i] = i; e[i] = i; break; + case 5: d[i] = i + 16; e[i] = i + 3; break; + case 6: d[i] = - i - 5; e[i] = - i; break; + case 7: d[i] = - i; e[i] = - i; break; + case 8: d[i] = - i; e[i] = - i - 7; break; + } + a[i] = i; + b[i] = i / 2; + } + f5 (); + for (i = 0; i < N; i++) + if (c[i] != ((i % 3) == 0 ? a[i] : b[i])) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "note: vectorized 1 loops" 5 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.target/arm/pr50305.c b/gcc/testsuite/gcc.target/arm/pr50305.c new file mode 100644 index 00000000000..2f6ad5cfeab --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/pr50305.c @@ -0,0 +1,60 @@ +/* { dg-do compile } */ +/* { dg-skip-if "incompatible options" { arm*-*-* } { "-march=*" } { "-march=armv7-a" } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -marm -march=armv7-a -mfpu=vfp3" } */ + +struct event { + unsigned long long id; + unsigned int flag; +}; + +void dummy(void) +{ + /* This is here to ensure that the offset of perf_event_id below + relative to the LANCHOR symbol exceeds the allowed displacement. */ + static int __warned[300]; + __warned[0] = 1; +} + +extern void *kmem_cache_alloc_trace (void *cachep); +extern void *cs_cachep; +extern int nr_cpu_ids; + +struct event * +event_alloc (int cpu) +{ + static unsigned long long __attribute__((aligned(8))) perf_event_id; + struct event *event; + unsigned long long result; + unsigned long tmp; + + if (cpu >= nr_cpu_ids) + return 0; + + event = kmem_cache_alloc_trace (cs_cachep); + + __asm__ __volatile__ ("dmb" : : : "memory"); + + __asm__ __volatile__("@ atomic64_add_return\n" +"1: ldrexd %0, %H0, [%3]\n" +" adds %0, %0, %4\n" +" adc %H0, %H0, %H4\n" +" strexd %1, %0, %H0, [%3]\n" +" teq %1, #0\n" +" bne 1b" + : "=&r" (result), "=&r" (tmp), "+Qo" (perf_event_id) + : "r" (&perf_event_id), "r" (1LL) + : "cc"); + + __asm__ __volatile__ ("dmb" : : : "memory"); + + event->id = result; + + if (cpu) + event->flag = 1; + + for (cpu = 0; cpu < nr_cpu_ids; cpu++) + kmem_cache_alloc_trace (cs_cachep); + + return event; +} + diff --git a/gcc/testsuite/gcc.target/arm/shiftable.c b/gcc/testsuite/gcc.target/arm/shiftable.c new file mode 100644 index 00000000000..f3080620a9e --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/shiftable.c @@ -0,0 +1,63 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target arm32 } */ + +/* ARM has shift-and-alu insns. Depending on the ALU op GCC represents some + of these as a left shift, others as a multiply. Check that we match the + right one. */ + +int +plus (int a, int b) +{ + return (a * 64) + b; +} + +/* { dg-final { scan-assembler "add.*\[al]sl #6" } } */ + +int +minus (int a, int b) +{ + return a - (b * 64); +} + +/* { dg-final { scan-assembler "sub.*\[al]sl #6" } } */ + +int +ior (int a, int b) +{ + return (a * 64) | b; +} + +/* { dg-final { scan-assembler "orr.*\[al]sl #6" } } */ + +int +xor (int a, int b) +{ + return (a * 64) ^ b; +} + +/* { dg-final { scan-assembler "eor.*\[al]sl #6" } } */ + +int +and (int a, int b) +{ + return (a * 64) & b; +} + +/* { dg-final { scan-assembler "and.*\[al]sl #6" } } */ + +int +rsb (int a, int b) +{ + return (a * 64) - b; +} + +/* { dg-final { scan-assembler "rsb.*\[al]sl #6" } } */ + +int +mvn (int a, int b) +{ + return ~(a * 64); +} + +/* { dg-final { scan-assembler "mvn.*\[al]sl #6" } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-2.c b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-2.c index 7d188e2b466..f1d79793ff8 100644 --- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-2.c +++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-2.c @@ -26,4 +26,4 @@ avx_test (void) /* { dg-final { scan-assembler-not "\\*avx_movdqu256/1" } } */ /* { dg-final { scan-assembler "\\*sse2_movdqu/1" } } */ -/* { dg-final { scan-assembler "vinsertf128" } } */ +/* { dg-final { scan-assembler "vinsert.128" } } */ diff --git a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-2.c b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-2.c index d8ae5a90189..3339cc5e703 100644 --- a/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-2.c +++ b/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-2.c @@ -26,4 +26,4 @@ avx_test (void) /* { dg-final { scan-assembler-not "\\*avx_movdqu256/2" } } */ /* { dg-final { scan-assembler "vmovdqu.*\\*movv16qi_internal/3" } } */ -/* { dg-final { scan-assembler "vextractf128" } } */ +/* { dg-final { scan-assembler "vextract.128" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr50603.c b/gcc/testsuite/gcc.target/i386/pr50603.c new file mode 100644 index 00000000000..101ef85484d --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr50603.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern int *foo; + +int +bar (int x) +{ + return foo[x]; +} +/* { dg-final { scan-assembler-not "lea\[lq\]" } } */ diff --git a/gcc/testsuite/gcc.target/sparc/cmask.c b/gcc/testsuite/gcc.target/sparc/cmask.c index b3168ec321d..989274c6858 100644 --- a/gcc/testsuite/gcc.target/sparc/cmask.c +++ b/gcc/testsuite/gcc.target/sparc/cmask.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { vis3 } } } */ /* { dg-options "-mcpu=niagara3 -mvis" } */ void test_cm8 (long x) diff --git a/gcc/testsuite/gcc.target/sparc/fhalve.c b/gcc/testsuite/gcc.target/sparc/fhalve.c index 340b936b8fa..737fc71bbcf 100644 --- a/gcc/testsuite/gcc.target/sparc/fhalve.c +++ b/gcc/testsuite/gcc.target/sparc/fhalve.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { vis3 } } } */ /* { dg-options "-mcpu=niagara3 -mvis" } */ float test_fhadds (float x, float y) diff --git a/gcc/testsuite/gcc.target/sparc/fnegop.c b/gcc/testsuite/gcc.target/sparc/fnegop.c index 25f8c199e24..3e3e72c820c 100644 --- a/gcc/testsuite/gcc.target/sparc/fnegop.c +++ b/gcc/testsuite/gcc.target/sparc/fnegop.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { vis3 } } } */ /* { dg-options "-O2 -mcpu=niagara3 -mvis" } */ float test_fnadds(float x, float y) diff --git a/gcc/testsuite/gcc.target/sparc/fpadds.c b/gcc/testsuite/gcc.target/sparc/fpadds.c index d0704e03eda..f55cb057a2a 100644 --- a/gcc/testsuite/gcc.target/sparc/fpadds.c +++ b/gcc/testsuite/gcc.target/sparc/fpadds.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { vis3 } } } */ /* { dg-options "-mcpu=niagara3 -mvis" } */ typedef int __v2si __attribute__((vector_size(8))); typedef int __v1si __attribute__((vector_size(4))); diff --git a/gcc/testsuite/gcc.target/sparc/fshift.c b/gcc/testsuite/gcc.target/sparc/fshift.c index a12df0451cb..6adbed69171 100644 --- a/gcc/testsuite/gcc.target/sparc/fshift.c +++ b/gcc/testsuite/gcc.target/sparc/fshift.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { vis3 } } } */ /* { dg-options "-mcpu=niagara3 -mvis" } */ typedef int __v2si __attribute__((vector_size(8))); typedef short __v4hi __attribute__((vector_size(8))); diff --git a/gcc/testsuite/gcc.target/sparc/fucmp.c b/gcc/testsuite/gcc.target/sparc/fucmp.c index 7f291c3e7ed..4e7ecadcd4a 100644 --- a/gcc/testsuite/gcc.target/sparc/fucmp.c +++ b/gcc/testsuite/gcc.target/sparc/fucmp.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { vis3 } } } */ /* { dg-options "-mcpu=niagara3 -mvis" } */ typedef unsigned char vec8 __attribute__((vector_size(8))); diff --git a/gcc/testsuite/gcc.target/sparc/lzd.c b/gcc/testsuite/gcc.target/sparc/lzd.c index a8978296300..5ffaf56e558 100644 --- a/gcc/testsuite/gcc.target/sparc/lzd.c +++ b/gcc/testsuite/gcc.target/sparc/lzd.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { vis3 } } } */ /* { dg-options "-mcpu=niagara3" } */ int test_clz(int a) { diff --git a/gcc/testsuite/gcc.target/sparc/sparc.exp b/gcc/testsuite/gcc.target/sparc/sparc.exp index 9658d08bc9c..51c9c16ecb7 100644 --- a/gcc/testsuite/gcc.target/sparc/sparc.exp +++ b/gcc/testsuite/gcc.target/sparc/sparc.exp @@ -24,6 +24,17 @@ if ![istarget sparc*-*-*] then { # Load support procs. load_lib gcc-dg.exp +# Return 1 if vis3 instructions can be compiled. +proc check_effective_target_vis3 { } { + return [check_no_compiler_messages vis3 object { + long long + _vis3_fpadd64 (long long __X, long long __Y) + { + return __builtin_vis_fpadd64 (__X, __Y); + } + } "-mcpu=niagara3 -mvis" ] +} + # If a testcase doesn't have special options, use these. global DEFAULT_CFLAGS if ![info exists DEFAULT_CFLAGS] then { diff --git a/gcc/testsuite/gcc.target/sparc/vis3misc.c b/gcc/testsuite/gcc.target/sparc/vis3misc.c index 8a9535e8fb5..e3ef49e210d 100644 --- a/gcc/testsuite/gcc.target/sparc/vis3misc.c +++ b/gcc/testsuite/gcc.target/sparc/vis3misc.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { vis3 } } } */ /* { dg-options "-mcpu=niagara3 -mvis" } */ typedef int __v2si __attribute__((vector_size(8))); typedef short __v4hi __attribute__((vector_size(8))); diff --git a/gcc/testsuite/gcc.target/sparc/xmul.c b/gcc/testsuite/gcc.target/sparc/xmul.c index ce80e6cbbe0..5d249d092db 100644 --- a/gcc/testsuite/gcc.target/sparc/xmul.c +++ b/gcc/testsuite/gcc.target/sparc/xmul.c @@ -1,4 +1,4 @@ -/* { dg-do compile } */ +/* { dg-do compile { target { vis3 } } } */ /* { dg-options "-mcpu=niagara3 -mvis" } */ typedef long long int64_t; diff --git a/gcc/testsuite/gfortran.dg/c_sizeof_2.f90 b/gcc/testsuite/gfortran.dg/c_sizeof_2.f90 index e163797470f..e3911facf6a 100644 --- a/gcc/testsuite/gfortran.dg/c_sizeof_2.f90 +++ b/gcc/testsuite/gfortran.dg/c_sizeof_2.f90 @@ -2,7 +2,7 @@ ! { dg-options "-std=f2003 -Wall -Wno-conversion" } ! Support F2008's c_sizeof() ! -USE ISO_C_BINDING, only: C_SIZE_T, c_sizeof ! { dg-error "new in Fortran 2008" } +USE ISO_C_BINDING, only: C_SIZE_T, c_sizeof ! { dg-error "is not in the selected standard" } integer(C_SIZE_T) :: i i = c_sizeof(i) end diff --git a/gcc/testsuite/gfortran.dg/class_46.f03 b/gcc/testsuite/gfortran.dg/class_46.f03 new file mode 100644 index 00000000000..4719c252f63 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/class_46.f03 @@ -0,0 +1,18 @@ +! { dg-do run } +! +! PR 50625: [4.6/4.7 Regression][OOP] ALLOCATABLE attribute lost for module CLASS variables +! +! Contributed by Tobias Burnus <burnus@gcc.gnu.org> + +module m +type t +end type t +class(t), allocatable :: x +end module m + +use m +implicit none +if (allocated(x)) call abort() +end + +! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/common_14.f90 b/gcc/testsuite/gfortran.dg/common_14.f90 index aced168c655..892e4a5705f 100644 --- a/gcc/testsuite/gfortran.dg/common_14.f90 +++ b/gcc/testsuite/gfortran.dg/common_14.f90 @@ -1,4 +1,5 @@ ! { dg-do compile } +! { dg-options "-Wno-align-commons" } ! ! PR fortran/45044 ! diff --git a/gcc/testsuite/gfortran.dg/common_16.f90 b/gcc/testsuite/gfortran.dg/common_16.f90 new file mode 100644 index 00000000000..3314e80ef9d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/common_16.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-options "-pedantic -mdalign" { target sh*-*-* } } +! +! PR fortran/50273 +! +subroutine test() + character :: a + integer :: b + character :: c + common /global_var/ a, b, c ! { dg-warning "Padding of 3 bytes required before 'b' in COMMON" } + print *, a, b, c +end subroutine test diff --git a/gcc/testsuite/gfortran.dg/iso_c_binding_param_1.f90 b/gcc/testsuite/gfortran.dg/iso_c_binding_param_1.f90 new file mode 100644 index 00000000000..dae9cc3703f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/iso_c_binding_param_1.f90 @@ -0,0 +1,12 @@ +! { dg-do compile } +! { dg-options "-std=f2008" } +! +! Check that the GNU additions to ISO_C_Binding are properly diagnosed +! +use, intrinsic :: iso_c_binding, only: c_int128_t ! { dg-error "is not in the selected standard" } +use, intrinsic :: iso_c_binding, only: c_int_least128_t ! { dg-error "is not in the selected standard" } +use, intrinsic :: iso_c_binding, only: c_int_fast128_t ! { dg-error "is not in the selected standard" } +use, intrinsic :: iso_c_binding, only: c_float128 ! { dg-error "is not in the selected standard" } +use, intrinsic :: iso_c_binding, only: c_float128_complex ! { dg-error "is not in the selected standard" } +implicit none +end diff --git a/gcc/testsuite/gfortran.dg/iso_c_binding_param_2.f90 b/gcc/testsuite/gfortran.dg/iso_c_binding_param_2.f90 new file mode 100644 index 00000000000..7b78743452a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/iso_c_binding_param_2.f90 @@ -0,0 +1,20 @@ +! { dg-do compile } +! { dg-options "-O -fdump-tree-optimized" } +! +! Check that the GNU additions to ISO_C_Binding are accepted +! +use, intrinsic :: iso_c_binding, only: c_int128_t +use, intrinsic :: iso_c_binding, only: c_int_least128_t +use, intrinsic :: iso_c_binding, only: c_int_fast128_t +use, intrinsic :: iso_c_binding, only: c_float128 +use, intrinsic :: iso_c_binding, only: c_float128_complex +implicit none +if (c_int128_t >= 0 .and. c_int128_t /= 16) call unreachable() +if (c_int_least128_t >= 0 .and. c_int_least128_t < 16) call unreachable() +if (c_int_fast128_t >= 0 .and. c_int_fast128_t < 16) call unreachable() +if (c_float128 >= 0 .and. c_float128 /= 16) call unreachable() +if (c_float128_complex >= 0 .and. c_float128_complex /= 16) call unreachable() +end + +! { dg-final { scan-tree-dump-times "unreachable" 0 "optimized" } } +! { dg-final { cleanup-tree-dump "optimized" } } diff --git a/gcc/testsuite/gfortran.dg/pointer_function_result_1.f90 b/gcc/testsuite/gfortran.dg/pointer_function_result_1.f90 new file mode 100644 index 00000000000..764a666be96 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pointer_function_result_1.f90 @@ -0,0 +1,28 @@ +! { dg-do run } +! Test the fix for PR47844, in which the stride in the function result +! was ignored. Previously, the result was [1,3] at lines 15 and 16. +! +! Contributed by KePu <Kdx1999@gmail.com> +! +PROGRAM test_pointer_value + IMPLICIT NONE + INTEGER, DIMENSION(10), TARGET :: array= [1,3,5,7,9,11,13,15,17,19] + INTEGER, dimension(2) :: array_fifth + INTEGER, POINTER, DIMENSION(:) :: ptr_array => NULL() + INTEGER, POINTER, DIMENSION(:) :: ptr_array_fifth => NULL() + ptr_array => array + array_fifth = every_fifth (ptr_array) + if (any (array_fifth .ne. [1,11])) call abort + if (any (every_fifth(ptr_array) .ne. [1,11])) call abort +CONTAINS + FUNCTION every_fifth (ptr_array) RESULT (ptr_fifth) + IMPLICIT NONE + INTEGER, POINTER, DIMENSION(:) :: ptr_fifth + INTEGER, POINTER, DIMENSION(:), INTENT(in) :: ptr_array + INTEGER :: low + INTEGER :: high + low = LBOUND (ptr_array, 1) + high = UBOUND (ptr_array, 1) + ptr_fifth => ptr_array (low: high: 5) + END FUNCTION every_fifth +END PROGRAM test_pointer_value diff --git a/gcc/testsuite/gfortran.dg/proc_decl_27.f90 b/gcc/testsuite/gfortran.dg/proc_decl_27.f90 new file mode 100644 index 00000000000..30ff4def30d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_decl_27.f90 @@ -0,0 +1,25 @@ +! { dg-do compile } +! +! PR 50659: [4.5/4.6/4.7 Regression] [F03] ICE on invalid with procedure interface +! +! Contributed by Andrew Benson <abenson@caltech.edu> + +module m1 + integer :: arrSize +end module + +module m2 +contains + function Proc (arg) + use m1 + double precision, dimension(arrSize) :: proc + double precision :: arg + end function +end + + use m2 + implicit none + procedure(Proc) :: Proc_Get +end + +! { dg-final { cleanup-modules "m1 m2" } } diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 5d236f78312..550d5345244 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -3234,6 +3234,26 @@ proc check_effective_target_vect_condition { } { return $et_vect_cond_saved } +# Return 1 if the target supports vector conditional operations where +# the comparison has different type from the lhs, 0 otherwise. + +proc check_effective_target_vect_cond_mixed { } { + global et_vect_cond_mixed_saved + + if [info exists et_vect_cond_mixed_saved] { + verbose "check_effective_target_vect_cond_mixed: using cached result" 2 + } else { + set et_vect_cond_mixed_saved 0 + if { [istarget i?86-*-*] + || [istarget x86_64-*-*] } { + set et_vect_cond_mixed_saved 1 + } + } + + verbose "check_effective_target_vect_cond_mixed: returning $et_vect_cond_mixed_saved" 2 + return $et_vect_cond_mixed_saved +} + # Return 1 if the target supports vector char multiplication, 0 otherwise. proc check_effective_target_vect_char_mult { } { diff --git a/gcc/testsuite/objc/execute/initialize-1.m b/gcc/testsuite/objc/execute/initialize-1.m new file mode 100644 index 00000000000..9ca4aebbe69 --- /dev/null +++ b/gcc/testsuite/objc/execute/initialize-1.m @@ -0,0 +1,47 @@ +/* Contributed by Nicola Pero - Sat 8 Oct 2011 16:47:48 BST */ +#include <objc/objc.h> + +/* Test that if a class has no +initialize method, the superclass + implementation is called. */ + +static int class_variable = 0; + +@interface TestClass +{ + Class isa; +} ++ (void) initialize; ++ (int) classVariable; +@end + +@implementation TestClass ++ (void) initialize +{ + class_variable++; +} ++ (int) classVariable +{ + return class_variable; +} +@end + +@interface TestSubClass : TestClass +@end + +@implementation TestSubClass +@end + +int main (void) +{ + if ([TestClass classVariable] != 1) + { + abort (); + } + + if ([TestSubClass classVariable] != 2) + { + abort (); + } + + return 0; +} |