diff --git a/clang/test/OpenMP/declare_variant_messages.c b/clang/test/OpenMP/declare_variant_messages.c --- a/clang/test/OpenMP/declare_variant_messages.c +++ b/clang/test/OpenMP/declare_variant_messages.c @@ -142,6 +142,30 @@ #pragma omp declare variant(diff_ret_variant) match(xxx={}) // expected-error {{variant in '#pragma omp declare variant' with type 'int (void)' is incompatible with type 'void (void)'}} expected-warning {{'xxx' is not a valid context set in a `declare variant`; set ignored}} expected-note {{context set options are: 'construct' 'device' 'implementation' 'user'}} expected-note {{the ignored set spans until here}} void diff_ret(void); +void incompat_attr_variant(void); + +#pragma omp declare variant(incompat_attr_variant) match(implementation={vendor(llvm)}) +__attribute__((cpu_dispatch(generic))) void incompat_attr_cpu_dispatch(void); // expected-error {{'#pragma omp declare variant' is not compatible with any target-specific attributes}} + +#pragma omp declare variant(incompat_attr_variant) match(implementation={vendor(llvm)}) +__attribute__((cpu_specific(generic))) void incompat_attr_cpu_specific(void); // expected-error {{'#pragma omp declare variant' is not compatible with any target-specific attributes}} + +// 'incompat_attr_target' is not a multiversion function until... +#pragma omp declare variant(incompat_attr_variant) match(implementation={vendor(llvm)}) +__attribute__((target("mmx"))) void incompat_attr_target(void); // expected-error {{'#pragma omp declare variant' is not compatible with any target-specific attributes}} + +// This declaration makes it one. +#pragma omp declare variant(incompat_attr_variant) match(implementation={vendor(llvm)}) +__attribute__((target("sse"))) void incompat_attr_target(void); // expected-error {{'#pragma omp declare variant' is not compatible with any target-specific attributes}} + +// 'incompat_attr_target_default' is always a multiversion function. +#pragma omp declare variant(incompat_attr_variant) match(implementation={vendor(llvm)}) +__attribute__((target("default"))) void incompat_attr_target_default(void); // expected-error {{'#pragma omp declare variant' is not compatible with any target-specific attributes}} + +// FIXME: No diagnostics are produced for use of the 'target_clones' attribute in an OMP variant declaration. +#pragma omp declare variant(incompat_attr_variant) match(implementation={vendor(llvm)}) +__attribute__((target_clones("sse,default"))) void incompat_attr_target_clones(void); + void marked(void); void not_marked(void);