1 // RUN: %clang_cc1 -ast-print %s -o - | FileCheck %s 2 3 // FIXME: A bug in ParsedAttributes causes the order of the attributes to be 4 // reversed. The checks are consequently in the reverse order below. 5 6 // CHECK: #pragma clang loop interleave_count(8) 7 // CHECK-NEXT: #pragma clang loop vectorize_width(4) 8 test(int * List,int Length)9void test(int *List, int Length) { 10 int i = 0; 11 #pragma clang loop vectorize_width(4) 12 #pragma clang loop interleave_count(8) 13 // CHECK-NEXT: while (i < Length) 14 while (i < Length) { 15 List[i] = i * 2; 16 i++; 17 } 18 19 // CHECK: #pragma clang loop interleave(disable) 20 // CHECK-NEXT: #pragma clang loop vectorize(enable) 21 22 #pragma clang loop vectorize(enable) 23 #pragma clang loop interleave(disable) 24 // CHECK-NEXT: while (i - 1 < Length) 25 while (i - 1 < Length) { 26 List[i] = i * 2; 27 i++; 28 } 29 30 // CHECK: #pragma clang loop interleave(enable) 31 // CHECK-NEXT: #pragma clang loop vectorize(disable) 32 33 #pragma clang loop vectorize(disable) 34 #pragma clang loop interleave(enable) 35 // CHECK-NEXT: while (i - 2 < Length) 36 while (i - 2 < Length) { 37 List[i] = i * 2; 38 i++; 39 } 40 } 41 42 template <int V, int I> test_nontype_template_param(int * List,int Length)43void test_nontype_template_param(int *List, int Length) { 44 #pragma clang loop vectorize_width(V) interleave_count(I) 45 for (int i = 0; i < Length; i++) { 46 List[i] = i; 47 } 48 } 49 50 // CHECK: #pragma clang loop interleave_count(I) 51 // CHECK: #pragma clang loop vectorize_width(V) 52 test_templates(int * List,int Length)53void test_templates(int *List, int Length) { 54 test_nontype_template_param<2, 4>(List, Length); 55 } 56