brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · 6ff9f1f Raw
79 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -verify %s2 3// Note that this puts the expected lines before the directives to work around4// limitations in the -verify mode.5 6void test(int *List, int Length, int Value) {7  int i = 0;8 9#pragma unroll_and_jam10  for (int i = 0; i < Length; i++) {11    for (int j = 0; j < Length; j++) {12      List[i * Length + j] = Value;13    }14  }15 16#pragma nounroll_and_jam17  for (int i = 0; i < Length; i++) {18    for (int j = 0; j < Length; j++) {19      List[i * Length + j] = Value;20    }21  }22 23#pragma unroll_and_jam 424  for (int i = 0; i < Length; i++) {25    for (int j = 0; j < Length; j++) {26      List[i * Length + j] = Value;27    }28  }29 30/* expected-error {{expected ')'}} */ #pragma unroll_and_jam(431/* expected-error {{missing argument; expected an integer value}} */ #pragma unroll_and_jam()32/* expected-warning {{extra tokens at end of '#pragma unroll_and_jam'}} */ #pragma unroll_and_jam 1 233  for (int i = 0; i < Length; i++) {34    for (int j = 0; j < Length; j++) {35      List[i * Length + j] = Value;36    }37  }38 39/* expected-warning {{extra tokens at end of '#pragma nounroll_and_jam'}} */ #pragma nounroll_and_jam 140  for (int i = 0; i < Length; i++) {41    for (int j = 0; j < Length; j++) {42      List[i * Length + j] = Value;43    }44  }45 46#pragma unroll_and_jam47/* expected-error {{expected a for, while, or do-while loop to follow '#pragma unroll_and_jam'}} */ int j = Length;48#pragma unroll_and_jam 449/* expected-error {{expected a for, while, or do-while loop to follow '#pragma unroll_and_jam'}} */ int k = Length;50#pragma nounroll_and_jam51/* expected-error {{expected a for, while, or do-while loop to follow '#pragma nounroll_and_jam'}} */ int l = Length;52 53#pragma unroll_and_jam 454/* expected-error {{incompatible directives '#pragma nounroll_and_jam' and '#pragma unroll_and_jam(4)'}} */ #pragma nounroll_and_jam55  for (int i = 0; i < Length; i++) {56    for (int j = 0; j < Length; j++) {57      List[i * Length + j] = Value;58    }59  }60 61#pragma nounroll_and_jam62#pragma unroll(4)63  for (int i = 0; i < Length; i++) {64    for (int j = 0; j < Length; j++) {65      List[i * Length + j] = Value;66    }67  }68 69// pragma clang unroll_and_jam is disabled for the moment70/* expected-error {{invalid option 'unroll_and_jam'; expected vectorize, vectorize_width, interleave, interleave_count, unroll, unroll_count, pipeline, pipeline_initiation_interval, vectorize_predicate, or distribute}} */ #pragma clang loop unroll_and_jam(4)71  for (int i = 0; i < Length; i++) {72    for (int j = 0; j < Length; j++) {73      List[i * Length + j] = Value;74    }75  }76 77#pragma unroll_and_jam78/* expected-error {{expected statement}} */ }79