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