1 // RUN: %libomp-compile-and-run
5 enum kmp_target_offload_kind
{
11 extern int __kmpc_get_target_offload();
12 extern void kmp_set_defaults(char const *str
);
14 const char *disabled_examples
[] = {
16 "disabled", "DISABLED", "Disabled", "dIsAbLeD", "DiSaBlEd"};
18 const char *default_examples
[] = {
20 "default", "DEFAULT", "Default", "deFAulT", "DEfaULt",
21 // These should be changed to default (failed match)
22 "mandatry", "defaults", "disable", "enabled", "mandatorynot"};
24 const char *mandatory_examples
[] = {
26 "mandatory", "MANDATORY", "Mandatory", "manDatoRy", "MANdATOry"};
28 // Return target-offload-var ICV
29 int get_target_offload_icv() {
32 return __kmpc_get_target_offload();
37 const char *omp_target_offload
= "OMP_TARGET_OFFLOAD=";
40 for (i
= 0; i
< sizeof(disabled_examples
) / sizeof(char *); ++i
) {
41 strcpy(buf
, omp_target_offload
);
42 strcat(buf
, disabled_examples
[i
]);
43 kmp_set_defaults(buf
);
44 if (tgt_disabled
!= get_target_offload_icv())
47 for (i
= 0; i
< sizeof(default_examples
) / sizeof(char *); ++i
) {
48 strcpy(buf
, omp_target_offload
);
49 strcat(buf
, default_examples
[i
]);
50 kmp_set_defaults(buf
);
51 if (tgt_default
!= get_target_offload_icv())
54 for (i
= 0; i
< sizeof(mandatory_examples
) / sizeof(char *); ++i
) {
55 strcpy(buf
, omp_target_offload
);
56 strcat(buf
, mandatory_examples
[i
]);
57 kmp_set_defaults(buf
);
58 if (tgt_mandatory
!= get_target_offload_icv())