[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / CodeGenOpenCL / pipe_types.cl
blob702c0ede6f6255313e4e0082f8db55753c2a156d
1 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL2.0 -o - %s | FileCheck --check-prefixes=CHECK,CHECK-STRUCT %s
2 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL3.0 -cl-ext=-all,+__opencl_c_pipes,+__opencl_c_generic_address_space,+__opencl_c_program_scope_global_variables -o - %s | FileCheck --check-prefixes=CHECK %s
3 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=CL3.0 -cl-ext=-all,+__opencl_c_pipes,+__opencl_c_generic_address_space -o - %s | FileCheck --check-prefixes=CHECK %s
4 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=clc++2021 -cl-ext=-all,+__opencl_c_pipes,+__opencl_c_generic_address_space,+__opencl_c_program_scope_global_variables -o - %s | FileCheck --check-prefixes=CHECK %s
5 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-unknown-linux-gnu -emit-llvm -O0 -cl-std=clc++2021 -cl-ext=-all,+__opencl_c_pipes,+__opencl_c_generic_address_space -o - %s | FileCheck --check-prefixes=CHECK %s
7 // CHECK: %opencl.pipe_ro_t = type opaque
8 // CHECK: %opencl.pipe_wo_t = type opaque
9 typedef unsigned char __attribute__((ext_vector_type(3))) uchar3;
10 typedef int __attribute__((ext_vector_type(4))) int4;
12 void test1(read_only pipe int p) {
13 // CHECK: define{{.*}} void @{{.*}}test1{{.*}}(%opencl.pipe_ro_t* %p)
14 reserve_id_t rid;
15 // CHECK: %rid = alloca %opencl.reserve_id_t
18 void test2(write_only pipe float p) {
19 // CHECK: define{{.*}} void @{{.*}}test2{{.*}}(%opencl.pipe_wo_t* %p)
22 void test3(read_only pipe const int p) {
23 // CHECK: define{{.*}} void @{{.*}}test3{{.*}}(%opencl.pipe_ro_t* %p)
26 void test4(read_only pipe uchar3 p) {
27 // CHECK: define{{.*}} void @{{.*}}test4{{.*}}(%opencl.pipe_ro_t* %p)
30 void test5(read_only pipe int4 p) {
31 // CHECK: define{{.*}} void @{{.*}}test5{{.*}}(%opencl.pipe_ro_t* %p)
34 typedef read_only pipe int MyPipe;
35 kernel void test6(MyPipe p) {
36 // CHECK: define{{.*}} spir_kernel void @test6(%opencl.pipe_ro_t* %p)
39 struct Person {
40 const char *Name;
41 bool isFemale;
42 int ID;
45 void test_reserved_read_pipe(global struct Person *SDst,
46 read_only pipe struct Person SPipe) {
47 // CHECK-STRUCT: define{{.*}} void @test_reserved_read_pipe
48 read_pipe (SPipe, SDst);
49 // CHECK-STRUCT: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)
50 read_pipe (SPipe, SDst);
51 // CHECK-STRUCT: call i32 @__read_pipe_2(%opencl.pipe_ro_t* %{{.*}}, i8* %{{.*}}, i32 16, i32 8)