1 // RUN: %clang_cc1 -triple hexagon -std=c++11 -emit-llvm -o - %s | FileCheck %s
2 
pipeline_disabled(int * List,int Length,int Value)3 void pipeline_disabled(int *List, int Length, int Value) {
4 // CHECK-LABEL: define {{.*}} @_Z17pipeline_disabled
5 #pragma clang loop pipeline(disable)
6   for (int i = 0; i < Length; i++) {
7     // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_1:.*]]
8     List[i] = Value;
9   }
10 }
11 
pipeline_not_disabled(int * List,int Length,int Value)12 void pipeline_not_disabled(int *List, int Length, int Value) {
13   // CHECK-LABEL: define {{.*}} @_Z21pipeline_not_disabled
14   for (int i = 0; i < Length; i++) {
15     List[i] = Value;
16   }
17 }
18 
pipeline_initiation_interval(int * List,int Length,int Value)19 void pipeline_initiation_interval(int *List, int Length, int Value) {
20 // CHECK-LABEL: define {{.*}} @_Z28pipeline_initiation_interval
21 #pragma clang loop pipeline_initiation_interval(10)
22   for (int i = 0; i < Length; i++) {
23     // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_3:.*]]
24     List[i] = Value;
25   }
26 }
27 
pipeline_disabled_on_nested_loop(int * List,int Length,int Value)28 void pipeline_disabled_on_nested_loop(int *List, int Length, int Value) {
29   // CHECK-LABEL: define {{.*}} @_Z32pipeline_disabled_on_nested_loop
30   for (int i = 0; i < Length; i++) {
31 #pragma clang loop pipeline(disable)
32     for (int j = 0; j < Length; j++) {
33       // CHECK: br label {{.*}}, !llvm.loop ![[LOOP_4:.*]]
34       List[i * Length + j] = Value;
35     }
36   }
37 }
38 
39 // CHECK: ![[LOOP_1]] = distinct !{![[LOOP_1]], ![[PIPELINE_DISABLE:.*]]}
40 // CHECK: ![[PIPELINE_DISABLE]] = !{!"llvm.loop.pipeline.disable", i1 true}
41 
42 // CHECK-NOT:llvm.loop.pipeline
43 
44 // CHECK: ![[LOOP_3]] = distinct !{![[LOOP_3]], ![[PIPELINE_II_10:.*]]}
45 // CHECK: ![[PIPELINE_II_10]] = !{!"llvm.loop.pipeline.initiationinterval", i32 10}
46 
47 // CHECK: ![[LOOP_4]] = distinct !{![[LOOP_4]], ![[PIPELINE_DISABLE]]}
48