| 1 |
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-DXIL -DTARGET=dx |
| 2 |
// RUN: %clang_cc1 -triple spirv-linux-vulkan-library -x hlsl -emit-llvm -finclude-default-header -disable-llvm-passes -o - %s | FileCheck %s --check-prefixes=CHECK,CHECK-SPIRV -DTARGET=spv |
| 3 |
|
| 4 |
|
| 5 |
struct Input { |
| 6 |
uint Idx : SV_DispatchThreadID; |
| 7 |
|
| 8 |
}; |
| 9 |
|
| 10 |
// Make sure SV_DispatchThreadID translated into dx.thread.id. |
| 11 |
|
| 12 |
// CHECK: define void @foo() |
| 13 |
// CHECK-DXIL: %[[#ID:]] = call i32 @llvm.[[TARGET]].thread.id(i32 0) |
| 14 |
// CHECK-SPIRV: %[[#ID:]] = call i32 @llvm.[[TARGET]].thread.id.i32(i32 0) |
| 15 |
// CHECK: %[[#TMP:]] = insertvalue %struct.Input poison, i32 %[[#ID]], 0 |
| 16 |
// CHECK: %[[#VAR:]] = alloca %struct.Input, align 8 |
| 17 |
// CHECK: store %struct.Input %[[#TMP]], ptr %[[#VAR]], align 4 |
| 18 |
// CHECK-DXIL: call void @{{.*}}foo{{.*}}(ptr %[[#VAR]]) |
| 19 |
// CHECK-SPIRV: call spir_func void @{{.*}}foo{{.*}}(ptr %[[#VAR]]) |
| 20 |
[shader("compute")] |
| 21 |
[numthreads(8,8,1)] |
| 22 |
void foo(Input input) {} |
| 23 |
|