* class.c (maybe_warn_about_overly_private_class): Ignore public
[official-gcc.git] / libgomp / testsuite / libgomp.hsa.c / switch-branch-1.c
blob9af1d6d07623a5f79d62a7493acb98a729901591
1 #include <assert.h>
3 #define s 100
5 #pragma omp declare target
6 int
7 switch1 (unsigned a)
9 switch (a)
11 case 1 ... 11:
12 return 11;
13 case 12 ... 13:
14 return 22;
15 default:
16 return 44;
20 int
21 switch2 (unsigned a)
23 switch (a)
25 case 1 ... 5:
26 return 1;
27 case 9 ... 11:
28 return a + 3;
29 case 12 ... 13:
30 return a + 3;
31 default:
32 return 44;
36 #define OFFSET 12
38 int
39 switch3 (unsigned a)
41 switch (a)
43 case (OFFSET + 0):
44 return 1;
45 case (OFFSET + 1)...(OFFSET + 11):
46 return 11;
47 case (OFFSET + 12)...(OFFSET + 13):
48 return (OFFSET + 22);
49 default:
50 return (OFFSET + 44);
54 int
55 switch4 (unsigned a)
57 switch (a)
59 case -2:
60 return 1;
61 case -1:
62 return a + 3;
63 case 3:
64 return a + 3;
65 default:
66 return 44;
69 #pragma omp end declare target
71 #define low -33
72 #define high 55
74 int
75 main (int argc)
77 int array[s];
79 #pragma omp target map(tofrom : array[:s])
81 for (int i = low; i < high; i++)
82 array[i - low] = switch1 (i);
85 for (int i = low; i < high; i++)
86 assert (array[i - low] == switch1 (i));
88 #pragma omp target map(tofrom : array[:s])
90 for (int i = low; i < high; i++)
91 array[i - low] = switch2 (i);
94 for (int i = low; i < high; i++)
95 assert (array[i - low] == switch2 (i));
97 #pragma omp target map(tofrom : array[:s])
99 for (int i = low; i < high; i++)
100 array[i - low] = switch3 (i);
103 for (int i = low; i < high; i++)
104 assert (array[i - low] == switch3 (i));
106 #pragma omp target map(tofrom : array[:s])
108 for (int i = low; i < high; i++)
109 array[i - low] = switch4 (i);
112 for (int i = low; i < high; i++)
113 assert (array[i - low] == switch4 (i));
115 return 0;