]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgomp/testsuite/libgomp.c-c++-common/requires-4.c
AVR: target/115317 - Make isinf(-Inf) return -1.
[thirdparty/gcc.git] / libgomp / testsuite / libgomp.c-c++-common / requires-4.c
1 /* { dg-require-effective-target lto } */
2 /* { dg-additional-options "-flto" } */
3 /* { dg-additional-options "-foffload-options=nvptx-none=-misa=sm_35" { target { offload_target_nvptx } } } */
4 /* { dg-additional-sources requires-4-aux.c } */
5
6 /* Check no diagnostic by device-compiler's or host compiler's lto1.
7 Other file uses: 'requires reverse_offload', but that's inactive as
8 there are no declare target directives, device constructs nor device routines */
9
10 /* Depending on offload device capabilities, it may print something like the
11 following (only) if GOMP_DEBUG=1:
12 "devices present but 'omp requires unified_address, unified_shared_memory, reverse_offload' cannot be fulfilled"
13 and in that case does host-fallback execution.
14
15 No offload devices support USM at present, so we may verify host-fallback
16 execution by presence of separate memory spaces. */
17
18 #pragma omp requires unified_address,unified_shared_memory
19
20 int a[10] = { 0 };
21 extern void foo (void);
22
23 int
24 main (void)
25 {
26 #pragma omp target map(to: a)
27 for (int i = 0; i < 10; i++)
28 a[i] = i;
29
30 for (int i = 0; i < 10; i++)
31 if (a[i] != i)
32 __builtin_abort ();
33
34 foo ();
35 return 0;
36 }