• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // 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 unroll_count(16)
8 // CHECK: #pragma clang loop interleave_count(8)
9 // CHECK: #pragma clang loop vectorize_width(4)
10 // CHECK: #pragma clang loop unroll(disable)
11 // CHECK: #pragma clang loop interleave(disable)
12 // CHECK: #pragma clang loop vectorize(enable)
13 // CHECK: #pragma clang loop unroll(enable)
14 // CHECK: #pragma clang loop interleave(enable)
15 // CHECK: #pragma clang loop vectorize(disable)
16 
17 #ifndef HEADER
18 #define HEADER
19 
20 class pragma_test {
21 public:
run1(int * List,int Length)22   inline void run1(int *List, int Length) {
23     int i = 0;
24 #pragma clang loop vectorize_width(4)
25 #pragma clang loop interleave_count(8)
26 #pragma clang loop unroll_count(16)
27     while (i < Length) {
28       List[i] = i;
29       i++;
30     }
31   }
32 
run2(int * List,int Length)33   inline void run2(int *List, int Length) {
34     int i = 0;
35 #pragma clang loop vectorize(enable)
36 #pragma clang loop interleave(disable)
37 #pragma clang loop unroll(disable)
38     while (i - 1 < Length) {
39       List[i] = i;
40       i++;
41     }
42   }
43 
run3(int * List,int Length)44   inline void run3(int *List, int Length) {
45     int i = 0;
46 #pragma clang loop vectorize(disable)
47 #pragma clang loop interleave(enable)
48 #pragma clang loop unroll(enable)
49     while (i - 3 < Length) {
50       List[i] = i;
51       i++;
52     }
53   }
54 };
55 
56 #else
57 
test()58 void test() {
59   int List[100];
60 
61   pragma_test pt;
62 
63   pt.run1(List, 100);
64   pt.run2(List, 100);
65   pt.run3(List, 100);
66 }
67 
68 #endif
69