1// RUN: %clang_cc1 -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s 2 3// CHECK: %opencl.pipe_t = type opaque 4// CHECK: %opencl.reserve_id_t = type opaque 5 6void test1(read_only pipe int p, global int *ptr) { 7 // CHECK: call i32 @__read_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}) 8 read_pipe(p, ptr); 9 // CHECK: call %opencl.reserve_id_t* @__reserve_read_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}) 10 reserve_id_t rid = reserve_read_pipe(p, 2); 11 // CHECK: call i32 @__read_pipe_4(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}, i32 {{.*}}, i8* %{{.*}}) 12 read_pipe(p, rid, 2, ptr); 13 // CHECK: call void @__commit_read_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}) 14 commit_read_pipe(p, rid); 15} 16 17void test2(write_only pipe int p, global int *ptr) { 18 // CHECK: call i32 @__write_pipe_2(%opencl.pipe_t* %{{.*}}, i8* %{{.*}}) 19 write_pipe(p, ptr); 20 // CHECK: call %opencl.reserve_id_t* @__reserve_write_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}) 21 reserve_id_t rid = reserve_write_pipe(p, 2); 22 // CHECK: call i32 @__write_pipe_4(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}, i32 {{.*}}, i8* %{{.*}}) 23 write_pipe(p, rid, 2, ptr); 24 // CHECK: call void @__commit_write_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}) 25 commit_write_pipe(p, rid); 26} 27 28void test3(read_only pipe int p, global int *ptr) { 29 // CHECK: call %opencl.reserve_id_t* @__work_group_reserve_read_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}) 30 reserve_id_t rid = work_group_reserve_read_pipe(p, 2); 31 // CHECK: call void @__work_group_commit_read_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}) 32 work_group_commit_read_pipe(p, rid); 33} 34 35void test4(write_only pipe int p, global int *ptr) { 36 // CHECK: call %opencl.reserve_id_t* @__work_group_reserve_write_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}) 37 reserve_id_t rid = work_group_reserve_write_pipe(p, 2); 38 // CHECK: call void @__work_group_commit_write_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}) 39 work_group_commit_write_pipe(p, rid); 40} 41 42void test5(read_only pipe int p, global int *ptr) { 43 // CHECK: call %opencl.reserve_id_t* @__sub_group_reserve_read_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}) 44 reserve_id_t rid = sub_group_reserve_read_pipe(p, 2); 45 // CHECK: call void @__sub_group_commit_read_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}) 46 sub_group_commit_read_pipe(p, rid); 47} 48 49void test6(write_only pipe int p, global int *ptr) { 50 // CHECK: call %opencl.reserve_id_t* @__sub_group_reserve_write_pipe(%opencl.pipe_t* %{{.*}}, i32 {{.*}}) 51 reserve_id_t rid = sub_group_reserve_write_pipe(p, 2); 52 // CHECK: call void @__sub_group_commit_write_pipe(%opencl.pipe_t* %{{.*}}, %opencl.reserve_id_t* %{{.*}}) 53 sub_group_commit_write_pipe(p, rid); 54} 55 56void test7(write_only pipe int p, global int *ptr) { 57 // CHECK: call i32 @__get_pipe_num_packets(%opencl.pipe_t* %{{.*}}) 58 *ptr = get_pipe_num_packets(p); 59 // CHECK: call i32 @__get_pipe_max_packets(%opencl.pipe_t* %{{.*}}) 60 *ptr = get_pipe_max_packets(p); 61} 62