| 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-DX,CHECK |
| 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-VK,CHECK |
| 3 |
|
| 4 |
|
| 5 |
struct Input { |
| 6 |
float Idx : SV_Position0; |
| 7 |
float Gid : SV_Position1; |
| 8 |
}; |
| 9 |
|
| 10 |
struct Output { |
| 11 |
float a : A; |
| 12 |
float b : B; |
| 13 |
}; |
| 14 |
|
| 15 |
// Make sure SV_DispatchThreadID translated into dx.thread.id. |
| 16 |
|
| 17 |
// CHECK-DX: define hidden void @_Z3foo5Input(ptr dead_on_unwind noalias writable sret(%struct.Output) align 1 %agg.result, ptr noundef byval(%struct.Input) align 1 %input) |
| 18 |
// CHECK-VK: define hidden spir_func void @_Z3foo5Input(ptr dead_on_unwind noalias writable sret(%struct.Output) align 1 %agg.result, ptr noundef byval(%struct.Input) align 1 %input) |
| 19 |
|
| 20 |
// CHECK: %Idx = getelementptr inbounds nuw %struct.Input, ptr %input, i32 0, i32 0 |
| 21 |
// CHECK: %[[#tmp:]] = load float, ptr %Idx, align 1 |
| 22 |
// CHECK: %a = getelementptr inbounds nuw %struct.Output, ptr %agg.result, i32 0, i32 0 |
| 23 |
// CHECK: store float %[[#tmp]], ptr %a, align 1 |
| 24 |
// CHECK: %Gid = getelementptr inbounds nuw %struct.Input, ptr %input, i32 0, i32 1 |
| 25 |
// CHECK: %[[#tmp:]] = load float, ptr %Gid, align 1 |
| 26 |
// CHECK: %b = getelementptr inbounds nuw %struct.Output, ptr %agg.result, i32 0, i32 1 |
| 27 |
// CHECK: store float %[[#tmp]], ptr %b, align 1 |
| 28 |
|
| 29 |
Output foo(Input input) { |
| 30 |
Output o; |
| 31 |
o.a = input.Idx; |
| 32 |
o.b = input.Gid; |
| 33 |
return o; |
| 34 |
} |
| 35 |
|