File: unroll-hint.cl

package info (click to toggle)
llvm-toolchain-7 1%3A7.0.1-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 733,456 kB
  • sloc: cpp: 3,776,651; ansic: 633,271; asm: 350,301; python: 142,716; objc: 107,612; sh: 22,626; lisp: 11,056; perl: 7,999; pascal: 6,742; ml: 5,537; awk: 3,536; makefile: 2,557; cs: 2,027; xml: 841; ruby: 156
file content (97 lines) | stat: -rw-r--r-- 2,830 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s | FileCheck %s

/*** for ***/
void for_count()
{
// CHECK-LABEL: for_count
    __attribute__((opencl_unroll_hint(8)))
    for( int i = 0; i < 1000; ++i);
// CHECK: br label %{{.*}}, !llvm.loop ![[FOR_COUNT:.*]]
}

void for_disable()
{
// CHECK-LABEL: for_disable
    __attribute__((opencl_unroll_hint(1)))
    for( int i = 0; i < 1000; ++i);
// CHECK: br label %{{.*}}, !llvm.loop ![[FOR_DISABLE:.*]]
}

void for_full()
{
// CHECK-LABEL: for_full
    __attribute__((opencl_unroll_hint))
    for( int i = 0; i < 1000; ++i);
// CHECK: br label %{{.*}}, !llvm.loop ![[FOR_FULL:.*]]
}

/*** while ***/
void while_count()
{
// CHECK-LABEL: while_count
    int i = 1000;
    __attribute__((opencl_unroll_hint(8)))
    while(i-->0);
// CHECK: br label %{{.*}}, !llvm.loop ![[WHILE_COUNT:.*]]
}

void while_disable()
{
// CHECK-LABEL: while_disable
    int i = 1000;
    __attribute__((opencl_unroll_hint(1)))
    while(i-->0);
// CHECK: br label %{{.*}}, !llvm.loop ![[WHILE_DISABLE:.*]]
}

void while_full()
{
// CHECK-LABEL: while_full
    int i = 1000;
    __attribute__((opencl_unroll_hint))
    while(i-->0);
// CHECK: br label %{{.*}}, !llvm.loop ![[WHILE_FULL:.*]]
}

/*** do ***/
void do_count()
{
// CHECK-LABEL: do_count
    int i = 1000;
    __attribute__((opencl_unroll_hint(8)))
    do {} while(i--> 0);
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !llvm.loop ![[DO_COUNT:.*]]
}

void do_disable()
{
// CHECK-LABEL: do_disable
    int i = 1000;
    __attribute__((opencl_unroll_hint(1)))
    do {} while(i--> 0);
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !llvm.loop ![[DO_DISABLE:.*]]
}

void do_full()
{
// CHECK-LABEL: do_full
    int i = 1000;
    __attribute__((opencl_unroll_hint))
    do {} while(i--> 0);
// CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !llvm.loop ![[DO_FULL:.*]]
}


// CHECK: ![[FOR_COUNT]]     =  distinct !{![[FOR_COUNT]],  ![[COUNT:.*]]}
// CHECK: ![[COUNT]]         =  !{!"llvm.loop.unroll.count", i32 8}
// CHECK: ![[FOR_DISABLE]]   =  distinct !{![[FOR_DISABLE]],  ![[DISABLE:.*]]}
// CHECK: ![[DISABLE]]       =  !{!"llvm.loop.unroll.disable"}
// CHECK: ![[FOR_FULL]]      =  distinct !{![[FOR_FULL]],  ![[FULL:.*]]}
// CHECK: ![[FULL]]          =  !{!"llvm.loop.unroll.full"}
// CHECK: ![[WHILE_COUNT]]   =  distinct !{![[WHILE_COUNT]],    ![[COUNT]]}
// CHECK: ![[WHILE_DISABLE]] =  distinct !{![[WHILE_DISABLE]],  ![[DISABLE]]}
// CHECK: ![[WHILE_FULL]]    =  distinct !{![[WHILE_FULL]],     ![[FULL]]}
// CHECK: ![[DO_COUNT]]      =  distinct !{![[DO_COUNT]],       ![[COUNT]]}
// CHECK: ![[DO_DISABLE]]    =  distinct !{![[DO_DISABLE]],     ![[DISABLE]]}
// CHECK: ![[DO_FULL]]       =  distinct !{![[DO_FULL]],        ![[FULL]]}