[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGenOpenCL / unroll-hint.cl
blob0f84450a1ae6f8490d7a6561769a6d71db4e4768
1 // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL1.2 -o - %s | FileCheck %s
4 /*** for ***/
5 void for_count()
7 // CHECK-LABEL: for_count
8 __attribute__((opencl_unroll_hint(8)))
9 for( int i = 0; i < 1000; ++i);
10 // CHECK: br label %{{.*}}, !llvm.loop ![[FOR_COUNT:.*]]
13 void for_disable()
15 // CHECK-LABEL: for_disable
16 __attribute__((opencl_unroll_hint(1)))
17 for( int i = 0; i < 1000; ++i);
18 // CHECK: br label %{{.*}}, !llvm.loop ![[FOR_DISABLE:.*]]
21 void for_enable()
23 // CHECK-LABEL: for_enable
24 __attribute__((opencl_unroll_hint))
25 for( int i = 0; i < 1000; ++i);
26 // CHECK: br label %{{.*}}, !llvm.loop ![[FOR_ENABLE:.*]]
29 /*** while ***/
30 void while_count()
32 // CHECK-LABEL: while_count
33 int i = 1000;
34 __attribute__((opencl_unroll_hint(8)))
35 while(i-->0);
36 // CHECK: br label %{{.*}}, !llvm.loop ![[WHILE_COUNT:.*]]
39 void while_disable()
41 // CHECK-LABEL: while_disable
42 int i = 1000;
43 __attribute__((opencl_unroll_hint(1)))
44 while(i-->0);
45 // CHECK: br label %{{.*}}, !llvm.loop ![[WHILE_DISABLE:.*]]
48 void while_enable()
50 // CHECK-LABEL: while_enable
51 int i = 1000;
52 __attribute__((opencl_unroll_hint))
53 while(i-->0);
54 // CHECK: br label %{{.*}}, !llvm.loop ![[WHILE_ENABLE:.*]]
57 /*** do ***/
58 void do_count()
60 // CHECK-LABEL: do_count
61 int i = 1000;
62 __attribute__((opencl_unroll_hint(8)))
63 do {} while(i--> 0);
64 // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !llvm.loop ![[DO_COUNT:.*]]
67 void do_disable()
69 // CHECK-LABEL: do_disable
70 int i = 1000;
71 __attribute__((opencl_unroll_hint(1)))
72 do {} while(i--> 0);
73 // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !llvm.loop ![[DO_DISABLE:.*]]
76 void do_enable()
78 // CHECK-LABEL: do_enable
79 int i = 1000;
80 __attribute__((opencl_unroll_hint))
81 do {} while(i--> 0);
82 // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !llvm.loop ![[DO_ENABLE:.*]]
86 // CHECK: ![[FOR_COUNT]] = distinct !{![[FOR_COUNT]], ![[COUNT:.*]]}
87 // CHECK: ![[COUNT]] = !{!"llvm.loop.unroll.count", i32 8}
88 // CHECK: ![[FOR_DISABLE]] = distinct !{![[FOR_DISABLE]], ![[DISABLE:.*]]}
89 // CHECK: ![[DISABLE]] = !{!"llvm.loop.unroll.disable"}
90 // CHECK: ![[FOR_ENABLE]] = distinct !{![[FOR_ENABLE]], ![[ENABLE:.*]]}
91 // CHECK: ![[ENABLE]] = !{!"llvm.loop.unroll.enable"}
92 // CHECK: ![[WHILE_COUNT]] = distinct !{![[WHILE_COUNT]], ![[COUNT]]}
93 // CHECK: ![[WHILE_DISABLE]] = distinct !{![[WHILE_DISABLE]], ![[DISABLE]]}
94 // CHECK: ![[WHILE_ENABLE]] = distinct !{![[WHILE_ENABLE]], ![[ENABLE]]}
95 // CHECK: ![[DO_COUNT]] = distinct !{![[DO_COUNT]], ![[COUNT]]}
96 // CHECK: ![[DO_DISABLE]] = distinct !{![[DO_DISABLE]], ![[DISABLE]]}
97 // CHECK: ![[DO_ENABLE]] = distinct !{![[DO_ENABLE]], ![[ENABLE]]}