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 // 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 10 void 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 // CHECK-NEXT: #pragma clang loop distribute(disable) 23 24 #pragma clang loop distribute(disable) 25 #pragma clang loop vectorize(enable) 26 #pragma clang loop interleave(disable) 27 // CHECK-NEXT: while (i - 1 < Length) 28 while (i - 1 < Length) { 29 List[i] = i * 2; 30 i++; 31 } 32 33 // CHECK: #pragma clang loop interleave(enable) 34 // CHECK-NEXT: #pragma clang loop vectorize(disable) 35 // CHECK-NEXT: #pragma clang loop distribute(enable) 36 37 #pragma clang loop distribute(enable) 38 #pragma clang loop vectorize(disable) 39 #pragma clang loop interleave(enable) 40 // CHECK-NEXT: while (i - 2 < Length) 41 while (i - 2 < Length) { 42 List[i] = i * 2; 43 i++; 44 } 45 } 46 47 template <int V, int I> 48 void test_nontype_template_param(int *List, int Length) { 49 #pragma clang loop vectorize_width(V) interleave_count(I) 50 for (int i = 0; i < Length; i++) { 51 List[i] = i; 52 } 53 } 54 55 // CHECK: #pragma clang loop interleave_count(I) 56 // CHECK: #pragma clang loop vectorize_width(V) 57 58 void test_templates(int *List, int Length) { 59 test_nontype_template_param<2, 4>(List, Length); 60 } 61 62 #ifdef MS_EXT 63 #pragma init_seg(compiler) 64 // MS-EXT: #pragma init_seg (.CRT$XCC) 65 // MS-EXT-NEXT: int x = 3 __declspec(thread); 66 int __declspec(thread) x = 3; 67 #endif //MS_EXT 68 69