brintos

brintos / llvm-project-archived public Read only

0
0
Text · 694 B · 060104a Raw
26 lines · cpp
1// RUN: %clang_cc1 -fsycl-is-device -triple spir64 -verify -emit-llvm %s -o - | FileCheck %s2 3// expected-no-diagnostics4 5template <typename Name, typename Func>6__attribute__((sycl_kernel)) void kernel_single_task(const Func &kernelFunc) {7  kernelFunc();8}9 10// CHECK: define dso_local spir_func{{.*}}invoke_function{{.*}}(ptr noundef %fptr, ptr addrspace(4) noundef %ptr)11[[clang::sycl_external]] void invoke_function(int (*fptr)(), int *ptr) {}12 13int f() { return 0; }14 15int main() {16  kernel_single_task<class fake_kernel>([=]() {17    int (*p)() = f;18    int (&r)() = *p;19    int a = 10;20    invoke_function(p, &a);21    invoke_function(r, &a);22    invoke_function(f, &a);23  });24  return 0;25}26