1 // RUN
: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -cl-ext
=+cl_khr_subgroups -O0 -cl-std
=clc
++ -o - %s | FileCheck %s
2 // FIXME
: Add MS ABI manglings of OpenCL things and remove %itanium_abi_triple
3 // above to support OpenCL in the MS C
++ ABI.
5 #pragma OPENCL EXTENSION cl_khr_subgroups
: enable
7 void test1
(read_only pipe int p
, global int
*ptr
) {
8 // CHECK
: call i32
@__read_pipe_2
(ptr %
{{.
*}}, ptr %
{{.
*}}, i32
4, i32
4)
10 // CHECK
: call ptr
@__reserve_read_pipe
(ptr %
{{.
*}}, i32
{{.
*}}, i32
4, i32
4)
11 reserve_id_t rid
= reserve_read_pipe
(p, 2);
12 // CHECK
: call i32
@__read_pipe_4
(ptr %
{{.
*}}, ptr %
{{.
*}}, i32
{{.
*}}, ptr %
{{.
*}}, i32
4, i32
4)
13 read_pipe
(p, rid
, 2, ptr
);
14 // CHECK
: call void
@__commit_read_pipe
(ptr %
{{.
*}}, ptr %
{{.
*}}, i32
4, i32
4)
15 commit_read_pipe
(p, rid
);
18 void test2
(write_only pipe int p
, global int
*ptr
) {
19 // CHECK
: call i32
@__write_pipe_2
(ptr %
{{.
*}}, ptr %
{{.
*}}, i32
4, i32
4)
21 // CHECK
: call ptr
@__reserve_write_pipe
(ptr %
{{.
*}}, i32
{{.
*}}, i32
4, i32
4)
22 reserve_id_t rid
= reserve_write_pipe
(p, 2);
23 // CHECK
: call i32
@__write_pipe_4
(ptr %
{{.
*}}, ptr %
{{.
*}}, i32
{{.
*}}, ptr %
{{.
*}}, i32
4, i32
4)
24 write_pipe
(p, rid
, 2, ptr
);
25 // CHECK
: call void
@__commit_write_pipe
(ptr %
{{.
*}}, ptr %
{{.
*}}, i32
4, i32
4)
26 commit_write_pipe
(p, rid
);
29 void test3
(read_only pipe int p
, global int
*ptr
) {
30 // CHECK
: call ptr
@__work_group_reserve_read_pipe
(ptr %
{{.
*}}, i32
{{.
*}}, i32
4, i32
4)
31 reserve_id_t rid
= work_group_reserve_read_pipe
(p, 2);
32 // CHECK
: call void
@__work_group_commit_read_pipe
(ptr %
{{.
*}}, ptr %
{{.
*}}, i32
4, i32
4)
33 work_group_commit_read_pipe
(p, rid
);
36 void test4
(write_only pipe int p
, global int
*ptr
) {
37 // CHECK
: call ptr
@__work_group_reserve_write_pipe
(ptr %
{{.
*}}, i32
{{.
*}}, i32
4, i32
4)
38 reserve_id_t rid
= work_group_reserve_write_pipe
(p, 2);
39 // CHECK
: call void
@__work_group_commit_write_pipe
(ptr %
{{.
*}}, ptr %
{{.
*}}, i32
4, i32
4)
40 work_group_commit_write_pipe
(p, rid
);
43 void test5
(read_only pipe int p
, global int
*ptr
) {
44 // CHECK
: call ptr
@__sub_group_reserve_read_pipe
(ptr %
{{.
*}}, i32
{{.
*}}, i32
4, i32
4)
45 reserve_id_t rid
= sub_group_reserve_read_pipe
(p, 2);
46 // CHECK
: call void
@__sub_group_commit_read_pipe
(ptr %
{{.
*}}, ptr %
{{.
*}}, i32
4, i32
4)
47 sub_group_commit_read_pipe
(p, rid
);
50 void test6
(write_only pipe int p
, global int
*ptr
) {
51 // CHECK
: call ptr
@__sub_group_reserve_write_pipe
(ptr %
{{.
*}}, i32
{{.
*}}, i32
4, i32
4)
52 reserve_id_t rid
= sub_group_reserve_write_pipe
(p, 2);
53 // CHECK
: call void
@__sub_group_commit_write_pipe
(ptr %
{{.
*}}, ptr %
{{.
*}}, i32
4, i32
4)
54 sub_group_commit_write_pipe
(p, rid
);
57 void test7
(read_only pipe int p
, global int
*ptr
) {
58 // CHECK
: call i32
@__get_pipe_num_packets_ro
(ptr %
{{.
*}}, i32
4, i32
4)
59 *ptr
= get_pipe_num_packets
(p);
60 // CHECK
: call i32
@__get_pipe_max_packets_ro
(ptr %
{{.
*}}, i32
4, i32
4)
61 *ptr
= get_pipe_max_packets
(p);
64 void test8
(write_only pipe int p
, global int
*ptr
) {
65 // CHECK
: call i32
@__get_pipe_num_packets_wo
(ptr %
{{.
*}}, i32
4, i32
4)
66 *ptr
= get_pipe_num_packets
(p);
67 // CHECK
: call i32
@__get_pipe_max_packets_wo
(ptr %
{{.
*}}, i32
4, i32
4)
68 *ptr
= get_pipe_max_packets
(p);