blob: cb3a7c5aa5e54359b6812c352da723ec36a76f3e [file] [log] [blame]
Reid Kleckner4173f6a2014-06-10 21:35:24 +00001// RUN: %clang_cc1 -emit-pch -o %t.a %s
2// RUN: %clang_cc1 -include-pch %t.a %s -ast-print -o - | FileCheck %s
3
4// FIXME: A bug in ParsedAttributes causes the order of the attributes to be
5// reversed. The checks are consequently in the reverse order below.
6
7// CHECK: #pragma clang loop interleave_count(8)
8// CHECK: #pragma clang loop vectorize_width(4)
9// CHECK: #pragma clang loop interleave(disable)
10// CHECK: #pragma clang loop vectorize(enable)
11// CHECK: #pragma clang loop interleave(enable)
12// CHECK: #pragma clang loop vectorize(disable)
13
14#ifndef HEADER
15#define HEADER
16
17class pragma_test {
18public:
19 inline void run1(int *List, int Length) {
20 int i = 0;
21#pragma clang loop vectorize_width(4)
22#pragma clang loop interleave_count(8)
23 while (i < Length) {
24 List[i] = i;
25 i++;
26 }
27 }
28
29 inline void run2(int *List, int Length) {
30 int i = 0;
31#pragma clang loop vectorize(enable)
32#pragma clang loop interleave(disable)
33 while (i - 1 < Length) {
34 List[i] = i;
35 i++;
36 }
37 }
38
39 inline void run3(int *List, int Length) {
40 int i = 0;
41#pragma clang loop vectorize(disable)
42#pragma clang loop interleave(enable)
43 while (i - 3 < Length) {
44 List[i] = i;
45 i++;
46 }
47 }
48};
49
50#else
51
52void test() {
53 int List[100];
54
55 pragma_test pt;
56
57 pt.run1(List, 100);
58 pt.run2(List, 100);
59 pt.run3(List, 100);
60}
61
62#endif