brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 2f8dc97 Raw
36 lines · plain
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,CHECK2// 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,CHECK3 4 5struct Input {6  float Idx : SV_Position0;7  float Gid : SV_Position1;8};9 10struct 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 021// CHECK: %[[#tmp:]] = load float, ptr %Idx, align 122// CHECK: %a = getelementptr inbounds nuw %struct.Output, ptr %agg.result, i32 0, i32 023// CHECK: store float %[[#tmp]], ptr %a, align 124// CHECK: %Gid = getelementptr inbounds nuw %struct.Input, ptr %input, i32 0, i32 125// CHECK: %[[#tmp:]] = load float, ptr %Gid, align 126// CHECK: %b = getelementptr inbounds nuw %struct.Output, ptr %agg.result, i32 0, i32 127// CHECK: store float %[[#tmp]], ptr %b, align 128 29Output foo(Input input) {30  Output o;31  o.a = input.Idx;32  o.b = input.Gid;33  return o;34}35 36