]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/CodeGenOpenCL/pipe_types.cl
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / test / CodeGenOpenCL / pipe_types.cl
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck %s
2
3 // CHECK: %opencl.pipe_ro_t = type opaque
4 // CHECK: %opencl.pipe_wo_t = type opaque
5 typedef unsigned char __attribute__((ext_vector_type(3))) uchar3;
6 typedef int __attribute__((ext_vector_type(4))) int4;
7
8 void test1(read_only pipe int p) {
9 // CHECK: define void @test1(%opencl.pipe_ro_t* %p)
10   reserve_id_t rid;
11 // CHECK: %rid = alloca %opencl.reserve_id_t
12 }
13
14 void test2(write_only pipe float p) {
15 // CHECK: define void @test2(%opencl.pipe_wo_t* %p)
16 }
17
18 void test3(read_only pipe const int p) {
19 // CHECK: define void @test3(%opencl.pipe_ro_t* %p)
20 }
21
22 void test4(read_only pipe uchar3 p) {
23 // CHECK: define void @test4(%opencl.pipe_ro_t* %p)
24 }
25
26 void test5(read_only pipe int4 p) {
27 // CHECK: define void @test5(%opencl.pipe_ro_t* %p)
28 }
29
30 typedef read_only pipe int MyPipe;
31 kernel void test6(MyPipe p) {
32 // CHECK: define spir_kernel void @test6(%opencl.pipe_ro_t* %p)
33 }
34
35 struct Person {
36   const char *Name;
37   bool isFemale;
38   int ID;
39 };
40
41 void test_reserved_read_pipe(global struct Person *SDst,
42                              read_only pipe struct Person SPipe) {
43 // CHECK: define void @test_reserved_read_pipe
44   read_pipe (SPipe, SDst);
45   // CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
46   read_pipe (SPipe, SDst);
47   // CHECK: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
48 }