SPIR-V does not allow pointer kernel arguments to be in the generic address space. For offload, we already coerece them to the global address space if not specified. We are seeing that we need to do the same for SPIR-V directly as some of the liboffload unit tests are compiled for `spirv64` directly, otherwise we produce invalid SPIR-V. --------- Signed-off-by: Nick Sarnie <nick.sarnie@intel.com>
19 lines
692 B
C
19 lines
692 B
C
// RUN: %clang_cc1 -triple spirv64 %s -emit-llvm -o - | FileCheck %s
|
|
// RUN: %clang_cc1 -triple spirv32 %s -emit-llvm -o - | FileCheck %s
|
|
|
|
// CHECK: define spir_func void @func(ptr noundef %{{.*}})
|
|
void func(int* arg) {
|
|
}
|
|
|
|
// CHECK: define spir_kernel void @kernel(ptr addrspace(1) noundef %{{.*}})
|
|
void __attribute__((device_kernel)) kernel(int* arg) {
|
|
// CHECK: call spir_func{{.*}} void @func(ptr noundef %{{.*}})
|
|
func(arg);
|
|
}
|
|
|
|
// CHECK: define spir_kernel void @kernel_spec(ptr addrspace(2) noundef %{{.*}})
|
|
void __attribute__((device_kernel)) kernel_spec(__attribute__((address_space(2))) int* arg) {
|
|
// CHECK: call spir_func{{.*}} void @func(ptr noundef %{{.*}})
|
|
func((int*)arg);
|
|
}
|