diff options
| author | Alexander Musman <alexander.musman@gmail.com> | 2014-10-01 06:03:56 +0000 |
|---|---|---|
| committer | Alexander Musman <alexander.musman@gmail.com> | 2014-10-01 06:03:56 +0000 |
| commit | a5f070aec0386d941a9a1bc2d47adc95553975ea (patch) | |
| tree | 0eeff1d1f478a3664951b01e6ae0799c933206a9 /clang/test/OpenMP/simd_loop_messages.cpp | |
| parent | 6a107bad152aadeb93fda669f74ab77b728a12f5 (diff) | |
| download | bcm5719-llvm-a5f070aec0386d941a9a1bc2d47adc95553975ea.tar.gz bcm5719-llvm-a5f070aec0386d941a9a1bc2d47adc95553975ea.zip | |
[OPENMP] Loop collapsing and codegen for 'omp simd' directive.
This patch implements collapsing of the loops (in particular, in
presense of clause 'collapse'). It calculates number of iterations N
and expressions nesessary to calculate the nested loops counters
values based on new iteration variable (that goes from 0 to N-1)
in Sema. It also adds Codegen for 'omp simd', which uses
(and tests) this feature.
Differential Revision: http://reviews.llvm.org/D5184
llvm-svn: 218743
Diffstat (limited to 'clang/test/OpenMP/simd_loop_messages.cpp')
| -rw-r--r-- | clang/test/OpenMP/simd_loop_messages.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/test/OpenMP/simd_loop_messages.cpp b/clang/test/OpenMP/simd_loop_messages.cpp index ea663fddd9c..cdddeae4abc 100644 --- a/clang/test/OpenMP/simd_loop_messages.cpp +++ b/clang/test/OpenMP/simd_loop_messages.cpp @@ -300,8 +300,10 @@ class Iter0 { Iter0(const Iter0 &) { } Iter0 operator ++() { return *this; } Iter0 operator --() { return *this; } + Iter0 operator + (int delta) { return *this; } bool operator <(Iter0 a) { return true; } }; +// expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'Iter0' for 1st argument}} int operator -(Iter0 a, Iter0 b) { return 0; } class Iter1 { public: @@ -330,10 +332,14 @@ class GoodIter { typedef int difference_type; typedef std::random_access_iterator_tag iterator_category; }; +// expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}} int operator -(GoodIter a, GoodIter b) { return 0; } +// expected-note@+1 2 {{candidate function not viable: requires single argument 'a', but 2 arguments were provided}} GoodIter operator -(GoodIter a) { return a; } +// expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'GoodIter' for 1st argument}} GoodIter operator -(GoodIter a, int v) { return GoodIter(); } GoodIter operator +(GoodIter a, int v) { return GoodIter(); } +// expected-note@+1 2 {{candidate function not viable: no known conversion from 'Iter1' to 'int' for 1st argument}} GoodIter operator -(int v, GoodIter a) { return GoodIter(); } GoodIter operator +(int v, GoodIter a) { return GoodIter(); } @@ -370,7 +376,7 @@ int test_with_random_access_iterator() { for (begin = GoodIter(0); begin < end; ++begin) ++begin; #pragma omp simd - for (begin = begin0; begin < end; ++begin) + for (begin = GoodIter(1,2); begin < end; ++begin) ++begin; // expected-error@+2 {{initialization clause of OpenMP for loop must be of the form 'var = init' or 'T var = init'}} #pragma omp simd @@ -415,12 +421,16 @@ int test_with_random_access_iterator() { #pragma omp simd for (Iter0 I = begin0; I < end0; ++I) ++I; + // Initializer is constructor without params. // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} #pragma omp simd for (Iter0 I; I < end0; ++I) ++I; + Iter1 begin1, end1; + // expected-error@+3 {{invalid operands to binary expression ('Iter1' and 'Iter1')}} + // expected-error@+2 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}} #pragma omp simd for (Iter1 I = begin1; I < end1; ++I) ++I; @@ -429,11 +439,15 @@ int test_with_random_access_iterator() { #pragma omp simd for (Iter1 I = begin1; I >= end1; ++I) ++I; + // Initializer is constructor with all default params. + // expected-error@+4 {{invalid operands to binary expression ('Iter1' and 'Iter1')}} + // expected-error@+3 {{could not calculate number of iterations calling 'operator-' with upper and lower loop bounds}} // expected-warning@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} #pragma omp simd for (Iter1 I; I < end1; ++I) { } + return 0; } |

