summaryrefslogtreecommitdiff
path: root/test/Misc
diff options
context:
space:
mode:
authorTyler Nowicki <tyler.nowicki@gmail.com>2014-10-12 20:46:07 +0000
committerTyler Nowicki <tyler.nowicki@gmail.com>2014-10-12 20:46:07 +0000
commit41d599b9c79b20a0fdf0b334c99b59af575f64d4 (patch)
tree6bd6143104d03e67df9feddd8a9e3b02666c0ed0 /test/Misc
parent673b3960bb51f96f48d9690e6e3d419a0632c6f9 (diff)
downloadclang-41d599b9c79b20a0fdf0b334c99b59af575f64d4.tar.gz
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219589 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Misc')
-rw-r--r--test/Misc/ast-print-pragmas.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Misc/ast-print-pragmas.cpp b/test/Misc/ast-print-pragmas.cpp
index 25421fcd0c..23f533fc37 100644
--- a/test/Misc/ast-print-pragmas.cpp
+++ b/test/Misc/ast-print-pragmas.cpp
@@ -38,3 +38,18 @@ void test(int *List, int Length) {
i++;
}
}
+
+template <int V, int I>
+void test_nontype_template_param(int *List, int Length) {
+#pragma clang loop vectorize_width(V) interleave_count(I)
+ for (int i = 0; i < Length; i++) {
+ List[i] = i;
+ }
+}
+
+// CHECK: #pragma clang loop interleave_count(I)
+// CHECK: #pragma clang loop vectorize_width(V)
+
+void test_templates(int *List, int Length) {
+ test_nontype_template_param<2, 4>(List, Length);
+}