diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r-- | gcc/testsuite/c-c++-common/goacc/pr69916.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/append-args-1.c | 14 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/append-args-interop.c | 44 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/dispatch-11.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/metadirective-device.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr118442.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119483-1.c | 29 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119483-2.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119484.c | 21 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119535.c | 31 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119537-1.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/pr119537-2.c | 23 |
14 files changed, 206 insertions, 19 deletions
diff --git a/gcc/testsuite/c-c++-common/goacc/pr69916.c b/gcc/testsuite/c-c++-common/goacc/pr69916.c index e037af34..5c46bb7 100644 --- a/gcc/testsuite/c-c++-common/goacc/pr69916.c +++ b/gcc/testsuite/c-c++-common/goacc/pr69916.c @@ -1,4 +1,4 @@ -/* { dg-additional-options "-O2" } */ +/* { dg-additional-options "-O2" } */ /* PR 69916, an loop determined to be empty sometime after omp-lower and before oacc-device-lower can evaporate leading to no GOACC_LOOP diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-1.c b/gcc/testsuite/c-c++-common/gomp/append-args-1.c index 2a47063..e03b8de 100644 --- a/gcc/testsuite/c-c++-common/gomp/append-args-1.c +++ b/gcc/testsuite/c-c++-common/gomp/append-args-1.c @@ -23,25 +23,19 @@ float base0(); float repl1(omp_interop_t, omp_interop_t); #pragma omp declare variant(repl1) match(construct={dispatch}) append_args(interop(target), interop(targetsync)) float base1(); -/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl1', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c } .-2 } */ -/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'float repl1\\(omp_interop_t, omp_interop_t\\)', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c++ } .-3 } */ void repl2(int *, int *, omp_interop_t, omp_interop_t); #pragma omp declare variant(repl2) match(construct={dispatch}) adjust_args(need_device_ptr : y) \ append_args(interop(target, targetsync, prefer_type(1)), \ interop(prefer_type({fr(3), attr("ompx_nop")},{fr(2)},{attr("ompx_all")}))) void base2(int *x, int *y); -/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl2', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c } .-3 } */ -/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'void repl2\\(int\\*, int\\*, omp_interop_t, omp_interop_t\\)', except when specifying all 2 objects in the 'interop' clause of the 'dispatch' directive" "" { target c++ } .-4 } */ void repl3(int, omp_interop_t, ...); #pragma omp declare variant(repl3) match(construct={dispatch}) \ append_args(interop(prefer_type("cuda", "hsa"))) void base3(int, ...); -/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl3', except when specifying all 1 objects in the 'interop' clause of the 'dispatch' directive" "" { target c } .-2 } */ -/* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)', except when specifying all 1 objects in the 'interop' clause of the 'dispatch' directive" "" { target c++ } .-3 } */ -/* { dg-note "'declare variant' candidate 'repl3' declared here" "" { target c } .-4 } */ -/* { dg-note "'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)' declared here" "" { target c++ } .-5 } */ +/* { dg-note "'declare variant' candidate 'repl3' declared here" "" { target c } .-2 } */ +/* { dg-note "'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)' declared here" "" { target c++ } .-3 } */ float repl4(short, short, omp_interop_t, short); #pragma omp declare variant(repl4) match(construct={dispatch}) append_args(interop(target)) append_args(interop(targetsync)) /* { dg-error "too many 'append_args' clauses" } */ @@ -75,15 +69,12 @@ test (int *a, int *b) #pragma omp dispatch interop ( obj1 ) x = base1 (); - /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-2 } */ #pragma omp dispatch interop ( obj1 ) base2 (a, b); - /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-2 } */ #pragma omp dispatch base3 (5, 1, 2, 3); - /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-2 } */ #pragma omp dispatch interop (obj2) base3 (5, 1, 2, 3); @@ -92,7 +83,6 @@ test (int *a, int *b) base3 (5, 1, 2, 3); /* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'repl3'" "" { target c } .-2 } */ /* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'void repl3\\(int, omp_interop_t, \\.\\.\\.\\)'" "" { target c++ } .-3 } */ - /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-4 } */ return x; } diff --git a/gcc/testsuite/c-c++-common/gomp/append-args-interop.c b/gcc/testsuite/c-c++-common/gomp/append-args-interop.c new file mode 100644 index 0000000..1211450 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/append-args-interop.c @@ -0,0 +1,44 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fdump-tree-gimple" } */ + +/* Test that interop objects are implicitly created/destroyed when a dispatch + construct doesn't provide enough of them to satisfy the declare variant + append_args clause. */ + +/* The following definitions are in omp_lib, which cannot be included + in gcc/testsuite/ */ + +#if __cplusplus >= 201103L +# define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__ +#else +# define __GOMP_UINTPTR_T_ENUM +#endif + +typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM +{ + omp_interop_none = 0, + __omp_interop_t_max__ = __UINTPTR_MAX__ +} omp_interop_t; + +float repl1(omp_interop_t, omp_interop_t, omp_interop_t); + +#pragma omp declare variant(repl1) match(construct={dispatch}) append_args(interop(target), interop(targetsync), interop (target)) +float base1(void); + +float +test (int *a, int *b) +{ + omp_interop_t obj1; + float x; + + /* repl1 takes 3 interop arguments, one will come from the dispatch + construct and the other 2 will be consed up. */ + #pragma omp dispatch interop ( obj1 ) + x = base1 (); + + return x; +} + +/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 2, interopobjs\.\[0-9\]+, tgt_tgtsync\.\[0-9\]+," "gimple" } } */ +/* { dg-final { scan-tree-dump "__builtin_GOMP_interop \\(D\.\[0-9\]+, 0, 0B, 0B, 0B, 0, 0B, 2, interopobjs\.\[0-9\]+," "gimple" } } */ +/* { dg-final { scan-tree-dump "repl1 \\(obj1, interop\.\[0-9\]+, interop\.\[0-9\]+\\)" "gimple" } } */ diff --git a/gcc/testsuite/c-c++-common/gomp/dispatch-11.c b/gcc/testsuite/c-c++-common/gomp/dispatch-11.c index e59985a..79dcd0a 100644 --- a/gcc/testsuite/c-c++-common/gomp/dispatch-11.c +++ b/gcc/testsuite/c-c++-common/gomp/dispatch-11.c @@ -87,12 +87,9 @@ test (int *a, int *b) base3 (a, b); /* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'repl3'" "" { target c } .-2 } */ /* { dg-error "number of list items in 'interop' clause \\(2\\) exceeds the number of 'append_args' items \\(1\\) for 'declare variant' candidate 'void repl3\\(int\\*, int\\*, omp_interop_t\\)'" "" { target c++ } .-3 } */ - /* { dg-note "required by 'dispatch' construct" "" { target *-*-* } .-4 } */ #pragma omp dispatch interop(obj3) base3 (a, b); - /* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'repl3'" "" { target c } 28 } */ - /* { dg-message "sorry, unimplemented: 'append_args' clause not yet supported for 'void repl3\\(int\\*, int\\*, omp_interop_t\\)'" "" { target c++ } 28 } */ return x + y; } diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-device.c b/gcc/testsuite/c-c++-common/gomp/metadirective-device.c index 3807624..d7f736d 100644 --- a/gcc/testsuite/c-c++-common/gomp/metadirective-device.c +++ b/gcc/testsuite/c-c++-common/gomp/metadirective-device.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-additional-options "-foffload=disable -fdump-tree-optimized" } */ -/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=sse -msse" { target { x86_64-*-* && { ! ia32 } } } } */ +/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=sse -msse" { target { x86 && lp64 } } } */ #include <stdlib.h> diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c index 5d3a4c3..284f35f 100644 --- a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c +++ b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-1.c @@ -1,6 +1,6 @@ /* { dg-do compile } */ /* { dg-additional-options "-fdump-tree-optimized" } */ -/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=mmx -mmmx" { target { x86_64-*-* && { ! ia32 } } } } */ +/* { dg-additional-options "-DDEVICE_ARCH=x86_64 -DDEVICE_ISA=mmx -mmmx" { target { x86 && lp64 } } } */ #include <stdlib.h> diff --git a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c index 24584f2..4de1921 100644 --- a/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c +++ b/gcc/testsuite/c-c++-common/gomp/metadirective-target-device-2.c @@ -1,4 +1,4 @@ -/* { dg-do compile */ +/* { dg-do compile } */ /* { dg-additional-options "-fdump-tree-optimized" } */ /* In configurations without offloading configured, we can resolve many diff --git a/gcc/testsuite/c-c++-common/pr118442.c b/gcc/testsuite/c-c++-common/pr118442.c new file mode 100644 index 0000000..2472aa6 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr118442.c @@ -0,0 +1,17 @@ +/* PR118442 */ +/* { dg-do compile { target { struct_musttail && { external_musttail && { c || c++11 } } } } } */ +/* { dg-options "-fprofile-generate -O2" } */ +/* { dg-require-profiling "-fprofile-generate" } */ + +struct Span { + int test[5]; +}; + +extern void resolveToBufferSlow (struct Span *buffer); + +void +resolveToBuffer (struct Span *buffer) +{ + buffer->test[0] = 4; + [[clang::musttail]] return resolveToBufferSlow (buffer); +} diff --git a/gcc/testsuite/c-c++-common/pr119483-1.c b/gcc/testsuite/c-c++-common/pr119483-1.c new file mode 100644 index 0000000..b2d7b57 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119483-1.c @@ -0,0 +1,29 @@ +/* PR tree-optimization/119483 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "bar\[.a-z0-9]* \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */ +/* { dg-final { scan-tree-dump-times "baz \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */ + +[[gnu::noreturn]] extern void foo (void); + +[[gnu::noinline]] static int +bar (int x) +{ + (void) x; + foo (); + return 0; +} + +[[gnu::noipa]] int +baz (int x) +{ + return x + 42; +} + +int +qux (int x) +{ + if (x == 1) + [[gnu::musttail]] return bar (1); + [[gnu::musttail]] return baz (x); +} diff --git a/gcc/testsuite/c-c++-common/pr119483-2.c b/gcc/testsuite/c-c++-common/pr119483-2.c new file mode 100644 index 0000000..e7b692d --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119483-2.c @@ -0,0 +1,12 @@ +/* PR tree-optimization/119483 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-O2" } */ + +[[noreturn]] int +foo (int x) +{ + if (x > 10) + [[gnu::musttail]] return foo (x - 1); /* { dg-warning "function declared 'noreturn' has a 'return' statement" } */ + for (;;) + ; +} diff --git a/gcc/testsuite/c-c++-common/pr119484.c b/gcc/testsuite/c-c++-common/pr119484.c new file mode 100644 index 0000000..6ae7c9a --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119484.c @@ -0,0 +1,21 @@ +/* PR ipa/119484 */ +/* { dg-do compile { target musttail } } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-final { scan-tree-dump-times "bar\[.a-z0-9]* \\\(\[^\n\r]*\\\); \\\[tail call\\\] \\\[must tail call\\\]" 1 "optimized" } } */ + +void foo (int); + +[[gnu::noinline]] static int +bar (int x) +{ + foo (x); + return 0; +} + +int +baz (int x) +{ + if (x == 1) + [[gnu::musttail]] return bar (x); + return 0; +} diff --git a/gcc/testsuite/c-c++-common/pr119535.c b/gcc/testsuite/c-c++-common/pr119535.c new file mode 100644 index 0000000..fd88cc4 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119535.c @@ -0,0 +1,31 @@ +/* PR gcov-profile/119535 +/* { dg-do compile { target musttail } } */ +/* { dg-options "-fprofile-generate -O2" } */ +/* { dg-require-profiling "-fprofile-generate" } */ + +[[gnu::noipa]] int +foo (int x) +{ + return 42 + x; +} + +int +bar (int x) +{ + foo (x); + foo (2); + [[clang::musttail]] return foo (3); +} + +int +baz (int x) +{ + if (x == 42) + return -1; + else if (x == 15) + return 25; + else if (x == 26) + [[clang::musttail]] return foo (4); + else + [[clang::musttail]] return foo (5); +} diff --git a/gcc/testsuite/c-c++-common/pr119537-1.c b/gcc/testsuite/c-c++-common/pr119537-1.c new file mode 100644 index 0000000..7959826 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119537-1.c @@ -0,0 +1,23 @@ +/* PR middle-end/119537 */ +/* { dg-do compile } */ +/* { dg-options "-O0" } */ + +volatile int v; +void *bar (void *, void *); + +void +foo (bool z) +{ + if (z) + goto *&&x; /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */ + /* { dg-message "as a possible target of computed goto" "" { target c++ } .-1 } */ + [[gnu::assume (({ x: v += 1; true; }))]];/* { dg-message "'x' defined here" } */ + /* { dg-warning "jump to label 'x'" "" { target c++ } .-1 } */ + /* { dg-message "enters statement expression" "" { target c++ } .-2 } */ + [[gnu::assume (({ y: v += 1; true; }))]];/* { dg-message "'y' defined here" } */ + /* { dg-warning "jump to label 'y'" "" { target c++ } .-1 } */ + goto *bar (&&x, &&y); /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */ + /* { dg-error "reference to label 'y' defined inside of 'assume' attribute expression from outside of the attribute" "" { target *-*-* } .-1 } */ + /* { dg-message "as a possible target of computed goto" "" { target c++ } .-2 } */ + /* { dg-message "enters statement expression" "" { target c++ } .-3 } */ +} diff --git a/gcc/testsuite/c-c++-common/pr119537-2.c b/gcc/testsuite/c-c++-common/pr119537-2.c new file mode 100644 index 0000000..7d65672 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr119537-2.c @@ -0,0 +1,23 @@ +/* PR middle-end/119537 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +volatile int v; +void *bar (void *, void *); + +void +foo (bool z) +{ + if (z) + goto *&&x; /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */ + /* { dg-message "as a possible target of computed goto" "" { target c++ } .-1 } */ + [[gnu::assume (({ x: v += 1; true; }))]];/* { dg-message "'x' defined here" } */ + /* { dg-warning "jump to label 'x'" "" { target c++ } .-1 } */ + /* { dg-message "enters statement expression" "" { target c++ } .-2 } */ + [[gnu::assume (({ y: v += 1; true; }))]];/* { dg-message "'y' defined here" } */ + /* { dg-warning "jump to label 'y'" "" { target c++ } .-1 } */ + goto *bar (&&x, &&y); /* { dg-error "reference to label 'x' defined inside of 'assume' attribute expression from outside of the attribute" } */ + /* { dg-error "reference to label 'y' defined inside of 'assume' attribute expression from outside of the attribute" "" { target *-*-* } .-1 } */ + /* { dg-message "as a possible target of computed goto" "" { target c++ } .-2 } */ + /* { dg-message "enters statement expression" "" { target c++ } .-3 } */ +} |