blob: 92f2306f26d8514774776f5938f14be03f5f90df [file] [log] [blame]
Yaxun Liuc2a87a02017-10-14 12:23:50 +00001// RUN: %clang_cc1 %s -cl-std=CL2.0 -O0 -emit-llvm -o - -triple amdgcn | FileCheck %s --check-prefix=CHECK
2
3typedef struct {int a;} ndrange_t;
4
5// CHECK-LABEL: define amdgpu_kernel void @test
6kernel void test(global char *a, char b, global long *c, long d) {
7 queue_t default_queue;
8 unsigned flags = 0;
9 ndrange_t ndrange;
10
11 enqueue_kernel(default_queue, flags, ndrange,
12 ^(void) {
13 a[0] = b;
14 });
15
16 enqueue_kernel(default_queue, flags, ndrange,
17 ^(void) {
18 a[0] = b;
19 c[0] = d;
20 });
21}
22
23// CHECK-LABEL: define internal amdgpu_kernel void @__test_block_invoke_kernel(<{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }>)
24// CHECK-SAME: #[[ATTR:[0-9]+]] !kernel_arg_addr_space !{{.*}} !kernel_arg_access_qual !{{.*}} !kernel_arg_type !{{.*}} !kernel_arg_base_type !{{.*}} !kernel_arg_type_qual !{{.*}}
25// CHECK: entry:
26// CHECK: %1 = alloca <{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }>, align 8
27// CHECK: store <{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }> %0, <{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }>* %1, align 8
28// CHECK: %2 = addrspacecast <{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }>* %1 to i8 addrspace(4)*
29// CHECK: call void @__test_block_invoke(i8 addrspace(4)* %2)
30// CHECK: ret void
31// CHECK:}
32
33// CHECK-LABEL: define internal amdgpu_kernel void @__test_block_invoke_2_kernel(<{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i64 addrspace(1)*, i64, i8 }>)
34// CHECK-SAME: #[[ATTR]] !kernel_arg_addr_space !{{.*}} !kernel_arg_access_qual !{{.*}} !kernel_arg_type !{{.*}} !kernel_arg_base_type !{{.*}} !kernel_arg_type_qual !{{.*}}
35
36// CHECK: attributes #[[ATTR]] = { nounwind "enqueued-block" }