diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg')
59 files changed, 888 insertions, 98 deletions
diff --git a/gcc/testsuite/gcc.dg/Wcxx-compat-12.c b/gcc/testsuite/gcc.dg/Wcxx-compat-12.c index a6094e183be..9061ee67cc8 100644 --- a/gcc/testsuite/gcc.dg/Wcxx-compat-12.c +++ b/gcc/testsuite/gcc.dg/Wcxx-compat-12.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-Wc++-compat" } */ +/* { dg-options "-fno-short-enums -Wc++-compat" } */ enum E { A }; diff --git a/gcc/testsuite/gcc.dg/anon-struct-11.c b/gcc/testsuite/gcc.dg/anon-struct-11.c new file mode 100644 index 00000000000..1084e5bded6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/anon-struct-11.c @@ -0,0 +1,111 @@ +/* { dg-do compile } */ + +/* No special options--in particular, turn off the default + -pedantic-errors option. */ +/* { dg-options "" } */ + +/* When not using -fplan9-extensions, we don't support automatic + conversion of pointer types, and we don't support referring to a + typedef name directly. */ + +extern void exit (int); +extern void abort (void); + +struct A { char a; }; + +struct B { + char b; + struct A; /* { dg-warning "does not declare anything" } */ + char c; +}; + +void +f1 (struct A *p) /* { dg-message "expected" } */ +{ + p->a = 1; +} + +void +test1 (void) +{ + struct B b; + struct A *p; + + b.b = 2; + b.c = 3; + f1 (&b); /* { dg-warning "incompatible pointer type" } */ + if (b.a != 1) /* { dg-error "no member" } */ + abort (); + if (b.b != 2 || b.c != 3) + abort (); + p = &b; /* { dg-warning "incompatible pointer type" } */ + if (p->a != 1) + abort (); +} + +typedef struct { char d; } D; + +struct E { + char b; + struct F { char f; }; /* { dg-warning "does not declare anything" } */ + char c; + union { + D; + }; + char e; +}; + +void +f2 (struct F *p) /* { dg-message "expected" } */ +{ + p->f = 6; +} + +void +f3 (D *p) /* { dg-message "expected" } */ +{ + p->d = 4; +} + +void +f4 (D d) +{ +} + +void +test2 (void) +{ + struct E e; + struct F *pf; + D *pd; + D d; + + e.b = 2; + e.c = 3; + e.e = 5; + f2 (&e); /* { dg-warning "incompatible pointer type" } */ + f3 (&e); /* { dg-warning "incompatible pointer type" } */ + if (e.d != 4) + abort (); + if (e.f != 6) /* { dg-error "no member" } */ + abort (); + if (e.b != 2 || e.c != 3 || e.e != 5) + abort (); + pf = &e; /* { dg-warning "incompatible pointer type" } */ + if (pf->f != 6) + abort (); + pd = &e; /* { dg-warning "incompatible pointer type" } */ + if (pd->d != 4) + abort (); + d = e.D; /* { dg-error "no member" } */ + f3 (&e.D); /* { dg-error "no member" } */ + f4 (e.D); /* { dg-error "no member" } */ +} + +int +main () +{ + test1 (); + test2 (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/anon-struct-12.c b/gcc/testsuite/gcc.dg/anon-struct-12.c new file mode 100644 index 00000000000..60cd178224e --- /dev/null +++ b/gcc/testsuite/gcc.dg/anon-struct-12.c @@ -0,0 +1,108 @@ +/* { dg-do run } */ +/* { dg-options "-fplan9-extensions" } */ + +/* When using -fplan9-extensions, we support automatic conversion of + pointer types, and we support referring to a typedef name + directly. */ + +extern void exit (int); +extern void abort (void); + +struct A { char a; }; + +struct B { + char b; + struct A; + char c; +}; + +void +f1 (struct A *p) +{ + p->a = 1; +} + +void +test1 (void) +{ + struct B b; + struct A *p; + + b.b = 2; + b.c = 3; + f1 (&b); + if (b.a != 1) + abort (); + if (b.b != 2 || b.c != 3) + abort (); + p = &b; + if (p->a != 1) + abort (); +} + +typedef struct { char d; } D; + +struct E { + char b; + struct F { char f; }; + char c; + union { + D; + }; + char e; +}; + +void +f2 (struct F *p) +{ + p->f = 6; +} + +void +f3 (D *p) +{ + p->d = 4; +} + +void +f4 (D d) +{ +} + +void +test2 (void) +{ + struct E e; + struct F *pf; + D *pd; + D d; + + e.b = 2; + e.c = 3; + e.e = 5; + f2 (&e); + f3 (&e); + if (e.d != 4) + abort (); + if (e.f != 6) + abort (); + if (e.b != 2 || e.c != 3 || e.e != 5) + abort (); + pf = &e; + if (pf->f != 6) + abort (); + pd = &e; + if (pd->d != 4) + abort (); + d = e.D; + f3 (&e.D); + f4 (e.D); +} + +int +main () +{ + test1 (); + test2 (); + exit (0); +} diff --git a/gcc/testsuite/gcc.dg/anon-struct-13.c b/gcc/testsuite/gcc.dg/anon-struct-13.c new file mode 100644 index 00000000000..6a508141bac --- /dev/null +++ b/gcc/testsuite/gcc.dg/anon-struct-13.c @@ -0,0 +1,76 @@ +/* { dg-do compile } */ +/* { dg-options "-fplan9-extensions" } */ + +/* Test for ambiguity when using the Plan 9 extensions. */ + +struct A { + char a; /* { dg-error "duplicate member" } */ +}; + +struct B +{ + struct A; + struct A; +}; + +char +f1 (struct B *p) +{ + return p->a; /* { dg-error "no member" } */ +} + +void +f2 (struct A *p) /* { dg-message "expected" } */ +{ +} + +void +f3 (struct B *p) +{ + f2 (p); /* { dg-warning "incompatible pointer type" } */ +} + +struct C +{ + char c; /* { dg-error "duplicate member" } */ +}; + +struct D +{ + struct C; +}; + +struct E +{ + struct C; + struct D; +}; + +char +f4 (struct E *p) +{ + return p->c; /* { dg-error "no member" } */ +} + +void +f6 (struct C *p) /* { dg-message "expected" } */ +{ +} + +void +f7 (struct E *p) +{ + f6 (p); /* { dg-warning "incompatible pointer type" } */ +} + +struct A +f8 (struct B *p) +{ + return p->A; /* { dg-error "no member" } */ +} + +struct C +f9 (struct E *p) +{ + return p->C; /* { dg-error "no member" } */ +} diff --git a/gcc/testsuite/gcc.dg/anon-struct-14.c b/gcc/testsuite/gcc.dg/anon-struct-14.c new file mode 100644 index 00000000000..293ccc75a68 --- /dev/null +++ b/gcc/testsuite/gcc.dg/anon-struct-14.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-options "-fplan9-extensions" } */ + +/* When using Plan 9 extensions, a typedef can conflict with an + anonymous field. */ + +typedef struct { int a; } s1; +struct s2 { s1; int s1; }; /* { dg-error "duplicate" } */ +int f(struct s2 *p) { return p->s1; } /* { dg-error "incompatible" } */ diff --git a/gcc/testsuite/gcc.dg/debug/pr41893-1.c b/gcc/testsuite/gcc.dg/debug/pr41893-1.c index 150fdefc913..6da30708e57 100644 --- a/gcc/testsuite/gcc.dg/debug/pr41893-1.c +++ b/gcc/testsuite/gcc.dg/debug/pr41893-1.c @@ -1,7 +1,7 @@ /* PR debug/41893 */ /* { dg-do link } */ /* { dg-require-effective-target lto } */ -/* { dg-options "-flto -fwhole-program -O -r -nostdlib" } */ +/* { dg-options "-flto -fwhole-program -O" } */ /* { dg-additional-sources "pr41893-2.c" } */ struct S { int v; }; @@ -12,3 +12,5 @@ func1 (void) { struct S *p = &s; } + +int main() { return 0; } diff --git a/gcc/testsuite/gcc.dg/debug/pr45849.c b/gcc/testsuite/gcc.dg/debug/pr45849.c new file mode 100644 index 00000000000..93279b7081c --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/pr45849.c @@ -0,0 +1,31 @@ +/* PR debug/45849 */ +/* { dg-do compile } */ +/* { dg-options "-g -Wno-uninitialized" } */ + +extern void bar (void); + +void +foo (long repllen, char *rp) +{ + char *matchend; + char *scan; + long len; + char *matchstart; + char *text; + char *t; + + repllen--; + + for (;;) + { + matchstart = t + rp[0]; + matchend = rp; + len = matchstart - text + repllen * (matchend - matchstart); + while (len) + ; + for (scan = text; scan != rp; scan++) + bar (); + if (matchstart) + text = matchend; + } +} diff --git a/gcc/testsuite/gcc.dg/graphite/graphite.exp b/gcc/testsuite/gcc.dg/graphite/graphite.exp index 411e0417afd..e6cdf12ed95 100644 --- a/gcc/testsuite/gcc.dg/graphite/graphite.exp +++ b/gcc/testsuite/gcc.dg/graphite/graphite.exp @@ -43,11 +43,13 @@ set id_files [lsort [glob -nocomplain $srcdir/$subdir/id-*.c ] ] set run_id_files [lsort [glob -nocomplain $srcdir/$subdir/run-id-*.c ] ] set interchange_files [lsort [glob -nocomplain $srcdir/$subdir/interchange-*.c ] ] set block_files [lsort [glob -nocomplain $srcdir/$subdir/block-*.c ] ] +set vect_files [lsort [glob -nocomplain $srcdir/$subdir/vect-*.c ] ] # Tests to be compiled. set dg-do-what-default compile dg-runtest $scop_files "" "-O2 -fgraphite -fdump-tree-graphite-all" dg-runtest $id_files "" "-O2 -fgraphite-identity -ffast-math" +dg-runtest $vect_files "" "-O2 -fgraphite-identity -ftree-vectorize -fno-vect-cost-model -fdump-tree-vect-details" # Tests to be run. set dg-do-what-default run @@ -62,6 +64,7 @@ foreach f $id_files {lremove wait_to_run_files $f} foreach f $run_id_files {lremove wait_to_run_files $f} foreach f $interchange_files {lremove wait_to_run_files $f} foreach f $block_files {lremove wait_to_run_files $f} +foreach f $vect_files {lremove wait_to_run_files $f} dg-runtest $wait_to_run_files "" "-ansi -pedantic-errors" # Clean up. diff --git a/gcc/testsuite/gcc.dg/graphite/id-pr45230.c b/gcc/testsuite/gcc.dg/graphite/id-pr45230.c new file mode 100644 index 00000000000..80f67697f13 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/id-pr45230.c @@ -0,0 +1,14 @@ +unsigned char buf[10]; +main () +{ + unsigned off1, len, i; + unsigned char *p1; + for (len = 0; len < 8; len++) + { + p1 = buf; + for (i = 0; i < off1; i++) + *p1++ = '\0'; + for (i = 0; i < len; i++) + *p1++ = 'a'; + } +} diff --git a/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c b/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c new file mode 100644 index 00000000000..5589167fbd3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/vect-pr43423.c @@ -0,0 +1,18 @@ +/* { dg-require-effective-target vect_int } */ + +int a[100], b[100], c[100]; + +void foo(int n, int mid) +{ + int i; + for(i=0; i<n; i++) + { + if (i < mid) + a[i] = a[i] + b[i]; + else + a[i] = a[i] + c[i]; + } +} + +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/pr30762-1.c b/gcc/testsuite/gcc.dg/pr30762-1.c index 74a566aa55c..75fb762d508 100644 --- a/gcc/testsuite/gcc.dg/pr30762-1.c +++ b/gcc/testsuite/gcc.dg/pr30762-1.c @@ -1,7 +1,7 @@ /* PR c/30762 */ /* { dg-do link } */ /* { dg-require-effective-target lto } */ -/* { dg-options "-flto -r -nostdlib -O3" } */ +/* { dg-options "-flto -O3" } */ /* { dg-additional-sources pr30762-2.c } */ typedef struct { int i; } D; @@ -14,3 +14,5 @@ bar (void) d.i = 1; foo (d); } + +int main() { return 0; } diff --git a/gcc/testsuite/gcc.dg/pr31529-1.c b/gcc/testsuite/gcc.dg/pr31529-1.c index 31339e1ef83..7182e8fe6bd 100644 --- a/gcc/testsuite/gcc.dg/pr31529-1.c +++ b/gcc/testsuite/gcc.dg/pr31529-1.c @@ -1,8 +1,10 @@ /* { dg-do link } */ /* { dg-require-effective-target lto } */ -/* { dg-options "-flto -r -nostdlib" } */ +/* { dg-options "-flto" } */ /* { dg-additional-sources "pr31529-2.c" } */ getline () { } + +int main() { return 0; } diff --git a/gcc/testsuite/gcc.dg/pr34457-1.c b/gcc/testsuite/gcc.dg/pr34457-1.c index 3ccee11d1b3..3dca13df093 100644 --- a/gcc/testsuite/gcc.dg/pr34457-1.c +++ b/gcc/testsuite/gcc.dg/pr34457-1.c @@ -2,7 +2,7 @@ /* { dg-do link } */ /* { dg-require-effective-target trampolines } */ /* { dg-require-effective-target lto } */ -/* { dg-options "-flto -r -nostdlib -O2" } */ +/* { dg-options "-flto -O2" } */ /* { dg-additional-sources "pr34457-2.c" } */ @@ -10,7 +10,7 @@ typedef __SIZE_TYPE__ size_t; extern int printf (const char *, ...); extern void *memset (void *, int, size_t); -int bar (int (*)(), int, void *); +int bar (int (*p)(), int q, void *r) {} int main(int argc, char **argv) diff --git a/gcc/testsuite/gcc.dg/pr34668-1.c b/gcc/testsuite/gcc.dg/pr34668-1.c index 59495667cb4..7e242c294c7 100644 --- a/gcc/testsuite/gcc.dg/pr34668-1.c +++ b/gcc/testsuite/gcc.dg/pr34668-1.c @@ -1,11 +1,11 @@ /* PR c/34668 */ /* { dg-do link } */ /* { dg-require-effective-target lto } */ -/* { dg-options "-flto -r -nostdlib -O2" } */ +/* { dg-options "-flto -O2" } */ /* { dg-additional-sources "pr34668-2.c" } */ struct optab { unsigned code; }; -extern struct optab optab_table[1]; +struct optab optab_table[1]; void init_optab (struct optab *op) @@ -18,3 +18,5 @@ set_conv_libfunc (void) { init_optab (&optab_table[0]); } + +int main() { return 0; } diff --git a/gcc/testsuite/gcc.dg/pr43557-1.c b/gcc/testsuite/gcc.dg/pr43557-1.c index dd6667c771e..5ba467d01c3 100644 --- a/gcc/testsuite/gcc.dg/pr43557-1.c +++ b/gcc/testsuite/gcc.dg/pr43557-1.c @@ -1,7 +1,7 @@ /* PR debug/43557 */ /* { dg-do link } */ /* { dg-require-effective-target lto } */ -/* { dg-options "-flto -r -nostdlib -g -O2" } */ +/* { dg-options "-flto -g -O2" } */ /* { dg-additional-sources "pr43557-2.c" } */ struct S @@ -15,3 +15,5 @@ f1 (void) struct S *s = &g; s->v = 0; } + +int main() { return 0; } diff --git a/gcc/testsuite/gcc.dg/profile-dir-1.c b/gcc/testsuite/gcc.dg/profile-dir-1.c index 2bfaf20801b..62f31303142 100644 --- a/gcc/testsuite/gcc.dg/profile-dir-1.c +++ b/gcc/testsuite/gcc.dg/profile-dir-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O -fprofile-generate=. -fdump-tree-tree_profile" } */ -/* { dg-final { scan-tree-dump " ./profile-dir-1.gcda" "tree_profile" } } */ +/* { dg-options "-O -fprofile-generate=. -fdump-ipa-tree_profile_ipa" } */ +/* { dg-final { scan-ipa-dump " ./profile-dir-1.gcda" "tree_profile_ipa" } } */ int main(void) @@ -8,4 +8,4 @@ main(void) return 0; } -/* { dg-final { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/profile-dir-2.c b/gcc/testsuite/gcc.dg/profile-dir-2.c index 29bb969eafd..7bad03c5c04 100644 --- a/gcc/testsuite/gcc.dg/profile-dir-2.c +++ b/gcc/testsuite/gcc.dg/profile-dir-2.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O -fprofile-generate -fdump-tree-tree_profile" } */ -/* { dg-final { scan-tree-dump "/profile-dir-2.gcda" "tree_profile" } } */ +/* { dg-options "-O -fprofile-generate -fdump-ipa-tree_profile_ipa" } */ +/* { dg-final { scan-ipa-dump "/profile-dir-2.gcda" "tree_profile_ipa" } } */ int main(void) @@ -8,4 +8,4 @@ main(void) return 0; } -/* { dg-final { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/profile-dir-3.c b/gcc/testsuite/gcc.dg/profile-dir-3.c index 0686640a352..a4622233dc7 100644 --- a/gcc/testsuite/gcc.dg/profile-dir-3.c +++ b/gcc/testsuite/gcc.dg/profile-dir-3.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ -/* { dg-options "-O -fprofile-generate -fprofile-dir=. -fdump-tree-tree_profile" } */ -/* { dg-final { scan-tree-dump " ./profile-dir-3.gcda" "tree_profile" } } */ +/* { dg-options "-O -fprofile-generate -fprofile-dir=. -fdump-ipa-tree_profile_ipa" } */ +/* { dg-final { scan-ipa-dump " ./profile-dir-3.gcda" "tree_profile_ipa" } } */ int main(void) @@ -8,4 +8,4 @@ main(void) return 0; } -/* { dg-final { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/split-1.c b/gcc/testsuite/gcc.dg/split-1.c new file mode 100644 index 00000000000..044b4e2889b --- /dev/null +++ b/gcc/testsuite/gcc.dg/split-1.c @@ -0,0 +1,49 @@ +/* This test needs to use setrlimit to set the stack size, so it can + only run on Unix. */ +/* { dg-do run { target *-*-linux* *-*-solaris* *-*-darwin* } } */ +/* { dg-require-effective-target split_stack } */ +/* { dg-options "-fsplit-stack" } */ + +#include <stdlib.h> +#include <sys/types.h> +#include <sys/resource.h> + +/* Use a noinline function to ensure that the buffer is not removed + from the stack. */ +static void use_buffer (char *buf) __attribute__ ((noinline)); +static void +use_buffer (char *buf) +{ + buf[0] = '\0'; +} + +/* Each recursive call uses 10,000 bytes. We call it 1000 times, + using a total of 10,000,000 bytes. If -fsplit-stack is not + working, that will overflow our stack limit. */ + +static void +down (int i) +{ + char buf[10000]; + + if (i > 0) + { + use_buffer (buf); + down (i - 1); + } +} + +int +main (void) +{ + struct rlimit r; + + /* We set a stack limit because we are usually invoked via make, and + make sets the stack limit to be as large as possible. */ + r.rlim_cur = 8192 * 1024; + r.rlim_max = 8192 * 1024; + if (setrlimit (RLIMIT_STACK, &r) != 0) + abort (); + down (1000); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/split-2.c b/gcc/testsuite/gcc.dg/split-2.c new file mode 100644 index 00000000000..208169aa095 --- /dev/null +++ b/gcc/testsuite/gcc.dg/split-2.c @@ -0,0 +1,55 @@ +/* { dg-do run } */ +/* { dg-require-effective-target split_stack } */ +/* { dg-require-effective-target pthread_h } */ +/* { dg-options "-pthread -fsplit-stack" } */ + +#include <stdlib.h> +#include <pthread.h> + +/* Use a noinline function to ensure that the buffer is not removed + from the stack. */ +static void use_buffer (char *buf) __attribute__ ((noinline)); +static void +use_buffer (char *buf) +{ + buf[0] = '\0'; +} + +/* Each recursive call uses 10,000 bytes. We call it 1000 times, + using a total of 10,000,000 bytes. If -fsplit-stack is not + working, that will overflow our stack limit. */ + +static void +down (int i) +{ + char buf[10000]; + + if (i > 0) + { + use_buffer (buf); + down (i - 1); + } +} + +static void * +thread_routine (void *arg __attribute__ ((unused))) +{ + down (1000); + return NULL; +} + +int +main (void) +{ + int i; + pthread_t tid; + void *dummy; + + i = pthread_create (&tid, NULL, thread_routine, NULL); + if (i != 0) + abort (); + i = pthread_join (tid, &dummy); + if (i != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/split-3.c b/gcc/testsuite/gcc.dg/split-3.c new file mode 100644 index 00000000000..360f6720c78 --- /dev/null +++ b/gcc/testsuite/gcc.dg/split-3.c @@ -0,0 +1,64 @@ +/* This test needs to use setrlimit to set the stack size, so it can + only run on Unix. */ +/* { dg-do run { target *-*-linux* *-*-solaris* *-*-darwin* } } */ +/* { dg-require-effective-target split_stack } */ +/* { dg-options "-fsplit-stack" } */ + +#include <stdarg.h> +#include <stdlib.h> +#include <sys/types.h> +#include <sys/resource.h> + +/* Use a noinline function to ensure that the buffer is not removed + from the stack. */ +static void use_buffer (char *buf) __attribute__ ((noinline)); +static void +use_buffer (char *buf) +{ + buf[0] = '\0'; +} + +/* Each recursive call uses 10,000 bytes. We call it 1000 times, + using a total of 10,000,000 bytes. If -fsplit-stack is not + working, that will overflow our stack limit. */ + +static void +down (int i, ...) +{ + char buf[10000]; + va_list ap; + + va_start (ap, i); + if (va_arg (ap, int) != 1 + || va_arg (ap, int) != 2 + || va_arg (ap, int) != 3 + || va_arg (ap, int) != 4 + || va_arg (ap, int) != 5 + || va_arg (ap, int) != 6 + || va_arg (ap, int) != 7 + || va_arg (ap, int) != 8 + || va_arg (ap, int) != 9 + || va_arg (ap, int) != 10) + abort (); + + if (i > 0) + { + use_buffer (buf); + down (i - 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + } +} + +int +main (void) +{ + struct rlimit r; + + /* We set a stack limit because we are usually invoked via make, and + make sets the stack limit to be as large as possible. */ + r.rlim_cur = 8192 * 1024; + r.rlim_max = 8192 * 1024; + if (setrlimit (RLIMIT_STACK, &r) != 0) + abort (); + down (1000, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/split-4.c b/gcc/testsuite/gcc.dg/split-4.c new file mode 100644 index 00000000000..38196bed6c7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/split-4.c @@ -0,0 +1,68 @@ +/* This test needs to use setrlimit to set the stack size, so it can + only run on Unix. */ +/* { dg-do run { target *-*-linux* *-*-solaris* *-*-darwin* } } */ +/* { dg-require-effective-target split_stack } */ +/* { dg-options "-fsplit-stack" } */ + +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/resource.h> + +/* Use a noinline function to ensure that the buffer is not removed + from the stack. */ +static void use_buffer (char *buf, size_t) __attribute__ ((noinline)); +static void +use_buffer (char *buf, size_t c) +{ + size_t i; + + for (i = 0; i < c; ++i) + buf[i] = (char) i; +} + +/* Each recursive call uses 10 * i bytes. We call it 1000 times, + using a total of 5,000,000 bytes. If -fsplit-stack is not working, + that will overflow our stack limit. */ + +static void +down1 (int i) +{ + char buf[10 * i]; + + if (i > 0) + { + use_buffer (buf, 10 * i); + down1 (i - 1); + } +} + +/* Same thing, using alloca. */ + +static void +down2 (int i) +{ + char *buf = alloca (10 * i); + + if (i > 0) + { + use_buffer (buf, 10 * i); + down2 (i - 1); + } +} + +int +main (void) +{ + struct rlimit r; + + /* We set a stack limit because we are usually invoked via make, and + make sets the stack limit to be as large as possible. */ + r.rlim_cur = 8192 * 1024; + r.rlim_max = 8192 * 1024; + if (setrlimit (RLIMIT_STACK, &r) != 0) + abort (); + down1 (1000); + down2 (1000); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c index f1748826cc1..25ae9a906ac 100644 --- a/gcc/testsuite/gcc.dg/stack-usage-1.c +++ b/gcc/testsuite/gcc.dg/stack-usage-1.c @@ -28,6 +28,8 @@ #elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) \ || defined (__POWERPC__) || defined (PPC) || defined (_IBMR2) # define SIZE 240 +#elif defined (__AVR__) +# define SIZE 254 #else # define SIZE 256 #endif diff --git a/gcc/testsuite/gcc.dg/torture/pr45678-1.c b/gcc/testsuite/gcc.dg/torture/pr45678-1.c index 58e6156e9f4..7a90b0ba882 100644 --- a/gcc/testsuite/gcc.dg/torture/pr45678-1.c +++ b/gcc/testsuite/gcc.dg/torture/pr45678-1.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-options "-fno-common" { target { { hppa*-*-hpux* } && { ! hppa*64*-*-* } } } } */ typedef float V __attribute__ ((vector_size (16))); V g; diff --git a/gcc/testsuite/gcc.dg/torture/pr45678-2.c b/gcc/testsuite/gcc.dg/torture/pr45678-2.c index 449404cda1a..df79de7b10b 100644 --- a/gcc/testsuite/gcc.dg/torture/pr45678-2.c +++ b/gcc/testsuite/gcc.dg/torture/pr45678-2.c @@ -1,4 +1,5 @@ /* { dg-do run } */ +/* { dg-options "-fno-common" { target { { hppa*-*-hpux* } && { ! hppa*64*-*-* } } } } */ typedef float V __attribute__ ((vector_size (16))); V g; diff --git a/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c b/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c index c36dd8dd052..94a5953c9f2 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/ic-misattribution-1.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-tree_profile" } */ +/* { dg-options "-O2 -fdump-ipa-tree_profile_ipa" } */ /* { dg-additional-sources "ic-misattribution-1a.c" } */ extern void other_caller (void); @@ -15,5 +15,5 @@ caller(void (*func) (void)) func (); } -/* { dg-final-use { scan-tree-dump "hist->count 1 hist->all 1" "tree_profile" } } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { scan-ipa-dump "hist->count 1 hist->all 1" "tree_profile_ipa" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c index 101b9725f86..8f7508b4960 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c +++ b/gcc/testsuite/gcc.dg/tree-prof/indir-call-prof.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */ static int a1 (void) { @@ -37,9 +37,7 @@ main (void) return 0; } -/* { dg-final-use { scan-tree-dump "Indirect call -> direct call.* a1 transformation on insn" "tree_profile"} } */ -/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ -/* { dg-final-use { cleanup-tree-dump "optimized" } } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ - - +/* { dg-final-use { scan-ipa-dump "Indirect call -> direct call.* a1 transformation on insn" "tree_profile_ipa"} } */ +/* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ +/* { dg-final-use { cleanup-tree-dump "optimized" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c b/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c index 0f477b2376c..fe200c82f22 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/stringop-1.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */ int a[1000]; int b[1000]; int size=1; @@ -13,10 +13,10 @@ main() } return 0; } -/* { dg-final-use { scan-tree-dump "Single value 4 stringop" "tree_profile"} } */ +/* { dg-final-use { scan-ipa-dump "Single value 4 stringop" "tree_profile_ipa"} } */ /* Really this ought to simplify into assignment, but we are not there yet. */ /* a[0] = b[0] is what we fold the resulting memcpy into. */ /* { dg-final-use { scan-tree-dump " = MEM.*&b" "optimized"} } */ /* { dg-final-use { scan-tree-dump "MEM.*&a\\\] = " "optimized"} } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c b/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c index e6b49999d33..aa951c97c74 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c +++ b/gcc/testsuite/gcc.dg/tree-prof/stringop-2.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */ int a[1000]; int b[1000]; int size=1; @@ -13,8 +13,8 @@ main() } return 0; } -/* { dg-final-use { scan-tree-dump "Single value 4 stringop" "tree_profile"} } */ +/* { dg-final-use { scan-ipa-dump "Single value 4 stringop" "tree_profile_ipa"} } */ /* The versioned memset of size 4 should be optimized to an assignment. */ /* { dg-final-use { scan-tree-dump "a\\\[0\\\] = 168430090" "optimized"} } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c b/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c index 7654a533c82..385a1a5c2f3 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/tracer-1.c @@ -1,8 +1,8 @@ /* { dg-options "-O2 -ftracer -fdump-tree-tracer" } */ -main () +volatile int a, b, c; +int main () { int i; - int a, b, c; for (i = 0; i < 1000; i++) { if (i % 17) @@ -14,5 +14,5 @@ main () return 0; } /* Superblock formation should produce two copies of the increment of c */ -/* { dg-final-generate { scan-tree-dump-times "goto <bb 6>;" 2 "tracer" } } */ +/* { dg-final-generate { scan-tree-dump-times "c =" 2 "tracer" } } */ /* { dg-final-use { cleanup-tree-dump "tracer" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c b/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c index b132e5ab7fc..6b7dbd418a8 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c +++ b/gcc/testsuite/gcc.dg/tree-prof/update-loopch.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-tree_profile-blocks -fdump-tree-optimized-blocks" } */ +/* { dg-options "-O2 -fdump-ipa-tree_profile_ipa-blocks -fdump-tree-optimized-blocks" } */ int max = 33333; int a[8]; int @@ -14,8 +14,8 @@ main () /* Loop header copying will peel away the initial conditional, so the loop body is once reached directly from entry point of function, rest via loopback edge. */ -/* { dg-final-use { scan-tree-dump "count:33333" "tree_profile"} } */ +/* { dg-final-use { scan-ipa-dump "count:33333" "tree_profile_ipa"} } */ /* { dg-final-use { scan-tree-dump "count:33332" "optimized"} } */ /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c index 4d9cb1b9969..181b3d18443 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c +++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-1.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */ int a[1000]; int b = 256; int c = 257; @@ -15,8 +15,8 @@ main () } return 0; } -/* { dg-final-use { scan-tree-dump "Div.mod by constant n=257 transformation on insn" "tree_profile"} } */ +/* { dg-final-use { scan-ipa-dump "Div.mod by constant n_\[0-9\]*=257 transformation on insn" "tree_profile_ipa"} } */ /* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* != 257\\)" "optimized"} } */ /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c index 30a92c0157f..f96255d0c19 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c +++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-2.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */ unsigned int a[1000]; unsigned int b = 256; unsigned int c = 1024; @@ -23,10 +23,10 @@ main () } return 0; } -/* { dg-final-use { scan-tree-dump "Mod power of 2 transformation on insn" "tree_profile"} } */ +/* { dg-final-use { scan-ipa-dump "Mod power of 2 transformation on insn" "tree_profile_ipa" } } */ /* This is part of code checking that n is power of 2, so we are sure that the transformation didn't get optimized out. */ /* { dg-final-use { scan-tree-dump "n_\[0-9\]* \\+ 0xffff" "optimized"} } */ /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-3.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-3.c index ad32a44b32d..802dbf02af4 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-3.c +++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-3.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */ unsigned int a[1000]; unsigned int b = 257; unsigned int c = 1023; @@ -23,10 +23,10 @@ main () } return 0; } -/* { dg-final-use { scan-tree-dump "Mod subtract transformation on insn" "tree_profile"} } */ +/* { dg-final-use { scan-ipa-dump "Mod subtract transformation on insn" "tree_profile_ipa" } } */ /* This is part of code checking that n is greater than the divisor so we are sure that it didn't get optimized out. */ /* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* \\>" "optimized"} } */ /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-4.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-4.c index fdc2b0c6d65..d4d3085aa4e 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-4.c +++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-4.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */ unsigned int a[1000]; unsigned int b = 999; unsigned int c = 1002; @@ -23,10 +23,10 @@ main () } return 0; } -/* { dg-final-use { scan-tree-dump "Mod subtract transformation on insn" "tree_profile"} } */ +/* { dg-final-use { scan-ipa-dump "Mod subtract transformation on insn" "tree_profile_ipa" } } */ /* This is part of code checking that n is greater than the divisor so we are sure that it didn't get optimized out. */ /* { dg-final-use { scan-tree-dump "if \\(n_\[0-9\]* \\>" "optimized"} } */ /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-5.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-5.c index 095fb06b461..581f4d54a43 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-5.c +++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-5.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-tree_profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-tree_profile_ipa" } */ int a[1000]; int b=997; main() @@ -11,7 +11,7 @@ main() a[i]/=b; return 0; } -/* { dg-final-use { scan-tree-dump "Div.mod by constant b.*=997 transformation on insn" "tree_profile"} } */ +/* { dg-final-use { scan-ipa-dump "Div.mod by constant b.*=997 transformation on insn" "tree_profile_ipa" } } */ /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */ /* { dg-final-use { cleanup-tree-dump "optimized" } } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c index bb79c19d1f4..664b62039fc 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c +++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-tree_profile -mtune=core2" } */ +/* { dg-options "-O2 -fdump-ipa-tree_profile_ipa -mtune=core2" } */ /* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } } */ #include <strings.h> @@ -22,5 +22,5 @@ int main() { return 0; } -/* { dg-final-use { scan-tree-dump "Single value 8 stringop transformation on bzero" "tree_profile"} } */ -/* { dg-final-use { cleanup-tree-dump "tree_profile" } } */ +/* { dg-final-use { scan-ipa-dump "Single value 8 stringop transformation on bzero" "tree_profile_ipa" } } */ +/* { dg-final-use { cleanup-ipa-dump "tree_profile_ipa" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20080530.c b/gcc/testsuite/gcc.dg/tree-ssa/20080530.c index 6da7cb8a03a..bf222fee155 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20080530.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20080530.c @@ -18,5 +18,5 @@ baz (void) return 6; } -/* { dg-final { scan-tree-dump-times "Inlining foo into baz" 0 "einline2"} } */ -/* { dg-final { cleanup-tree-dump "einline2" } } */ +/* { dg-final { scan-tree-dump-times "Inlining foo into baz" 0 "einline"} } */ +/* { dg-final { cleanup-tree-dump "einline" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/foldconst-5.c b/gcc/testsuite/gcc.dg/tree-ssa/foldconst-5.c new file mode 100644 index 00000000000..1dad931ed7b --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/foldconst-5.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-ccp1" } */ + + +static const char a[5]="t"; +static const int b[5]={1,2}; +static const struct a {int a : 6; int b : 6;} c = {5,9}; +test() +{ + return a[2]+b[1]+b[3]+c.b; +} +/* { dg-final { scan-tree-dump "return 11;" "ccp1" } } */ +/* { dg-final { cleanup-tree-dump "ccp1" } } */ + diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c index 511cc9e2562..ff140ed5414 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-3.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-einline2" } */ +/* { dg-options "-O2 -fdump-tree-einline" } */ /* { dg-add-options bind_pic_locally } */ extern void inlined (); @@ -27,6 +27,6 @@ inline_me_too (void) { inlined(); } -/* { dg-final { scan-tree-dump-times "Inlining inline_me " 1 "einline2"} } */ -/* { dg-final { scan-tree-dump-times "Inlining inline_me_too " 1 "einline2"} } */ -/* { dg-final { cleanup-tree-dump "einline2" } } */ +/* { dg-final { scan-tree-dump-times "Inlining inline_me " 1 "einline"} } */ +/* { dg-final { scan-tree-dump-times "Inlining inline_me_too " 1 "einline"} } */ +/* { dg-final { cleanup-tree-dump "einline" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c b/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c index b89ce9759d0..1e700ef0227 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/inline-4.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-einline2" } */ +/* { dg-options "-O2 -fdump-tree-einline" } */ /* { dg-add-options bind_pic_locally } */ extern int rand(void); @@ -23,5 +23,5 @@ int main() } } -/* { dg-final { scan-tree-dump "Inlining get_data_for into main" "einline2" } } */ -/* { dg-final { cleanup-tree-dump "einline2" } } */ +/* { dg-final { scan-tree-dump "Inlining get_data_for into main" "einline" } } */ +/* { dg-final { cleanup-tree-dump "einline" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c b/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c new file mode 100644 index 00000000000..42bd2a21ef3 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr31261.c @@ -0,0 +1,40 @@ +/* PR tree-optimization/31261 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-original" } */ + +unsigned int +f1 (unsigned int a) +{ + return (8 - (a & 7)) & 7; +} + +long int +f2 (long int b) +{ + return (16 + (b & 7)) & 15; +} + +char +f3 (char c) +{ + return -(c & 63) & 31; +} + +int +f4 (int d) +{ + return (12 - (d & 15)) & 7; +} + +int +f5 (int e) +{ + return (12 - (e & 7)) & 15; +} + +/* { dg-final { scan-tree-dump-times "return -a \& 7;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return b \& 7;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return \\(char\\) -\\(unsigned char\\) c \& 31;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return \\(int\\) \\(12 - \\(unsigned int\\) d\\) \& 7;" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "return 12 - \\(e \& 7\\) \& 15;" 1 "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-8.c b/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-8.c index ea67946e505..afa5b3d241e 100644 --- a/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-8.c +++ b/gcc/testsuite/gcc.dg/vect/no-scevccp-outer-8.c @@ -46,5 +46,5 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail { ! { vect_hw_misalign } } } } } */ +/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED." 1 "vect" { xfail { ! { vect_element_align } } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-pr29145.c b/gcc/testsuite/gcc.dg/vect/no-vfa-pr29145.c index 954fe25df04..954474eb925 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-pr29145.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-pr29145.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-add-options quad_vectors } */ #include <stdarg.h> #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/pr45752.c b/gcc/testsuite/gcc.dg/vect/pr45752.c new file mode 100644 index 00000000000..b04caa12655 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr45752.c @@ -0,0 +1,109 @@ +/* { dg-require-effective-target vect_int } */ + +#include <stdarg.h> +#include <stdio.h> +#include "tree-vect.h" + +#define M00 100 +#define M10 216 +#define M20 23 +#define M30 237 +#define M40 437 + +#define M01 1322 +#define M11 13 +#define M21 27271 +#define M31 2280 +#define M41 284 + +#define M02 74 +#define M12 191 +#define M22 500 +#define M32 111 +#define M42 1114 + +#define M03 134 +#define M13 117 +#define M23 11 +#define M33 771 +#define M43 71 + +#define M04 334 +#define M14 147 +#define M24 115 +#define M34 7716 +#define M44 16 + +#define N 16 + +void foo (unsigned int *__restrict__ pInput, + unsigned int *__restrict__ pOutput, + unsigned int *__restrict__ pInput2, + unsigned int *__restrict__ pOutput2) +{ + unsigned int i, a, b, c, d, e; + + for (i = 0; i < N / 5; i++) + { + a = *pInput++; + b = *pInput++; + c = *pInput++; + d = *pInput++; + e = *pInput++; + + *pOutput++ = M00 * a + M01 * b + M02 * c + M03 * d + M04 * e; + *pOutput++ = M10 * a + M11 * b + M12 * c + M13 * d + M14 * e; + *pOutput++ = M20 * a + M21 * b + M22 * c + M23 * d + M24 * e; + *pOutput++ = M30 * a + M31 * b + M32 * c + M33 * d + M34 * e; + *pOutput++ = M40 * a + M41 * b + M42 * c + M43 * d + M44 * e; + + + a = *pInput2++; + b = *pInput2++; + c = *pInput2++; + d = *pInput2++; + e = *pInput2++; + + *pOutput2++ = M00 * a + M01 * b + M02 * c + M03 * d + M04 * e; + *pOutput2++ = M10 * a + M11 * b + M12 * c + M13 * d + M14 * e; + *pOutput2++ = M20 * a + M21 * b + M22 * c + M23 * d + M24 * e; + *pOutput2++ = M30 * a + M31 * b + M32 * c + M33 * d + M34 * e; + *pOutput2++ = M40 * a + M41 * b + M42 * c + M43 * d + M44 * e; + + } +} + +int main (int argc, const char* argv[]) +{ + unsigned int input[N], output[N], i, input2[N], output2[N]; + unsigned int check_results[N] = {3208, 1334, 28764, 35679, 2789, 13028, + 4754, 168364, 91254, 12399, 22848, 8174, 307964, 146829, 22009, 0}; + unsigned int check_results2[N] = {7136, 2702, 84604, 57909, 6633, 16956, + 6122, 224204, 113484, 16243, 26776, 9542, 363804, 169059, 25853, 0}; + + check_vect (); + + for (i = 0; i < N; i++) + { + input[i] = i%256; + input2[i] = i + 2; + output[i] = 0; + output2[i] = 0; + __asm__ volatile (""); + } + + foo (input, output, input2, output2); + + for (i = 0; i < N; i++) + if (output[i] != check_results[i] + || output2[i] != check_results2[i]) + abort (); + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 2 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ + diff --git a/gcc/testsuite/gcc.dg/vect/slp-25.c b/gcc/testsuite/gcc.dg/vect/slp-25.c index 0dec2f11cdc..45176398834 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-25.c +++ b/gcc/testsuite/gcc.dg/vect/slp-25.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-add-options quad_vectors } */ #include <stdarg.h> #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/slp-3.c b/gcc/testsuite/gcc.dg/vect/slp-3.c index 070715371bb..18614cdfb2e 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-3.c +++ b/gcc/testsuite/gcc.dg/vect/slp-3.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-add-options quad_vectors } */ #include <stdarg.h> #include <stdio.h> diff --git a/gcc/testsuite/gcc.dg/vect/vect-109.c b/gcc/testsuite/gcc.dg/vect/vect-109.c index ddba2635bff..1f2f53ed9eb 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-109.c +++ b/gcc/testsuite/gcc.dg/vect/vect-109.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-add-options quad_vectors } */ #include <stdarg.h> #include "tree-vect.h" @@ -72,8 +73,8 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_hw_misalign } } } */ -/* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 2 "vect" { xfail vect_hw_misalign } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_hw_misalign } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_element_align } } } */ +/* { dg-final { scan-tree-dump-times "not vectorized: unsupported unaligned store" 2 "vect" { xfail vect_element_align } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-42.c b/gcc/testsuite/gcc.dg/vect/vect-42.c index fa832008698..b9faea491d9 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-42.c +++ b/gcc/testsuite/gcc.dg/vect/vect-42.c @@ -64,8 +64,8 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" { target vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { { ! vector_alignment_reachable } && { ! vect_hw_misalign } } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail { vect_no_align || { { ! vector_alignment_reachable } || vect_hw_misalign } } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_hw_misalign } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { vect_no_align || { { ! vector_alignment_reachable } || vect_hw_misalign } } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { { ! vector_alignment_reachable } && { ! vect_element_align } } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail { vect_no_align || { { ! vector_alignment_reachable } || vect_element_align } } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 3 "vect" { target vect_element_align } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { vect_no_align || { { ! vector_alignment_reachable } || vect_element_align } } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-56.c b/gcc/testsuite/gcc.dg/vect/vect-56.c index 1555d41df6f..5a8130b11e2 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-56.c +++ b/gcc/testsuite/gcc.dg/vect/vect-56.c @@ -68,8 +68,8 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_hw_misalign } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_hw_misalign } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail { vect_hw_misalign } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_hw_misalign } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail { vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-60.c b/gcc/testsuite/gcc.dg/vect/vect-60.c index ba8ffe65400..838a9bca417 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-60.c +++ b/gcc/testsuite/gcc.dg/vect/vect-60.c @@ -69,8 +69,8 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_hw_misalign } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_hw_misalign } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail { vect_hw_misalign } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_hw_misalign } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail { vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { vect_element_align } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-93.c b/gcc/testsuite/gcc.dg/vect/vect-93.c index dfb98cfd541..65403eb72fc 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-93.c +++ b/gcc/testsuite/gcc.dg/vect/vect-93.c @@ -72,7 +72,7 @@ int main (void) /* main && main1 together: */ /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 2 "vect" { target powerpc*-*-* i?86-*-* x86_64-*-* } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target { vect_no_align && {! vector_alignment_reachable} } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" { xfail { { vect_no_align } || { { ! vector_alignment_reachable} || vect_hw_misalign } } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" { xfail { { vect_no_align } || { { ! vector_alignment_reachable} || vect_element_align } } } } } */ /* in main1: */ /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { target !powerpc*-*-* !i?86-*-* !x86_64-*-* } } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-95.c b/gcc/testsuite/gcc.dg/vect/vect-95.c index c1d5926e67d..c03d1965df1 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-95.c +++ b/gcc/testsuite/gcc.dg/vect/vect-95.c @@ -56,14 +56,14 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail {vect_hw_misalign} } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { xfail {vect_element_align} } } } */ /* For targets that support unaligned loads we version for the two unaligned stores and generate misaligned accesses for the loads. For targets that don't support unaligned loads we version for all four accesses. */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_hw_misalign} } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { xfail { vect_no_align || vect_hw_misalign } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align} } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target vect_no_align } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 4 "vect" { target vect_no_align } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-96.c b/gcc/testsuite/gcc.dg/vect/vect-96.c index c7dea6123a8..049ac243403 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-96.c +++ b/gcc/testsuite/gcc.dg/vect/vect-96.c @@ -44,6 +44,6 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { {! vect_no_align} && vector_alignment_reachable } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { vect_no_align } || { { ! vector_alignment_reachable} || vect_hw_misalign } } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { vect_no_align || { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { vect_no_align } || { { ! vector_alignment_reachable} || vect_element_align } } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning." 1 "vect" { target { vect_no_align || { {! vector_alignment_reachable} && {! vect_element_align} } } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c index 7981c4a475f..5e2b41a82f6 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-add-options quad_vectors } */ #include <stdarg.h> #include "tree-vect.h" diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-4.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-4.c index 3a83491065f..9cb6817cec1 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-4.c +++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-4.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-add-options quad_vectors } */ #include <stdarg.h> #include "tree-vect.h" @@ -92,9 +93,9 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail { vect_no_align } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { target { vect_hw_misalign} } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { vect_no_align || vect_hw_misalign } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 8 "vect" { xfail { vect_no_align || vect_hw_misalign } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { target { vect_hw_misalign } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" { target { vect_element_align} } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 8 "vect" { xfail { vect_no_align || vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { target { vect_element_align } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-5.c b/gcc/testsuite/gcc.dg/vect/vect-outer-5.c index 2fc421e9680..01094d343e8 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-5.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-5.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_float } */ +/* { dg-add-options quad_vectors } */ #include <stdio.h> #include <stdarg.h> diff --git a/gcc/testsuite/gcc.dg/vect/vect-peel-1.c b/gcc/testsuite/gcc.dg/vect/vect-peel-1.c index 6d73d3bb1ef..6af81a6f993 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-peel-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-peel-1.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-add-options quad_vectors } */ #include <stdarg.h> #include "tree-vect.h" @@ -45,7 +46,7 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_hw_misalign } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_hw_misalign } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_element_align } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-peel-2.c b/gcc/testsuite/gcc.dg/vect/vect-peel-2.c index 8163979def1..f518690b3d1 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-peel-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-peel-2.c @@ -1,4 +1,5 @@ /* { dg-require-effective-target vect_int } */ +/* { dg-add-options quad_vectors } */ #include <stdarg.h> #include "tree-vect.h" @@ -46,7 +47,7 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_hw_misalign } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_hw_misalign } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target vect_hw_misalign } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_element_align } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 2 "vect" { xfail { vect_no_align || vect_element_align } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target vect_element_align } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ |