[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / PCH / pragma-loop.cpp
blobb8079ff608e418cb3aabf9e155d6edd9277c29f8
1 // RUN: %clang_cc1 -emit-pch -o %t.a %s
2 // RUN: %clang_cc1 -include-pch %t.a %s -ast-print -o - | FileCheck %s
4 // CHECK: #pragma clang loop vectorize_width(4)
5 // CHECK: #pragma clang loop interleave_count(8)
6 // CHECK: #pragma clang loop unroll_count(16){{$}}
7 // CHECK: #pragma clang loop vectorize(enable)
8 // CHECK: #pragma clang loop interleave(disable)
9 // CHECK: #pragma clang loop unroll(disable)
10 // CHECK: #pragma clang loop distribute(enable)
11 // CHECK: #pragma clang loop vectorize(disable)
12 // CHECK: #pragma clang loop interleave(enable)
13 // CHECK: #pragma clang loop unroll(full)
14 // CHECK: #pragma clang loop distribute(disable)
15 // FIXME: "#pragma unroll (enable)" is invalid and is not the input source.
16 // CHECK: #pragma unroll (enable){{$}}
17 // CHECK: #pragma unroll (32){{$}}
18 // CHECK: #pragma nounroll{{$}}
19 // CHECK: #pragma clang loop vectorize_width(V)
20 // CHECK: #pragma clang loop interleave_count(I)
22 #ifndef HEADER
23 #define HEADER
25 class pragma_test {
26 public:
27 inline void run1(int *List, int Length) {
28 int i = 0;
29 #pragma clang loop vectorize_width(4)
30 #pragma clang loop interleave_count(8)
31 #pragma clang loop unroll_count(16)
32 while (i < Length) {
33 List[i] = i;
34 i++;
38 inline void run2(int *List, int Length) {
39 int i = 0;
40 #pragma clang loop vectorize(enable)
41 #pragma clang loop interleave(disable)
42 #pragma clang loop unroll(disable)
43 #pragma clang loop distribute(enable)
44 while (i - 1 < Length) {
45 List[i] = i;
46 i++;
50 inline void run3(int *List, int Length) {
51 int i = 0;
52 #pragma clang loop vectorize(disable)
53 #pragma clang loop interleave(enable)
54 #pragma clang loop unroll(full)
55 #pragma clang loop distribute(disable)
56 while (i - 3 < Length) {
57 List[i] = i;
58 i++;
62 inline void run4(int *List, int Length) {
63 int i = 0;
64 #pragma unroll
65 while (i - 3 < Length) {
66 List[i] = i;
67 i++;
71 inline void run5(int *List, int Length) {
72 int i = 0;
73 #pragma unroll 32
74 while (i - 3 < Length) {
75 List[i] = i;
76 i++;
80 inline void run6(int *List, int Length) {
81 int i = 0;
82 #pragma nounroll
83 while (i - 3 < Length) {
84 List[i] = i;
85 i++;
89 template <int V, int I>
90 inline void run7(int *List, int Length) {
91 #pragma clang loop vectorize_width(V)
92 #pragma clang loop interleave_count(I)
93 for (int i = 0; i < Length; i++) {
94 List[i] = i;
98 #else
100 void test() {
101 int List[100];
103 pragma_test pt;
105 pt.run1(List, 100);
106 pt.run2(List, 100);
107 pt.run3(List, 100);
108 pt.run4(List, 100);
109 pt.run5(List, 100);
110 pt.run6(List, 100);
111 pt.run7<2, 4>(List, 100);
114 #endif