
As -foffload={options,targets,targets=options} is very convoluted, it has been split into -foffload=targets (supporting the old syntax for backward compatibilty) and -foffload-options={options,target=options}. Only the new syntax is documented. Additionally, -foffload=default is supported, which can reset the devices after -foffload=disable / -foffload=targets to the default, if needed. gcc/ChangeLog: PR other/67300 * common.opt (-foffload=): Update description. (-foffload-options=): New. * doc/invoke.texi (C Language Options): Document -foffload and -foffload-options. * gcc.c (check_offload_target_name): New, split off from handle_foffload_option. (check_foffload_target_names): New. (handle_foffload_option): Handle -foffload=default. (driver_handle_option): Update for -foffload-options. * lto-opts.c (lto_write_options): Use -foffload-options instead of -foffload. * lto-wrapper.c (merge_and_complain, append_offload_options): Likewise. * opts.c (common_handle_option): Likewise. libgomp/ChangeLog: PR other/67300 * testsuite/libgomp.c-c++-common/reduction-16.c: Replace -foffload=nvptx-none= by -foffload-options=nvptx-none= to avoid disabling other offload targets. * testsuite/libgomp.c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.c-c++-common/reduction-6.c: Likewise. * testsuite/libgomp.c/target-44.c: Likewise.
54 lines
1.1 KiB
C
54 lines
1.1 KiB
C
/* { dg-do run } */
|
|
/* { dg-additional-options "-foffload-options=nvptx-none=-latomic" { target offload_target_nvptx } } */
|
|
|
|
#include <stdlib.h>
|
|
|
|
#define N 512
|
|
|
|
#define GENERATE_TEST(T) \
|
|
int test_##T (void) \
|
|
{ \
|
|
T a[N], res = 0; \
|
|
\
|
|
for (int i = 0; i < N; ++i) \
|
|
a[i] = i & 1; \
|
|
\
|
|
_Pragma("omp target teams distribute reduction(||:res) defaultmap(tofrom:scalar)") \
|
|
for (int i = 0; i < N; ++i) \
|
|
res = res || a[i]; \
|
|
\
|
|
/* res should be non-zero. */\
|
|
if (!res) \
|
|
return 1; \
|
|
\
|
|
_Pragma("omp target teams distribute reduction(&&:res) defaultmap(tofrom:scalar)") \
|
|
for (int i = 0; i < N; ++i) \
|
|
res = res && a[i]; \
|
|
\
|
|
/* res should be zero. */ \
|
|
return res; \
|
|
}
|
|
|
|
GENERATE_TEST(char)
|
|
GENERATE_TEST(short)
|
|
GENERATE_TEST(int)
|
|
GENERATE_TEST(long)
|
|
#ifdef __SIZEOF_INT128__
|
|
GENERATE_TEST(__int128)
|
|
#endif
|
|
|
|
int main(void)
|
|
{
|
|
if (test_char ())
|
|
abort ();
|
|
if (test_short ())
|
|
abort ();
|
|
if (test_int ())
|
|
abort ();
|
|
if (test_long ())
|
|
abort ();
|
|
#ifdef __SIZEOF_INT128__
|
|
if (test___int128 ())
|
|
abort ();
|
|
#endif
|
|
}
|