22 lines · plain
1// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -x hip %s \2// RUN: -fgpu-rdc -std=c++11 -emit-llvm -o - -target-cpu gfx906 | FileCheck %s3 4#include "Inputs/cuda.h"5 6// CHECK-LABEL: @__clang_gpu_used_external = internal {{.*}}global7// References to the kernels must be in order of appearance.8// CHECK-SAME: [ptr @_Z6kernelILi3EEvPi, ptr @_Z6kernelILi1EEvPi, ptr @_Z6kernelILi2EEvPi, ptr @_Z6kernelILi0EEvPi]9 10template <int N>11__global__ void kernel(int* out) { *out = N; }12 13void host(int n) {14 void * k;15 switch (n) {16 case 3: k = (void*)&kernel<3>; break;17 case 1: k = (void*)&kernel<1>; break;18 case 2: k = (void*)&kernel<2>; break;19 case 0: k = (void*)&kernel<0>; break;20 }21}22