[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / clang / test / AST / ast-dump-pragma-unroll.cpp
blobf9c254b803ff2b277ba11579e34659a99587c21d
1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -ast-dump %s | FileCheck %s
3 using size_t = unsigned long long;
5 // CHECK: LoopHintAttr {{.*}} Implicit unroll UnrollCount Numeric
6 // CHECK: LoopHintAttr {{.*}} Implicit unroll UnrollCount Numeric
7 // CHECK: LoopHintAttr {{.*}} Implicit unroll Unroll Disable
8 // CHECK: LoopHintAttr {{.*}} Implicit unroll Unroll Disable
9 template <bool Flag>
10 int value_dependent(int n) {
11 constexpr int N = 100;
12 auto init = [=]() { return Flag ? n : 0UL; };
13 auto cond = [=](size_t ix) { return Flag ? ix != 0 : ix < 10; };
14 auto iter = [=](size_t ix) {
15 return Flag ? ix & ~(1ULL << __builtin_clzll(ix)) : ix + 1;
18 #pragma unroll Flag ? 1 : N
19 for (size_t ix = init(); cond(ix); ix = iter(ix)) {
20 n *= n;
22 #pragma unroll Flag ? 0 : N
23 for (size_t ix = init(); cond(ix); ix = iter(ix)) {
24 n *= n;
26 return n;
29 void test_value_dependent(int n) {
30 value_dependent<true>(n);