diff options
author | Tyler Nowicki <tyler.nowicki@gmail.com> | 2014-10-12 20:46:07 +0000 |
---|---|---|
committer | Tyler Nowicki <tyler.nowicki@gmail.com> | 2014-10-12 20:46:07 +0000 |
commit | c724a83e2054d65a26141bc7518450519dd9b4c7 (patch) | |
tree | 53d2c2d4e4708e8af6bf1c36bc267bda153b5ecc /clang/test/PCH/pragma-loop.cpp | |
parent | 7000ca3f55b87a26883f3aca4855c93ada74b749 (diff) | |
download | bcm5719-llvm-c724a83e2054d65a26141bc7518450519dd9b4c7.tar.gz bcm5719-llvm-c724a83e2054d65a26141bc7518450519dd9b4c7.zip |
Allow constant expressions in pragma loop hints.
Previously loop hints such as #pragma loop vectorize_width(#) required a constant. This patch allows a constant expression to be used as well. Such as a non-type template parameter or an expression (2 * c + 1).
Reviewed by Richard Smith
llvm-svn: 219589
Diffstat (limited to 'clang/test/PCH/pragma-loop.cpp')
-rw-r--r-- | clang/test/PCH/pragma-loop.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/test/PCH/pragma-loop.cpp b/clang/test/PCH/pragma-loop.cpp index 3eb1f60d96b..2640020f000 100644 --- a/clang/test/PCH/pragma-loop.cpp +++ b/clang/test/PCH/pragma-loop.cpp @@ -16,6 +16,8 @@ // CHECK: #pragma unroll // CHECK: #pragma unroll (32) // CHECK: #pragma nounroll +// CHECK: #pragma clang loop interleave_count(I) +// CHECK: #pragma clang loop vectorize_width(V) #ifndef HEADER #define HEADER @@ -81,6 +83,15 @@ public: i++; } } + + template <int V, int I> + inline void run7(int *List, int Length) { +#pragma clang loop vectorize_width(V) +#pragma clang loop interleave_count(I) + for (int i = 0; i < Length; i++) { + List[i] = i; + } + } }; #else @@ -95,6 +106,7 @@ void test() { pt.run4(List, 100); pt.run5(List, 100); pt.run6(List, 100); + pt.run7<2, 4>(List, 100); } #endif |