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 6 7// CHECK: %opencl.pipe_ro_t = type opaque 8// CHECK: %opencl.pipe_wo_t = type opaque 9typedef unsigned char __attribute__((ext_vector_type(3))) uchar3; 10typedef int __attribute__((ext_vector_type(4))) int4; 11 12void 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 16} 17 18void test2(write_only pipe float p) { 19// CHECK: define{{.*}} void @{{.*}}test2{{.*}}(%opencl.pipe_wo_t* %p) 20} 21 22void test3(read_only pipe const int p) { 23// CHECK: define{{.*}} void @{{.*}}test3{{.*}}(%opencl.pipe_ro_t* %p) 24} 25 26void test4(read_only pipe uchar3 p) { 27// CHECK: define{{.*}} void @{{.*}}test4{{.*}}(%opencl.pipe_ro_t* %p) 28} 29 30void test5(read_only pipe int4 p) { 31// CHECK: define{{.*}} void @{{.*}}test5{{.*}}(%opencl.pipe_ro_t* %p) 32} 33 34typedef read_only pipe int MyPipe; 35kernel void test6(MyPipe p) { 36// CHECK: define{{.*}} spir_kernel void @test6(%opencl.pipe_ro_t* %p) 37} 38 39struct Person { 40 const char *Name; 41 bool isFemale; 42 int ID; 43}; 44 45void 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) 52} 53