diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-03-30 10:43:55 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-03-30 10:43:55 +0000 |
commit | 587e1de4ea2af5a01f5d53647201c974a8fea1f2 (patch) | |
tree | b792d7e01dbfff2d4cc77d4e4a50dc4ffae8c6ff /clang/test/OpenMP/declare_simd_messages.cpp | |
parent | 8e46cd05a17c0499f744a85f8ef905cafb47eb3e (diff) | |
download | bcm5719-llvm-587e1de4ea2af5a01f5d53647201c974a8fea1f2.tar.gz bcm5719-llvm-587e1de4ea2af5a01f5d53647201c974a8fea1f2.zip |
[OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.
Initial parsing/sema/serialization/deserialization support for '#pragma
omp declare simd' directive.
The 'declare simd' construct can be applied to a function to enable the
creation of one or more versions that can process multiple arguments
using SIMD instructions from a single invocation from a SIMD loop.
If the function has any declarations, then the declare simd construct
for any declaration that has one must be equivalent to the one specified
for the definition. Otherwise, the result is unspecified.
This pragma can be applied many times to the same declaration.
Internally this pragma is represented as an attribute. But we need special processing for this pragma because it must be used before function declaration, this directive is applied to.
Differential Revision: http://reviews.llvm.org/D10599
llvm-svn: 264853
Diffstat (limited to 'clang/test/OpenMP/declare_simd_messages.cpp')
-rw-r--r-- | clang/test/OpenMP/declare_simd_messages.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/clang/test/OpenMP/declare_simd_messages.cpp b/clang/test/OpenMP/declare_simd_messages.cpp new file mode 100644 index 00000000000..2085bfc2dde --- /dev/null +++ b/clang/test/OpenMP/declare_simd_messages.cpp @@ -0,0 +1,72 @@ +// RUN: %clang_cc1 -triple=x86_64-pc-win32 -verify -fopenmp -x c++ -std=c++11 -fms-extensions %s + +// expected-error@+1 {{expected an OpenMP directive}} +#pragma omp declare + +// expected-error@+2 {{'#pragma omp declare simd' can only be applied to functions}} +#pragma omp declare simd +int a; +// expected-error@+2 {{'#pragma omp declare simd' can only be applied to functions}} +#pragma omp declare simd +#pragma omp threadprivate(a) +int var; +#pragma omp threadprivate(var) + +// expected-error@+2 {{expected an OpenMP directive}} expected-error@+1 {{function declaration is expected after 'declare simd' directive}} +#pragma omp declare simd +#pragma omp declare + +// expected-error@+3 {{function declaration is expected after 'declare simd' directive}} +// expected-error@+1 {{function declaration is expected after 'declare simd' directive}} +#pragma omp declare simd +#pragma omp declare simd +#pragma options align=packed +int main(); + +// expected-error@+3 {{function declaration is expected after 'declare simd' directive}} +// expected-error@+1 {{function declaration is expected after 'declare simd' directive}} +#pragma omp declare simd +#pragma omp declare simd +#pragma init_seg(compiler) +int main(); + +// expected-error@+1 {{single declaration is expected after 'declare simd' directive}} +#pragma omp declare simd +int b, c; + +#pragma omp declare simd +template <class C> +void h(C *hp, C *hp2, C *hq, C *lin) { + b = 0; +} + +#pragma omp declare simd +template <> +void h(int *hp, int *hp2, int *hq, int *lin) { + h((float *)hp, (float *)hp2, (float *)hq, (float *)lin); +} + +template <class T> +struct St { +// expected-error@+2 {{function declaration is expected after 'declare simd' directive}} +#pragma init_seg(compiler) +#pragma omp declare simd +#pragma init_seg(compiler) + void h(T *hp) { +// expected-error@+1 {{unexpected OpenMP directive '#pragma omp declare simd'}} +#pragma omp declare simd + *hp = *t; + } + +private: + T t; +}; + +namespace N { + // expected-error@+1 {{function declaration is expected after 'declare simd' directive}} + #pragma omp declare simd +} +// expected-error@+1 {{function declaration is expected after 'declare simd' directive}} +#pragma omp declare simd +// expected-error@+1 {{function declaration is expected after 'declare simd' directive}} +#pragma omp declare simd |