1 // RUN: %clang_cc1 -ast-print %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -DMS_EXT -fsyntax-only -fms-extensions %s -triple x86_64-pc-win32 -ast-print | FileCheck %s --check-prefix=MS-EXT
3 
4 // CHECK: #pragma clang loop vectorize_width(4)
5 // CHECK-NEXT: #pragma clang loop interleave_count(8){{$}}
6 
test(int * List,int Length)7 void test(int *List, int Length) {
8   int i = 0;
9 #pragma clang loop vectorize_width(4)
10 #pragma clang loop interleave_count(8)
11 // CHECK-NEXT: while (i < Length)
12   while (i < Length) {
13     List[i] = i * 2;
14     i++;
15   }
16 
17 // CHECK: #pragma clang loop distribute(disable)
18 // CHECK-NEXT: #pragma clang loop vectorize(enable)
19 // CHECK-NEXT: #pragma clang loop interleave(disable)
20 // CHECK-NEXT: #pragma clang loop vectorize_predicate(disable)
21 
22 #pragma clang loop distribute(disable)
23 #pragma clang loop vectorize(enable)
24 #pragma clang loop interleave(disable)
25 #pragma clang loop vectorize_predicate(disable)
26 // CHECK-NEXT: while (i - 1 < Length)
27   while (i - 1 < Length) {
28     List[i] = i * 2;
29     i++;
30   }
31 
32 // CHECK: #pragma clang loop distribute(enable)
33 // CHECK-NEXT: #pragma clang loop vectorize(disable)
34 // CHECK-NEXT: #pragma clang loop interleave(enable)
35 // CHECK-NEXT: #pragma clang loop vectorize_predicate(enable)
36 
37 #pragma clang loop distribute(enable)
38 #pragma clang loop vectorize(disable)
39 #pragma clang loop interleave(enable)
40 #pragma clang loop vectorize_predicate(enable)
41 // CHECK-NEXT: while (i - 2 < Length)
42   while (i - 2 < Length) {
43     List[i] = i * 2;
44     i++;
45   }
46 }
47 
48 template <int V, int I>
test_nontype_template_param(int * List,int Length)49 void test_nontype_template_param(int *List, int Length) {
50 #pragma clang loop vectorize_width(V) interleave_count(I)
51   for (int i = 0; i < Length; i++) {
52     List[i] = i;
53   }
54 }
55 
56 // CHECK: #pragma clang loop vectorize_width(V)
57 // CHECK: #pragma clang loop interleave_count(I)
58 
test_templates(int * List,int Length)59 void test_templates(int *List, int Length) {
60   test_nontype_template_param<2, 4>(List, Length);
61 }
62 
63 #ifdef MS_EXT
64 #pragma init_seg(compiler)
65 // MS-EXT: #pragma init_seg (.CRT$XCC){{$}}
66 // MS-EXT-NEXT: int x = 3 __declspec(thread);
67 int __declspec(thread) x = 3;
68 #endif //MS_EXT
69 
70