Debian Codegraph @

libgomp/testsuite/libgomp.c/target-simd-clone-2.c

raw
1 /* { dg-do link { target { offload_target_amdgcn } } } */
2 /* { dg-additional-options "-foffload-options=-fdump-ipa-simdclone-details -foffload-options=-fno-openmp-target-simd-clone" } */
3
4 /* Test that simd clones for the offload processor are not generated for
5 functions with "declare target" when explicitly disabled. */
6
7 #pragma omp declare target
8 __attribute__ ((__noinline__)) int addit (int a, int b)
9 {
10 return a + b;
11 }
12
13 __attribute__ ((__noinline__))
14 void callit (int *a, int *b, int *c)
15 {
16 int i;
17 #pragma omp for simd
18 for (i = 0; i < 16; i++)
19 c[i] = addit (a[i], b[i]);
20 }
21 #pragma omp end declare target
22
23 int main (void)
24 {
25 int aa[16], bb[16], cc[16];
26 int i;
27 for (i = 0; i < 16; i++)
28 {
29 aa[i] = i;
30 bb[i] = -i;
31 }
32 callit (aa, bb, cc);
33 for (i = 0; i < 16; i++)
34 if (cc[i] != 0)
35 return 1;
36 return 0;
37 }
38
39 /* { dg-final { only_for_offload_target amdgcn-amdhsa scan-offload-ipa-dump-not "Generated .* clone" "simdclone" } } */