diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2016-04-12 09:35:56 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-04-12 09:35:56 +0000 |
commit | d93d376ba9c9f2443f3bdd61e43e7b09b762ad24 (patch) | |
tree | 483e9beb248cea3f008785cf153b4987b5ae3fc5 /clang/test/OpenMP/declare_simd_messages.cpp | |
parent | 65f86cd8b09b15e6ba531309325750d1a3f4af7c (diff) | |
download | bcm5719-llvm-d93d376ba9c9f2443f3bdd61e43e7b09b762ad24.tar.gz bcm5719-llvm-d93d376ba9c9f2443f3bdd61e43e7b09b762ad24.zip |
[OPENMP 4.0] Support for 'aligned' clause in 'declare simd' directive.
The aligned clause declares that the object to which each list item points is aligned to the number of bytes expressed in the optional parameter of the aligned clause.
'aligned' '(' <argument-list> [ ':' <alignment> ] ')'
The optional parameter of the aligned clause, alignment, must be a constant positive integer expression. If no optional parameter is specified, implementation-defined default alignments for SIMD instructions on the target platforms are assumed.
The special this pointer can be used as if was one of the arguments to the function in any of the linear, aligned, or uniform clauses.
llvm-svn: 266052
Diffstat (limited to 'clang/test/OpenMP/declare_simd_messages.cpp')
-rw-r--r-- | clang/test/OpenMP/declare_simd_messages.cpp | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/clang/test/OpenMP/declare_simd_messages.cpp b/clang/test/OpenMP/declare_simd_messages.cpp index 70737ad2685..e1745aaa116 100644 --- a/clang/test/OpenMP/declare_simd_messages.cpp +++ b/clang/test/OpenMP/declare_simd_messages.cpp @@ -75,10 +75,10 @@ void h(int *hp, int *hp2, int *hq, int *lin) { #pragma omp declare simd simdlen() simdlen) void foo(); -// expected-error@+3 2 {{expected reference to one of the parameters of function 'foo'}} +// expected-error@+3 4 {{expected reference to one of the parameters of function 'foo'}} // expected-error@+2 {{invalid use of 'this' outside of a non-static member function}} // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} -#pragma omp declare simd simdlen(N) uniform(this, var) +#pragma omp declare simd simdlen(N) uniform(this, var) aligned(var) template<int N> void foo() {} @@ -105,7 +105,46 @@ void test() { #pragma omp declare simd uniform(this,a // expected-error@+1 {{expected expression}} #pragma omp declare simd uniform(,a) -void bar(int a); +// expected-error@+1 {{expected '(' after 'aligned'}} +#pragma omp declare simd aligned +// expected-note@+3 {{to match this '('}} +// expected-error@+2 {{expected ')'}} +// expected-error@+1 {{expected expression}} +#pragma omp declare simd aligned( +// expected-error@+1 {{expected expression}} +#pragma omp declare simd aligned() +// expected-note@+3 {{to match this '('}} +// expected-error@+2 {{expected ')'}} +// expected-error@+1 {{expected expression}} +#pragma omp declare simd aligned(a: +// expected-error@+1 {{expected expression}} +#pragma omp declare simd aligned(a:) +// expected-warning@+2 {{extra tokens at the end of '#pragma omp declare simd' are ignored}} +// expected-error@+1 {{expected '(' after 'aligned'}} +#pragma omp declare simd aligned :) +// expected-note@+3 {{to match this '('}} +// expected-error@+2 {{expected ')'}} +// expected-error@+1 {{invalid use of 'this' outside of a non-static member function}} +#pragma omp declare simd aligned(this +// expected-note@+3 {{to match this '('}} +// expected-error@+2 {{expected ')'}} +// expected-error@+1 {{invalid use of 'this' outside of a non-static member function}} +#pragma omp declare simd aligned(this,b +// expected-error@+1 {{expected expression}} +#pragma omp declare simd aligned(, b) +// expected-note@+4 {{defined as aligned}} +// expected-error@+3 {{a parameter cannot appear in more than one aligned clause}} +// expected-error@+2 {{expected expression}} +// expected-error@+1 {{expected ',' or ')' in 'aligned' clause}} +#pragma omp declare simd aligned(b) aligned(b ; 64) +// expected-note@+2 {{defined as aligned}} +// expected-error@+1 {{a parameter cannot appear in more than one aligned clause}} +#pragma omp declare simd aligned(b) aligned(b: 64) +// expected-error@+1 {{argument to 'aligned' clause must be a strictly positive integer value}} +#pragma omp declare simd aligned(b: -1) +// expected-warning@+1 {{aligned clause will be ignored because the requested alignment is not a power of 2}} +#pragma omp declare simd aligned(b: 3) +void bar(int a, int *b); template <class T> struct St { @@ -113,8 +152,11 @@ struct St { #pragma init_seg(compiler) #pragma omp declare simd #pragma init_seg(compiler) +// expected-note@+4 {{defined as aligned}} +// expected-error@+3 {{argument to 'aligned' clause must be a strictly positive integer value}} +// expected-error@+2 {{'this' cannot appear in more than one aligned clause}} // expected-error@+1 {{use of undeclared identifier 't'}} -#pragma omp declare simd uniform(this, t) +#pragma omp declare simd uniform(this, t) aligned(this: 4) aligned(this: -4) void h(T *hp) { // expected-error@+1 {{unexpected OpenMP directive '#pragma omp declare simd'}} #pragma omp declare simd |