OpenMP: Permit additional selector properties

This patch adds "hpe" to the known properties for the "vendor" selector,
and support for "acquire" and "release" for "atomic_default_mem_order".

gcc/ChangeLog
	* omp-general.cc (vendor_properties): Add "hpe".
	(atomic_default_mem_order_properties): Add "acquire" and "release".
	(omp_context_selector_matches): Handle "acquire" and "release".

gcc/testsuite/ChangeLog
	* c-c++-common/gomp/declare-variant-2.c: Don't expect error on
	"acquire" and "release".
	* gfortran.dg/gomp/declare-variant-2a.f90: Likewise.
This commit is contained in:
Sandra Loosemore 2023-12-06 19:53:27 +00:00
parent 9f9b3d6732
commit d0603dfe9d
3 changed files with 12 additions and 6 deletions

View File

@ -1128,12 +1128,12 @@ const char *omp_tss_map[] =
static const char *const kind_properties[] =
{ "host", "nohost", "cpu", "gpu", "fpga", "any", NULL };
static const char *const vendor_properties[] =
{ "amd", "arm", "bsc", "cray", "fujitsu", "gnu", "ibm", "intel",
{ "amd", "arm", "bsc", "cray", "fujitsu", "gnu", "hpe", "ibm", "intel",
"llvm", "nvidia", "pgi", "ti", "unknown", NULL };
static const char *const extension_properties[] =
{ NULL };
static const char *const atomic_default_mem_order_properties[] =
{ "seq_cst", "relaxed", "acq_rel", NULL };
{ "seq_cst", "relaxed", "acq_rel", "acquire", "release", NULL };
struct omp_ts_info omp_ts_map[] =
{
@ -1557,6 +1557,12 @@ omp_context_selector_matches (tree ctx)
else if (!strcmp (prop, "acq_rel")
&& omo != OMP_MEMORY_ORDER_ACQ_REL)
return 0;
else if (!strcmp (prop, "acquire")
&& omo != OMP_MEMORY_ORDER_ACQUIRE)
return 0;
else if (!strcmp (prop, "release")
&& omo != OMP_MEMORY_ORDER_RELEASE)
return 0;
}
break;
case OMP_TRAIT_DEVICE_ARCH:

View File

@ -105,9 +105,9 @@ void f50 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" {
void f51 (void); /* { dg-error "expected '\\\}' before '\\(' token" "" { target c } .-1 } */
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order}) /* { dg-error "expected '\\(' before '\\\}' token" } */
void f52 (void);
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order(acquire)}) /* { dg-error "incorrect property 'acquire' of 'atomic_default_mem_order' selector" } */
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order(acquire)})
void f53 (void);
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order(release)}) /* { dg-error "incorrect property 'release' of 'atomic_default_mem_order' selector" } */
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order(release)})
void f54 (void);
#pragma omp declare variant (f1) match(implementation={atomic_default_mem_order(foobar)}) /* { dg-error "incorrect property 'foobar' of 'atomic_default_mem_order' selector" } */
void f55 (void);

View File

@ -29,10 +29,10 @@ contains
!$omp declare variant (f1) match(implementation={vendor("foobar")}) ! { dg-warning "unknown property '.foobar.' of 'vendor' selector" }
end subroutine
subroutine f53 ()
!$omp declare variant (f1) match(implementation={atomic_default_mem_order(acquire)}) ! { dg-error "incorrect property 'acquire' of 'atomic_default_mem_order' selector" }
!$omp declare variant (f1) match(implementation={atomic_default_mem_order(acquire)})
end subroutine
subroutine f54 ()
!$omp declare variant (f1) match(implementation={atomic_default_mem_order(release)}) ! { dg-error "incorrect property 'release' of 'atomic_default_mem_order' selector" }
!$omp declare variant (f1) match(implementation={atomic_default_mem_order(release)})
end subroutine
subroutine f55 ()
!$omp declare variant (f1) match(implementation={atomic_default_mem_order(foobar)}) ! { dg-error "incorrect property 'foobar' of 'atomic_default_mem_order' selector" }