Home | History | Annotate | Download | only in Misc
      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 
     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 }
     42 
     43 template <int V, int I>
     44 void 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 
     54 void test_templates(int *List, int Length) {
     55   test_nontype_template_param<2, 4>(List, Length);
     56 }
     57 
     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);
     62 int __declspec(thread) x = 3;
     63 #endif //MS_EXT
     64 
     65