| 1 |
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -emit-llvm -disable-llvm-passes -o - -hlsl-entry main %s | FileCheck %s --check-prefixes=CHECK,CHECK-DXIL -DTARGET=dx |
| 2 |
// RUN: %clang_cc1 -triple spirv-unknown-vulkan-compute -x hlsl -emit-llvm -disable-llvm-passes -o - -hlsl-entry main %s | FileCheck %s --check-prefixes=CHECK,CHECK-SPIRV -DTARGET=spv |
| 3 |
|
| 4 |
[numthreads(1,1,1)] |
| 5 |
void main(unsigned GI : SV_GroupIndex) { |
| 6 |
main(GI - 1); |
| 7 |
} |
| 8 |
|
| 9 |
// For HLSL entry functions, we are generating a C-export function that wraps |
| 10 |
// the C++-mangled entry function. The wrapper function can be used to populate |
| 11 |
// semantic parameters and provides the expected void(void) signature that |
| 12 |
// drivers expect for entry points. |
| 13 |
|
| 14 |
// CHECK: define void @main() #[[#ENTRY_ATTR:]] { |
| 15 |
// CHECK: entry: |
| 16 |
// CHECK: %[[#ID_X:]] = call i32 @llvm.[[TARGET]].flattened.thread.id.in.group() |
| 17 |
// CHECK-DXIL: call void @_Z4mainj(i32 %[[#ID_X]]) |
| 18 |
// CHECK-SPIRV: call spir_func void @_Z4mainj(i32 %[[#ID_X]]) |
| 19 |
// CHECK: ret void |
| 20 |
// CHECK: } |
| 21 |
|
| 22 |
// Verify that the entry had the expected dx.shader attribute |
| 23 |
|
| 24 |
// CHECK: attributes #[[#ENTRY_ATTR]] = { {{.*}}"hlsl.shader"="compute"{{.*}} } |