1// 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 enqueue_kernel(default_queue, flags, ndrange, 22 ^(local void *lp) { 23 a[0] = b; 24 c[0] = d; 25 ((local int*)lp)[0] = 1; 26 }, 100); 27} 28 29// CHECK-LABEL: define internal amdgpu_kernel void @__test_block_invoke_kernel(<{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }>) 30// CHECK-SAME: #[[ATTR:[0-9]+]] !kernel_arg_addr_space !{{.*}} !kernel_arg_access_qual !{{.*}} !kernel_arg_type !{{.*}} !kernel_arg_base_type !{{.*}} !kernel_arg_type_qual !{{.*}} 31// CHECK: entry: 32// CHECK: %1 = alloca <{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }>, align 8 33// CHECK: store <{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }> %0, <{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }>* %1, align 8 34// CHECK: %2 = addrspacecast <{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i8 }>* %1 to i8 addrspace(4)* 35// CHECK: call void @__test_block_invoke(i8 addrspace(4)* %2) 36// CHECK: ret void 37// CHECK:} 38 39// 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 }>) 40// CHECK-SAME: #[[ATTR]] !kernel_arg_addr_space !{{.*}} !kernel_arg_access_qual !{{.*}} !kernel_arg_type !{{.*}} !kernel_arg_base_type !{{.*}} !kernel_arg_type_qual !{{.*}} 41 42// CHECK-LABEL: define internal amdgpu_kernel void @__test_block_invoke_3_kernel(<{ i32, i32, i8 addrspace(4)*, i8 addrspace(1)*, i64 addrspace(1)*, i64, i8 }>, i8 addrspace(3)*) 43// CHECK-SAME: #[[ATTR]] !kernel_arg_addr_space !{{.*}} !kernel_arg_access_qual !{{.*}} !kernel_arg_type !{{.*}} !kernel_arg_base_type !{{.*}} !kernel_arg_type_qual !{{.*}} 44 45// CHECK: attributes #[[ATTR]] = { nounwind "enqueued-block" } 46