| // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --version 5 |
| // RUN: %clang_cc1 "-triple" "nvptx64-nvidia-cuda" -emit-llvm -fcuda-is-device -o - %s | FileCheck %s |
| |
| #include "Inputs/cuda.h" |
| |
| struct S {}; |
| |
| __global__ void kernel(__grid_constant__ const S gc_arg1, int arg2, __grid_constant__ const int gc_arg3) {} |
| |
| // dependent arguments get diagnosed after instantiation. |
| template <typename T> |
| __global__ void tkernel_const(__grid_constant__ const T arg) {} |
| |
| template <typename T> |
| __global__ void tkernel(int dummy, __grid_constant__ T arg) {} |
| |
| void foo() { |
| tkernel_const<const S><<<1,1>>>({}); |
| tkernel_const<S><<<1,1>>>({}); |
| tkernel<const S><<<1,1>>>(1, {}); |
| } |
| |
| // CHECK: define dso_local ptx_kernel void @_Z6kernel1Sii(ptr noundef byval(%struct.S) align 1 "nvvm.grid_constant" %gc_arg1, i32 noundef %arg2, i32 noundef "nvvm.grid_constant" %gc_arg3) |
| // CHECK: define ptx_kernel void @_Z13tkernel_constIK1SEvT_(ptr noundef byval(%struct.S) align 1 "nvvm.grid_constant" %arg) |
| // CHECK: define ptx_kernel void @_Z13tkernel_constI1SEvT_(ptr noundef byval(%struct.S) align 1 "nvvm.grid_constant" %arg) |
| // CHECK: define ptx_kernel void @_Z7tkernelIK1SEviT_(i32 noundef %dummy, ptr noundef byval(%struct.S) align 1 "nvvm.grid_constant" %arg) |
| |