mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-27 05:44:15 +08:00
9f5d22e3e2
(Most of) the tests added in commit f1bfba3a9b
"OpenMP: Constructors and destructors for "declare target" static aggregates"
had a mismatch between dump file production and its scanning; the former needs
to use 'offload_target_nvptx' (like 'offload_target_amdgcn'), not
'offload_device_nvptx'.
libgomp/
* testsuite/libgomp.c++/static-aggr-constructor-destructor-1.C:
Fix effective-target keyword.
* testsuite/libgomp.c++/static-aggr-constructor-destructor-2.C:
Likewise.
* testsuite/libgomp.c-c++-common/target-is-initial-host-2.c:
Likewise.
* testsuite/libgomp.c-c++-common/target-is-initial-host.c:
Likewise.
* testsuite/libgomp.fortran/target-is-initial-host-2.f90:
Likewise.
* testsuite/libgomp.fortran/target-is-initial-host.f: Likewise.
* testsuite/libgomp.fortran/target-is-initial-host.f90: Likewise.
44 lines
1.5 KiB
C
44 lines
1.5 KiB
C
/* { dg-do run } */
|
|
/* { dg-additional-options "-fno-builtin-omp_is_initial_device" } */
|
|
|
|
/* Check whether 'omp_is_initial_device()' is NOT compile-time optimized. */
|
|
|
|
/* { dg-additional-options "-fdump-tree-gimple -fdump-tree-optimized" } */
|
|
/* { dg-additional-options -foffload-options=-fdump-tree-optimized { target { offload_target_nvptx || offload_target_amdgcn } } } */
|
|
|
|
/* { dg-final { scan-tree-dump-times "omp_is_initial_device" 1 "gimple" } } */
|
|
|
|
/* { dg-final { scan-tree-dump-times "omp_is_initial_device" 1 "optimized" } } */
|
|
|
|
/* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-tree-dump-times "omp_is_initial_device" 1 "optimized" { target offload_target_amdgcn } } } */
|
|
/* { dg-final { only_for_offload_target nvptx-none scan-offload-tree-dump-times "omp_is_initial_device" 1 "optimized" { target offload_target_nvptx } } } */
|
|
|
|
|
|
#include <omp.h>
|
|
|
|
int
|
|
main ()
|
|
{
|
|
int is_initial, dev_num, initial;
|
|
initial = omp_get_initial_device();
|
|
for (int dev = omp_initial_device; dev <= omp_get_num_devices(); dev++)
|
|
{
|
|
is_initial = dev_num = 99;
|
|
#pragma omp target map(from: is_initial, dev_num) device(dev)
|
|
{
|
|
is_initial = omp_is_initial_device ();
|
|
dev_num = omp_get_device_num ();
|
|
}
|
|
if (dev == omp_initial_device || dev == initial)
|
|
{
|
|
if (dev_num != initial || is_initial != 1)
|
|
__builtin_abort ();
|
|
}
|
|
else
|
|
{
|
|
if (dev_num != dev || is_initial != 0)
|
|
__builtin_abort ();
|
|
}
|
|
}
|
|
}
|