From: Tobias Burnus Date: Wed, 22 Jul 2020 10:12:48 +0000 (+0200) Subject: critical-hint-*.{c,f90}: Move from gcc/testsuite to libgomp/testsuite X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ade6e7204ce4d179cd9fa4637ddee85ba1fa12d9;p=gcc.git critical-hint-*.{c,f90}: Move from gcc/testsuite to libgomp/testsuite libgomp/ChangeLog: * testsuite/libgomp.c-c++-common/critical-hint-1.c: New; moved from gcc/testsuite/c-c++-common/gomp/. * testsuite/libgomp.c-c++-common/critical-hint-2.c: Likewise. * testsuite/libgomp.fortran/critical-hint-1.f90: New; moved from gcc/testsuite/gfortran.dg/gomp/. * testsuite/libgomp.fortran/critical-hint-2.f90: Likewise. gcc/testsuite/ChangeLog: * c-c++-common/gomp/critical-hint-1.c: Moved to libgomp/. * c-c++-common/gomp/critical-hint-2.c: Moved to libgomp/. * gfortran.dg/gomp/critical-hint-1.f90: Moved to libgomp/. * gfortran.dg/gomp/critical-hint-2.f90: Moved to libgomp/. --- diff --git a/gcc/testsuite/c-c++-common/gomp/critical-hint-1.c b/gcc/testsuite/c-c++-common/gomp/critical-hint-1.c deleted file mode 100644 index 510f8abef80..00000000000 --- a/gcc/testsuite/c-c++-common/gomp/critical-hint-1.c +++ /dev/null @@ -1,47 +0,0 @@ -#include - -void -example_criticial () -{ - int a, b; - #pragma omp parallel for - for (int i = 0; i < 10; ++i) - { - #pragma omp critical hint(omp_sync_hint_none) /* OK */ - a += i; - #pragma omp critical (HASH) hint(omp_sync_hint_none) /* OK */ - a += i; - #pragma omp critical (HASH2) hint(omp_sync_hint_uncontended) /* OK */ - a += i; - #pragma omp critical (HASH3) hint(omp_sync_hint_contended) /* OK */ - a += i; - #pragma omp critical (HASH4) hint(omp_sync_hint_speculative) /* OK */ - a += i; - #pragma omp critical (HASH5) hint(omp_sync_hint_nonspeculative) /* OK */ - a += i; - #pragma omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) /* OK */ - a += i; - #pragma omp critical (HASH6) hint(omp_sync_hint_contended | omp_sync_hint_speculative) /* OK */ - a += i; - - /* Accepted but invalid: different hint for same name. */ - #pragma omp critical (HASH6) hint(omp_sync_hint_uncontended + omp_sync_hint_speculative) - a += i; - /* Accepted but invalid: Some random integer expr. */ - #pragma omp critical (HASH) hint(omp_sync_hint_speculative + 1 + 2) - a += i; - - #pragma omp critical (HASH) hint(-3) /* { dg-error "expected constant integer expression" } */ - a += i; - #pragma omp critical (HASH2) hint(b) /* { dg-error "constant integer expression" } */ - a += i; -/* - Fails with gcc as 'expected identifier' and - with g++ as "clause requires a name, except when 'omp_sync_hint_none'" - #pragma omp critical () hint(omp_sync_hint_speculative) - a += i; -*/ - #pragma omp critical hint(omp_sync_hint_speculative) /* { dg-error "with 'hint' clause requires a name, except when 'omp_sync_hint_none' is used" } */ - a += i; - } -} diff --git a/gcc/testsuite/c-c++-common/gomp/critical-hint-2.c b/gcc/testsuite/c-c++-common/gomp/critical-hint-2.c deleted file mode 100644 index effe24a63ec..00000000000 --- a/gcc/testsuite/c-c++-common/gomp/critical-hint-2.c +++ /dev/null @@ -1,36 +0,0 @@ -/* { dg-additional-options "-fdump-tree-original" } */ -#include - -void -example_criticial () -{ - int a, b; - #pragma omp parallel for - for (int i = 0; i < 10; ++i) - { - #pragma omp critical hint(omp_sync_hint_none) - a += i; - #pragma omp critical (HASH1) hint(omp_sync_hint_none) - a += i; - #pragma omp critical (HASH2) hint(omp_sync_hint_uncontended) - a += i; - #pragma omp critical (HASH3) hint(omp_sync_hint_contended) - a += i; - #pragma omp critical (HASH4) hint(omp_sync_hint_speculative) - a += i; - #pragma omp critical (HASH5) hint(omp_sync_hint_nonspeculative) - a += i; - #pragma omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) - a += i; - #pragma omp critical (HASH7) hint(omp_sync_hint_contended | omp_sync_hint_speculative) - a += i; - } -} - -/* { dg-final { scan-tree-dump-times "omp critical \\(HASH1\\) hint\\(0\\)" 1 "original" } } */ -/* { dg-final { scan-tree-dump-times "omp critical \\(HASH2\\) hint\\(1\\)" 1 "original" } } */ -/* { dg-final { scan-tree-dump-times "omp critical \\(HASH3\\) hint\\(2\\)" 1 "original" } } */ -/* { dg-final { scan-tree-dump-times "omp critical \\(HASH4\\) hint\\(8\\)" 1 "original" } } */ -/* { dg-final { scan-tree-dump-times "omp critical \\(HASH5\\) hint\\(4\\)" 1 "original" } } */ -/* { dg-final { scan-tree-dump-times "omp critical \\(HASH6\\) hint\\(10\\)" 1 "original" } } */ -/* { dg-final { scan-tree-dump-times "omp critical \\(HASH7\\) hint\\(10\\)" 1 "original" } } */ diff --git a/gcc/testsuite/gfortran.dg/gomp/critical-hint-1.f90 b/gcc/testsuite/gfortran.dg/gomp/critical-hint-1.f90 deleted file mode 100644 index c26b617f1bd..00000000000 --- a/gcc/testsuite/gfortran.dg/gomp/critical-hint-1.f90 +++ /dev/null @@ -1,94 +0,0 @@ -subroutine example_criticial () - use omp_lib - implicit none - integer, parameter :: my_omp_hint = omp_sync_hint_contended - integer i, a, b - - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH0) hint(my_omp_hint) ! OK - a = a + i; - !$omp end critical (HASH0) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH1) hint(omp_sync_hint_none) ! OK - a = a + i; - !$omp end critical (HASH1) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH2) hint(omp_sync_hint_uncontended) ! OK - a = a + i; - !$omp end critical (HASH2) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH3) hint(omp_sync_hint_contended) ! OK - a = a + i; - !$omp end critical (HASH3) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH4) hint(omp_sync_hint_speculative) ! OK - a = a + i; - !$omp end critical (HASH4) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH5) hint(omp_sync_hint_nonspeculative) ! OK - a = a + i; - !$omp end critical (HASH5) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) ! OK - a = a + i; - !$omp end critical (HASH6) - end do - - !$omp parallel do - do i = 1, 10 - ! Accepted but invalid: different hint for same name. - !$omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) ! OK - a = a + i; - !$omp end critical (HASH6) - end do - !$omp parallel do - do i = 1, 10 - ! Accepted but invalid: Some random integer expr. - !$omp critical (HASH) hint(1 + 2) - a = a + i; - !$omp end critical (HASH) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH) hint(-3) ! { dg-error "shall be a valid constant hint expression" } - a = a + i; - !$omp end critical (HASH) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH2) hint(b) ! { dg-error "shall be a valid constant hint expression" } - a = a + i; - !$omp end critical (HASH2) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical () hint(omp_hint_speculative) ! { dg-error "Invalid character in name" } - a = a + i; -! !$omp end critical - end do - !$omp parallel do - do i = 1, 10 - !$omp critical hint(omp_sync_hint_none) ! OK - a = a + i; - !$omp end critical - end do - !$omp parallel do - do i = 1, 10 - !$omp critical hint(omp_sync_hint_contended) ! { dg-error "CRITICAL at .1. with HINT clause requires a NAME, except when omp_sync_hint_none is used" } - a = a + i; - !$omp end critical - end do -end diff --git a/gcc/testsuite/gfortran.dg/gomp/critical-hint-2.f90 b/gcc/testsuite/gfortran.dg/gomp/critical-hint-2.f90 deleted file mode 100644 index 15d6206a438..00000000000 --- a/gcc/testsuite/gfortran.dg/gomp/critical-hint-2.f90 +++ /dev/null @@ -1,65 +0,0 @@ -! { dg-additional-options "-fdump-tree-original" } -subroutine example_criticial () - use omp_lib - implicit none - integer, parameter :: my_omp_hint = omp_sync_hint_contended - integer i, a, b - - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH0) hint(my_omp_hint) - a = a + i; - !$omp end critical (HASH0) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH1), hint(omp_sync_hint_none) - a = a + i; - !$omp end critical (HASH1) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH2) hint(omp_sync_hint_uncontended) - a = a + i; - !$omp end critical (HASH2) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH3) hint(omp_sync_hint_contended) - a = a + i; - !$omp end critical (HASH3) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH4) hint(omp_sync_hint_speculative) - a = a + i; - !$omp end critical (HASH4) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH5) hint(omp_sync_hint_nonspeculative) - a = a + i; - !$omp end critical (HASH5) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical (HASH6), hint(omp_sync_hint_contended + omp_sync_hint_speculative) - a = a + i; - !$omp end critical (HASH6) - end do - !$omp parallel do - do i = 1, 10 - !$omp critical hint(omp_sync_hint_none + omp_sync_hint_none) - a = a + i; - !$omp end critical - end do -end - -! { dg-final { scan-tree-dump-times "omp critical \\(hash0\\) hint\\(2\\)" 1 "original" } } -! { dg-final { scan-tree-dump-times "omp critical \\(hash1\\) hint\\(0\\)" 1 "original" } } -! { dg-final { scan-tree-dump-times "omp critical \\(hash2\\) hint\\(1\\)" 1 "original" } } -! { dg-final { scan-tree-dump-times "omp critical \\(hash3\\) hint\\(2\\)" 1 "original" } } -! { dg-final { scan-tree-dump-times "omp critical \\(hash4\\) hint\\(8\\)" 1 "original" } } -! { dg-final { scan-tree-dump-times "omp critical \\(hash5\\) hint\\(4\\)" 1 "original" } } -! { dg-final { scan-tree-dump-times "omp critical \\(hash6\\) hint\\(10\\)" 1 "original" } } -! { dg-final { scan-tree-dump-times "omp critical hint\\(0\\)" 1 "original" } } diff --git a/libgomp/testsuite/libgomp.c-c++-common/critical-hint-1.c b/libgomp/testsuite/libgomp.c-c++-common/critical-hint-1.c new file mode 100644 index 00000000000..1e49747477b --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/critical-hint-1.c @@ -0,0 +1,49 @@ +/* { dg-do compile } */ + +#include + +void +example_criticial () +{ + int a, b; + #pragma omp parallel for + for (int i = 0; i < 10; ++i) + { + #pragma omp critical hint(omp_sync_hint_none) /* OK */ + a += i; + #pragma omp critical (HASH) hint(omp_sync_hint_none) /* OK */ + a += i; + #pragma omp critical (HASH2) hint(omp_sync_hint_uncontended) /* OK */ + a += i; + #pragma omp critical (HASH3) hint(omp_sync_hint_contended) /* OK */ + a += i; + #pragma omp critical (HASH4) hint(omp_sync_hint_speculative) /* OK */ + a += i; + #pragma omp critical (HASH5) hint(omp_sync_hint_nonspeculative) /* OK */ + a += i; + #pragma omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) /* OK */ + a += i; + #pragma omp critical (HASH6) hint(omp_sync_hint_contended | omp_sync_hint_speculative) /* OK */ + a += i; + + /* Accepted but invalid: different hint for same name. */ + #pragma omp critical (HASH6) hint(omp_sync_hint_uncontended + omp_sync_hint_speculative) + a += i; + /* Accepted but invalid: Some random integer expr. */ + #pragma omp critical (HASH) hint(omp_sync_hint_speculative + 1 + 2) + a += i; + + #pragma omp critical (HASH) hint(-3) /* { dg-error "expected constant integer expression" } */ + a += i; + #pragma omp critical (HASH2) hint(b) /* { dg-error "constant integer expression" } */ + a += i; +/* + Fails with gcc as 'expected identifier' and + with g++ as "clause requires a name, except when 'omp_sync_hint_none'" + #pragma omp critical () hint(omp_sync_hint_speculative) + a += i; +*/ + #pragma omp critical hint(omp_sync_hint_speculative) /* { dg-error "with 'hint' clause requires a name, except when 'omp_sync_hint_none' is used" } */ + a += i; + } +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/critical-hint-2.c b/libgomp/testsuite/libgomp.c-c++-common/critical-hint-2.c new file mode 100644 index 00000000000..057353b6ce2 --- /dev/null +++ b/libgomp/testsuite/libgomp.c-c++-common/critical-hint-2.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-fdump-tree-original" } */ +#include + +void +example_criticial () +{ + int a, b; + #pragma omp parallel for + for (int i = 0; i < 10; ++i) + { + #pragma omp critical hint(omp_sync_hint_none) + a += i; + #pragma omp critical (HASH1) hint(omp_sync_hint_none) + a += i; + #pragma omp critical (HASH2) hint(omp_sync_hint_uncontended) + a += i; + #pragma omp critical (HASH3) hint(omp_sync_hint_contended) + a += i; + #pragma omp critical (HASH4) hint(omp_sync_hint_speculative) + a += i; + #pragma omp critical (HASH5) hint(omp_sync_hint_nonspeculative) + a += i; + #pragma omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) + a += i; + #pragma omp critical (HASH7) hint(omp_sync_hint_contended | omp_sync_hint_speculative) + a += i; + } +} + +/* { dg-final { scan-tree-dump-times "omp critical \\(HASH1\\) hint\\(0\\)" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "omp critical \\(HASH2\\) hint\\(1\\)" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "omp critical \\(HASH3\\) hint\\(2\\)" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "omp critical \\(HASH4\\) hint\\(8\\)" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "omp critical \\(HASH5\\) hint\\(4\\)" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "omp critical \\(HASH6\\) hint\\(10\\)" 1 "original" } } */ +/* { dg-final { scan-tree-dump-times "omp critical \\(HASH7\\) hint\\(10\\)" 1 "original" } } */ diff --git a/libgomp/testsuite/libgomp.fortran/critical-hint-1.f90 b/libgomp/testsuite/libgomp.fortran/critical-hint-1.f90 new file mode 100644 index 00000000000..225d9a7a221 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/critical-hint-1.f90 @@ -0,0 +1,96 @@ +! { dg-do compile } + +subroutine example_criticial () + use omp_lib + implicit none + integer, parameter :: my_omp_hint = omp_sync_hint_contended + integer i, a, b + + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH0) hint(my_omp_hint) ! OK + a = a + i; + !$omp end critical (HASH0) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH1) hint(omp_sync_hint_none) ! OK + a = a + i; + !$omp end critical (HASH1) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH2) hint(omp_sync_hint_uncontended) ! OK + a = a + i; + !$omp end critical (HASH2) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH3) hint(omp_sync_hint_contended) ! OK + a = a + i; + !$omp end critical (HASH3) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH4) hint(omp_sync_hint_speculative) ! OK + a = a + i; + !$omp end critical (HASH4) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH5) hint(omp_sync_hint_nonspeculative) ! OK + a = a + i; + !$omp end critical (HASH5) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) ! OK + a = a + i; + !$omp end critical (HASH6) + end do + + !$omp parallel do + do i = 1, 10 + ! Accepted but invalid: different hint for same name. + !$omp critical (HASH6) hint(omp_sync_hint_contended + omp_sync_hint_speculative) ! OK + a = a + i; + !$omp end critical (HASH6) + end do + !$omp parallel do + do i = 1, 10 + ! Accepted but invalid: Some random integer expr. + !$omp critical (HASH) hint(1 + 2) + a = a + i; + !$omp end critical (HASH) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH) hint(-3) ! { dg-error "shall be a valid constant hint expression" } + a = a + i; + !$omp end critical (HASH) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH2) hint(b) ! { dg-error "shall be a valid constant hint expression" } + a = a + i; + !$omp end critical (HASH2) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical () hint(omp_hint_speculative) ! { dg-error "Invalid character in name" } + a = a + i; +! !$omp end critical + end do + !$omp parallel do + do i = 1, 10 + !$omp critical hint(omp_sync_hint_none) ! OK + a = a + i; + !$omp end critical + end do + !$omp parallel do + do i = 1, 10 + !$omp critical hint(omp_sync_hint_contended) ! { dg-error "CRITICAL at .1. with HINT clause requires a NAME, except when omp_sync_hint_none is used" } + a = a + i; + !$omp end critical + end do +end diff --git a/libgomp/testsuite/libgomp.fortran/critical-hint-2.f90 b/libgomp/testsuite/libgomp.fortran/critical-hint-2.f90 new file mode 100644 index 00000000000..f34680ca718 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/critical-hint-2.f90 @@ -0,0 +1,66 @@ +! { dg-do compile } +! { dg-additional-options "-fdump-tree-original" } +subroutine example_criticial () + use omp_lib + implicit none + integer, parameter :: my_omp_hint = omp_sync_hint_contended + integer i, a, b + + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH0) hint(my_omp_hint) + a = a + i; + !$omp end critical (HASH0) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH1), hint(omp_sync_hint_none) + a = a + i; + !$omp end critical (HASH1) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH2) hint(omp_sync_hint_uncontended) + a = a + i; + !$omp end critical (HASH2) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH3) hint(omp_sync_hint_contended) + a = a + i; + !$omp end critical (HASH3) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH4) hint(omp_sync_hint_speculative) + a = a + i; + !$omp end critical (HASH4) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH5) hint(omp_sync_hint_nonspeculative) + a = a + i; + !$omp end critical (HASH5) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical (HASH6), hint(omp_sync_hint_contended + omp_sync_hint_speculative) + a = a + i; + !$omp end critical (HASH6) + end do + !$omp parallel do + do i = 1, 10 + !$omp critical hint(omp_sync_hint_none + omp_sync_hint_none) + a = a + i; + !$omp end critical + end do +end + +! { dg-final { scan-tree-dump-times "omp critical \\(hash0\\) hint\\(2\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "omp critical \\(hash1\\) hint\\(0\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "omp critical \\(hash2\\) hint\\(1\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "omp critical \\(hash3\\) hint\\(2\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "omp critical \\(hash4\\) hint\\(8\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "omp critical \\(hash5\\) hint\\(4\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "omp critical \\(hash6\\) hint\\(10\\)" 1 "original" } } +! { dg-final { scan-tree-dump-times "omp critical hint\\(0\\)" 1 "original" } }