[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / CodeGenOpenCL / amdgpu-enqueue-kernel.cl
blob1bdf53652038b82c5cd1a368c09ad0c27eefd5af
1 // RUN: %clang_cc1 -no-opaque-pointers %s -cl-std=CL2.0 -O0 -emit-llvm -o - -triple amdgcn | FileCheck %s --check-prefix=CHECK
3 typedef struct {int a;} ndrange_t;
5 void callee(long id, global long *out) {
6 out[id] = id;
9 // CHECK-LABEL: define{{.*}} amdgpu_kernel void @test
10 kernel void test(global char *a, char b, global long *c, long d) {
11 queue_t default_queue;
12 unsigned flags = 0;
13 ndrange_t ndrange;
15 enqueue_kernel(default_queue, flags, ndrange,
16 ^(void) {
17 a[0] = b;
18 });
20 enqueue_kernel(default_queue, flags, ndrange,
21 ^(void) {
22 a[0] = b;
23 c[0] = d;
24 });
25 enqueue_kernel(default_queue, flags, ndrange,
26 ^(local void *lp) {
27 a[0] = b;
28 c[0] = d;
29 ((local int*)lp)[0] = 1;
30 }, 100);
32 void (^block)(void) = ^{
33 callee(d, c);
36 enqueue_kernel(default_queue, flags, ndrange, block);
39 // CHECK-LABEL: define internal amdgpu_kernel void @__test_block_invoke_kernel(<{ i32, i32, i8*, i8 addrspace(1)*, i8 }> %0)
40 // CHECK-SAME: #[[ATTR:[0-9]+]] !kernel_arg_addr_space !{{.*}} !kernel_arg_access_qual !{{.*}} !kernel_arg_type !{{.*}} !kernel_arg_base_type !{{.*}} !kernel_arg_type_qual !{{.*}}
41 // CHECK: entry:
42 // CHECK: %1 = alloca <{ i32, i32, i8*, i8 addrspace(1)*, i8 }>, align 8, addrspace(5)
43 // CHECK: store <{ i32, i32, i8*, i8 addrspace(1)*, i8 }> %0, <{ i32, i32, i8*, i8 addrspace(1)*, i8 }> addrspace(5)* %1, align 8
44 // CHECK: %2 ={{.*}} addrspacecast <{ i32, i32, i8*, i8 addrspace(1)*, i8 }> addrspace(5)* %1 to i8*
45 // CHECK: call void @__test_block_invoke(i8* %2)
46 // CHECK: ret void
47 // CHECK:}
49 // CHECK-LABEL: define internal amdgpu_kernel void @__test_block_invoke_2_kernel(<{ i32, i32, i8*, i8 addrspace(1)*, i64 addrspace(1)*, i64, i8 }> %0)
50 // CHECK-SAME: #[[ATTR]] !kernel_arg_addr_space !{{.*}} !kernel_arg_access_qual !{{.*}} !kernel_arg_type !{{.*}} !kernel_arg_base_type !{{.*}} !kernel_arg_type_qual !{{.*}}
52 // CHECK-LABEL: define internal amdgpu_kernel void @__test_block_invoke_3_kernel(<{ i32, i32, i8*, i8 addrspace(1)*, i64 addrspace(1)*, i64, i8 }> %0, i8 addrspace(3)* %1)
53 // CHECK-SAME: #[[ATTR]] !kernel_arg_addr_space !{{.*}} !kernel_arg_access_qual !{{.*}} !kernel_arg_type !{{.*}} !kernel_arg_base_type !{{.*}} !kernel_arg_type_qual !{{.*}}
55 // CHECK-LABEL: define internal amdgpu_kernel void @__test_block_invoke_4_kernel(<{ i32, i32, i8*, i64, i64 addrspace(1)* }> %0)
56 // CHECK-SAME: #[[ATTR]] !kernel_arg_addr_space !{{.*}} !kernel_arg_access_qual !{{.*}} !kernel_arg_type !{{.*}} !kernel_arg_base_type !{{.*}} !kernel_arg_type_qual !{{.*}}
58 // CHECK: attributes #[[ATTR]] = { nounwind "enqueued-block" }