annotate clang/test/CodeGenSYCL/functionptr-addrspace.cpp @ 266:00f31e85ec16 default tip

Added tag current for changeset 31d058e83c98
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 14 Oct 2023 10:13:55 +0900
parents 1f2b6ac9f198
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
1 // RUN: %clang_cc1 -fsycl-is-device -emit-llvm -triple spir64 -verify -emit-llvm %s -o - | FileCheck %s
236
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
2
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
3 // expected-no-diagnostics
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
4
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
5 template <typename Name, typename Func>
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
6 __attribute__((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) {
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
7 kernelFunc();
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
8 }
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
9
252
1f2b6ac9f198 LLVM16-1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 236
diff changeset
10 // CHECK: define dso_local spir_func{{.*}}invoke_function{{.*}}(ptr noundef %fptr, ptr addrspace(4) noundef %ptr)
236
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
11 void invoke_function(int (*fptr)(), int *ptr) {}
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
12
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
13 int f() { return 0; }
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
14
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
15 int main() {
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
16 kernel_single_task<class fake_kernel>([=]() {
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
17 int (*p)() = f;
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
18 int (&r)() = *p;
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
19 int a = 10;
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
20 invoke_function(p, &a);
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
21 invoke_function(r, &a);
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
22 invoke_function(f, &a);
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
23 });
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
24 return 0;
c4bab56944e8 LLVM 16
kono
parents:
diff changeset
25 }