diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp index 57fb6b068f3..8c5ecfff0ac 100644 --- a/libgomp/testsuite/lib/libgomp.exp +++ b/libgomp/testsuite/lib/libgomp.exp @@ -451,7 +451,6 @@ proc check_effective_target_openacc_nvidia_accel_selected { } { # Return 1 if using Intel MIC offload device. proc check_effective_target_offload_device_intel_mic { } { return [check_runtime_nocache offload_device_intel_mic { - #include #include "testsuite/libgomp.c-c++-common/on_device_arch.h" int main () { @@ -460,6 +459,17 @@ proc check_effective_target_offload_device_intel_mic { } { } ] } +# Return 1 if any Intel MIC offload device is available. +proc check_effective_target_offload_device_any_intel_mic { } { + return [check_runtime_nocache offload_device_any_intel_mic { + #include "testsuite/libgomp.c-c++-common/on_device_arch.h" + int main () + { + return !any_device_arch_intel_mic (); + } + } ] +} + # Return 1 if the OpenACC 'host' device type is selected. proc check_effective_target_openacc_host_selected { } { diff --git a/libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h b/libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h index ee541dd2260..f92743b04d7 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h +++ b/libgomp/testsuite/libgomp.c-c++-common/on_device_arch.h @@ -1,3 +1,4 @@ +#include #include /* static */ int @@ -41,3 +42,25 @@ on_device_arch_intel_mic () { return on_device_arch (GOMP_DEVICE_INTEL_MIC); } + +static int +any_device_arch (int d) +{ + int nd = omp_get_num_devices (); + for (int i = 0; i < nd; ++i) + { + int d_cur; + #pragma omp target device(i) map(from:d_cur) + d_cur = device_arch (); + if (d_cur == d) + return 1; + } + + return 0; +} + +int +any_device_arch_intel_mic () +{ + return any_device_arch (GOMP_DEVICE_INTEL_MIC); +} diff --git a/libgomp/testsuite/libgomp.c-c++-common/target-45.c b/libgomp/testsuite/libgomp.c-c++-common/target-45.c index 837503996d7..27bbeddf7fd 100644 --- a/libgomp/testsuite/libgomp.c-c++-common/target-45.c +++ b/libgomp/testsuite/libgomp.c-c++-common/target-45.c @@ -1,4 +1,4 @@ -/* { dg-xfail-run-if TODO { offload_device_intel_mic } } */ +/* { dg-xfail-run-if TODO { offload_device_any_intel_mic } } */ #include #include diff --git a/libgomp/testsuite/libgomp.fortran/target10.f90 b/libgomp/testsuite/libgomp.fortran/target10.f90 index f6951fc9057..31452554d67 100644 --- a/libgomp/testsuite/libgomp.fortran/target10.f90 +++ b/libgomp/testsuite/libgomp.fortran/target10.f90 @@ -1,5 +1,5 @@ ! { dg-do run } -! { dg-xfail-run-if TODO { offload_device_intel_mic } } +! { dg-xfail-run-if TODO { offload_device_any_intel_mic } } program main use omp_lib