2014-06-11 05:35:24 +08:00
|
|
|
// RUN: %clang_cc1 -emit-pch -o %t.a %s
|
|
|
|
// RUN: %clang_cc1 -include-pch %t.a %s -ast-print -o - | FileCheck %s
|
|
|
|
|
2018-06-26 04:06:13 +08:00
|
|
|
// CHECK: #pragma clang loop vectorize_width(4)
|
2018-08-03 09:21:16 +08:00
|
|
|
// CHECK: #pragma clang loop interleave_count(8)
|
|
|
|
// CHECK: #pragma clang loop unroll_count(16){{$}}
|
2018-06-26 04:06:13 +08:00
|
|
|
// CHECK: #pragma clang loop vectorize(enable)
|
2018-08-03 09:21:16 +08:00
|
|
|
// CHECK: #pragma clang loop interleave(disable)
|
|
|
|
// CHECK: #pragma clang loop unroll(disable)
|
|
|
|
// CHECK: #pragma clang loop distribute(enable)
|
2018-06-26 04:06:13 +08:00
|
|
|
// CHECK: #pragma clang loop vectorize(disable)
|
2018-08-03 09:21:16 +08:00
|
|
|
// CHECK: #pragma clang loop interleave(enable)
|
|
|
|
// CHECK: #pragma clang loop unroll(full)
|
|
|
|
// CHECK: #pragma clang loop distribute(disable)
|
2018-02-15 01:38:47 +08:00
|
|
|
// FIXME: "#pragma unroll (enable)" is invalid and is not the input source.
|
|
|
|
// CHECK: #pragma unroll (enable){{$}}
|
|
|
|
// CHECK: #pragma unroll (32){{$}}
|
|
|
|
// CHECK: #pragma nounroll{{$}}
|
2018-06-26 04:06:13 +08:00
|
|
|
// CHECK: #pragma clang loop vectorize_width(V)
|
2018-08-03 09:21:16 +08:00
|
|
|
// CHECK: #pragma clang loop interleave_count(I)
|
2014-06-11 05:35:24 +08:00
|
|
|
|
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
|
|
|
|
|
|
|
class pragma_test {
|
|
|
|
public:
|
|
|
|
inline void run1(int *List, int Length) {
|
|
|
|
int i = 0;
|
|
|
|
#pragma clang loop vectorize_width(4)
|
|
|
|
#pragma clang loop interleave_count(8)
|
2014-06-12 01:56:26 +08:00
|
|
|
#pragma clang loop unroll_count(16)
|
2014-06-11 05:35:24 +08:00
|
|
|
while (i < Length) {
|
|
|
|
List[i] = i;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void run2(int *List, int Length) {
|
|
|
|
int i = 0;
|
|
|
|
#pragma clang loop vectorize(enable)
|
|
|
|
#pragma clang loop interleave(disable)
|
2014-06-12 01:56:26 +08:00
|
|
|
#pragma clang loop unroll(disable)
|
2016-06-14 20:04:26 +08:00
|
|
|
#pragma clang loop distribute(enable)
|
2014-06-11 05:35:24 +08:00
|
|
|
while (i - 1 < Length) {
|
|
|
|
List[i] = i;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void run3(int *List, int Length) {
|
|
|
|
int i = 0;
|
|
|
|
#pragma clang loop vectorize(disable)
|
|
|
|
#pragma clang loop interleave(enable)
|
2014-07-24 01:31:31 +08:00
|
|
|
#pragma clang loop unroll(full)
|
2016-06-14 20:04:26 +08:00
|
|
|
#pragma clang loop distribute(disable)
|
2014-06-11 05:35:24 +08:00
|
|
|
while (i - 3 < Length) {
|
|
|
|
List[i] = i;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2014-07-22 02:08:34 +08:00
|
|
|
|
|
|
|
inline void run4(int *List, int Length) {
|
|
|
|
int i = 0;
|
|
|
|
#pragma unroll
|
|
|
|
while (i - 3 < Length) {
|
|
|
|
List[i] = i;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void run5(int *List, int Length) {
|
|
|
|
int i = 0;
|
|
|
|
#pragma unroll 32
|
|
|
|
while (i - 3 < Length) {
|
|
|
|
List[i] = i;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2014-06-11 05:35:24 +08:00
|
|
|
|
2014-07-25 02:09:38 +08:00
|
|
|
inline void run6(int *List, int Length) {
|
|
|
|
int i = 0;
|
|
|
|
#pragma nounroll
|
|
|
|
while (i - 3 < Length) {
|
|
|
|
List[i] = i;
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
2014-10-13 04:46:07 +08:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2014-07-25 02:09:38 +08:00
|
|
|
};
|
2014-06-11 05:35:24 +08:00
|
|
|
#else
|
|
|
|
|
|
|
|
void test() {
|
|
|
|
int List[100];
|
|
|
|
|
|
|
|
pragma_test pt;
|
|
|
|
|
|
|
|
pt.run1(List, 100);
|
|
|
|
pt.run2(List, 100);
|
|
|
|
pt.run3(List, 100);
|
2014-07-22 02:08:34 +08:00
|
|
|
pt.run4(List, 100);
|
|
|
|
pt.run5(List, 100);
|
2014-07-25 02:09:38 +08:00
|
|
|
pt.run6(List, 100);
|
2014-10-13 04:46:07 +08:00
|
|
|
pt.run7<2, 4>(List, 100);
|
2014-06-11 05:35:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|