Debian Codegraph @

clang/test/CodeGenOpenCL/pipe_types.cl

raw
1 // RUN: %clang_cc1 -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 -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 -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 -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 -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 typedef unsigned char __attribute__((ext_vector_type(3))) uchar3;
8 typedef int __attribute__((ext_vector_type(4))) int4;
9
10 void test1(read_only pipe int p) {
11 // CHECK: define{{.*}} void @{{.*}}test1{{.*}}(ptr %p)
12 reserve_id_t rid;
13 // CHECK: %rid = alloca ptr
14 }
15
16 void test2(write_only pipe float p) {
17 // CHECK: define{{.*}} void @{{.*}}test2{{.*}}(ptr %p)
18 }
19
20 void test3(read_only pipe const int p) {
21 // CHECK: define{{.*}} void @{{.*}}test3{{.*}}(ptr %p)
22 }
23
24 void test4(read_only pipe uchar3 p) {
25 // CHECK: define{{.*}} void @{{.*}}test4{{.*}}(ptr %p)
26 }
27
28 void test5(read_only pipe int4 p) {
29 // CHECK: define{{.*}} void @{{.*}}test5{{.*}}(ptr %p)
30 }
31
32 typedef read_only pipe int MyPipe;
33 kernel void test6(MyPipe p) {
34 // CHECK: define{{.*}} spir_kernel void @test6(ptr %p)
35 }
36
37 struct Person {
38 const char *Name;
39 bool isFemale;
40 int ID;
41 };
42
43 void test_reserved_read_pipe(global struct Person *SDst,
44 read_only pipe struct Person SPipe) {
45 // CHECK-STRUCT: define{{.*}} void @test_reserved_read_pipe
46 read_pipe (SPipe, SDst);
47 // CHECK-STRUCT: call i32 @__read_pipe_2(ptr %{{.*}}, ptr %{{.*}}, i32 16, i32 8)
48 read_pipe (SPipe, SDst);
49 // CHECK-STRUCT: call i32 @__read_pipe_2(ptr %{{.*}}, ptr %{{.*}}, i32 16, i32 8)
50 }