gcc/libgomp/testsuite/libgomp.c-c++-common/critical-hint-2.c
Tobias Burnus ade6e7204c 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/.
2020-07-22 12:14:22 +02:00

38 lines
1.5 KiB
C

/* { dg-do compile } */
/* { dg-additional-options "-fdump-tree-original" } */
#include <omp.h>
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" } } */