-
Notifications
You must be signed in to change notification settings - Fork 766
/
Copy pathintel-restrict.cpp
28 lines (23 loc) · 1.19 KB
/
intel-restrict.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// RUN: %clang_cc1 -fsycl-is-device %s -emit-llvm -sycl-std=2017 -triple spir64-unknown-unknown -o - | FileCheck %s
template <typename name, typename Func>
__attribute__((sycl_kernel)) void kernel(const Func &kernelFunc) {
kernelFunc();
}
int main() {
int *a;
int *b;
int *c;
kernel<class kernel_restrict>(
[ a, b, c ]() [[intel::kernel_args_restrict]] { c[0] = a[0] + b[0]; });
// CHECK: define {{.*}}spir_kernel {{.*}}kernel_restrict(ptr addrspace(1) noalias noundef %{{.*}}, ptr addrspace(1) noalias noundef %{{.*}}, ptr addrspace(1) noalias noundef %{{.*}})
int *d;
int *e;
int *f;
kernel<class kernel_norestrict>(
[d, e, f]() { f[0] = d[0] + e[0]; });
// CHECK: define {{.*}}spir_kernel {{.*}}kernel_norestrict(ptr addrspace(1) noundef %{{.*}}, ptr addrspace(1) noundef %{{.*}}, ptr addrspace(1) noundef %{{.*}})
int g = 42;
kernel<class kernel_restrict_other_types>(
[ a, b, c, g ]() [[intel::kernel_args_restrict]] { c[0] = a[0] + b[0] + g; });
// CHECK: define {{.*}}spir_kernel {{.*}}kernel_restrict_other_types(ptr addrspace(1) noalias noundef %{{.*}}, ptr addrspace(1) noalias noundef %{{.*}}, ptr addrspace(1) noalias noundef %{{.*}}, i32 noundef %{{.*}})
}